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

no error given when $for item in enum.fields and $for item in struct.values #19844

Closed
Delta456 opened this issue Nov 11, 2023 · 0 comments · Fixed by #19845
Closed

no error given when $for item in enum.fields and $for item in struct.values #19844

Delta456 opened this issue Nov 11, 2023 · 0 comments · Fixed by #19845
Assignees
Labels
Bug This tag is applied to issues which reports bugs. Nicer V Errors Bugs/feature requests, related to improving V error messages.

Comments

@Delta456
Copy link
Member

Delta456 commented Nov 11, 2023

Describe the bug

There's no error given if comptime for is used incorrectly in situations like:

struct Foo{}

fn (_ Foo) hello() {}

$for i in Foo.values {
    println(i)
}
enum Test {
  one
  two
}

$for i in Test.fields {
    println(i)
}

Reproduction Steps

Write the above code and compile it

Expected Behavior

An error like cannot use enum.fields and cannot use struct.values

Current Behavior

No output or error

Possible Solution

A checker error for each of these

Additional Information/Context

No response

V version

Latest

Environment details (OS name and version, etc.)

Pop OS

@Delta456 Delta456 added the Bug This tag is applied to issues which reports bugs. label Nov 11, 2023
@Delta456 Delta456 self-assigned this Nov 11, 2023
@Delta456 Delta456 changed the title no error given when $for item in enum.fields and $for item in struct.values` no error given when $for item in enum.fields and $for item in struct.values Nov 11, 2023
@ArtemkaKun ArtemkaKun added the Nicer V Errors Bugs/feature requests, related to improving V error messages. label Nov 11, 2023
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. Nicer V Errors Bugs/feature requests, related to improving V error messages.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants