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

Comptime conditional in defer is parser error #20719

Closed
edam opened this issue Feb 3, 2024 · 0 comments · Fixed by #20723
Closed

Comptime conditional in defer is parser error #20719

edam opened this issue Feb 3, 2024 · 0 comments · Fixed by #20723
Assignees
Labels
Bug This tag is applied to issues which reports bugs. Unit: Checker Bugs/feature requests, that are related to the type checker.

Comments

@edam
Copy link
Member

edam commented Feb 3, 2024

Describe the bug

If you attempt to use a comptime conditional $if statement within a defer block, the parser gives an error.

Reproduction Steps

defer {
  $if foo ? { // error: undefined ident: `foo`
    // whatever
  }
}

Expected Behavior

This should be allowed by the parser

Current Behavior

Parser gives error

tim.v:18:7: error: undefined ident: `foo`
   16 | fn main() {
   17 |     defer {
   18 |         $if foo ? {
      |             ~~~
   19 |             println('foo')
   20 |         }

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.4 10aaeeb

Environment details (OS name and version, etc.)

Mac

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.

@edam edam added the Bug This tag is applied to issues which reports bugs. label Feb 3, 2024
@felipensp felipensp self-assigned this Feb 3, 2024
@felipensp felipensp added the Unit: Checker Bugs/feature requests, that are related to the type checker. label Feb 3, 2024
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. Unit: Checker Bugs/feature requests, that are related to the type checker.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants