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

checker: disallow $for i in struct.values and $for i in enum.fields #19845

Merged
merged 7 commits into from Nov 13, 2023

Conversation

Delta456
Copy link
Member

@Delta456 Delta456 commented Nov 11, 2023

Closes #19844

🤖 Generated by Copilot at 0383e47

This pull request improves the error handling of comptime field and value lookups in the vlib/v/checker module. It also adds test cases and output files to verify the expected behavior of the checker module for invalid $for syntax on enum and struct types.

🤖 Generated by Copilot at 0383e47

  • Add error handling for invalid comptime lookups on enums and structs (link, link)
  • Add test cases and outputs for invalid comptime lookups on enums and structs (link, link, link, link)

@Delta456 Delta456 self-assigned this Nov 11, 2023
@Delta456 Delta456 marked this pull request as draft November 11, 2023 17:46
@Delta456 Delta456 marked this pull request as ready for review November 11, 2023 19:34
@Delta456
Copy link
Member Author

Unrelated CI error on windows msvc.

Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wording of the error messages seems a bit unclear to me, other than that, good work.

@spytheman spytheman merged commit 55cac88 into vlang:master Nov 13, 2023
51 of 54 checks passed
Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work.

@Delta456 Delta456 deleted the comptime_for_invalid_access branch November 13, 2023 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

no error given when $for item in enum.fields and $for item in struct.values
2 participants