Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to define a static type method without defining a type #21969

Closed
dadooda opened this issue Jul 31, 2024 · 2 comments · Fixed by #21970
Closed

Possible to define a static type method without defining a type #21969

dadooda opened this issue Jul 31, 2024 · 2 comments · Fixed by #21970
Assignees
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@dadooda
Copy link

dadooda commented Jul 31, 2024

Describe the bug

It's possible to define a static type method, as described in Static type methods, without defining the struct or interface.

Reproduction Steps

This works:

fn main() {
  Mystery.hey()
}

// No definition of `Mystery` here.

fn Mystery.hey() {
  println('hey, ${@METHOD}')
}

Expected Behavior

I'd expect an error, or a warning at least. Most probably, the developer has mistyped the type name or has left out the implementation somehow.

Current Behavior

The code compiles and gets executed.

Possible Solution

No response

Additional Information/Context

No response

V version

0.4.7 7baff15

Environment details (OS name and version, etc.)

Ubuntu 18 under WSL.

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@dadooda dadooda added the Bug This tag is applied to issues which reports bugs. label Jul 31, 2024
@Delta456 Delta456 self-assigned this Jul 31, 2024
@felipensp
Copy link
Member

Bug or feature? :)

@Delta456
Copy link
Member

Bug or feature? :)

It is bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants