Skip to content

checker: check invalid comptime field name assignment #24421

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

Merged
merged 12 commits into from
May 13, 2025

Conversation

Delta456
Copy link
Member

@Delta456 Delta456 commented May 5, 2025

Fixes #24415

Copy link

Connected to Huly®: V_0.6-22793

@Delta456 Delta456 marked this pull request as draft May 5, 2025 19:04
@Delta456 Delta456 marked this pull request as ready for review May 5, 2025 20:17
@Delta456 Delta456 requested a review from spytheman May 13, 2025 15:28
Comment on lines 442 to 450
mut old_inside_x_matches_type := c.inside_x_matches_type
if is_type_node {
c.inside_x_matches_type = true
old_inside_x_matches_type = c.inside_x_matches_type
}
expr_type := c.expr(mut expr)
if is_type_node {
c.inside_x_matches_type = old_inside_x_matches_type
}
Copy link
Member

@spytheman spytheman May 13, 2025

Choose a reason for hiding this comment

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

That essentially still sets c.inside_x_matches_type to true permanently for the rest of the analyzed .v file (in the checker instance), but in a more complicated way, compared to before.

Copy link
Member

Choose a reason for hiding this comment

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

What will set it back to false, once it becomes true?

If it should be permanently true, why have the bool field at all?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right. I am overthinking. Mind if you can solve this issue?

Copy link
Member

Choose a reason for hiding this comment

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

I just removed the field completely.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

should be fixed now

Copy link
Member Author

Choose a reason for hiding this comment

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

Can we also add a test case for #24421 (comment) ?

Copy link
Member

Choose a reason for hiding this comment

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

I'll add a test tomorrow, since it is pretty late here, and it will need several nested $for and matches.

@spytheman spytheman merged commit 915ff40 into vlang:master May 13, 2025
74 checks passed
@Delta456 Delta456 deleted the make branch May 14, 2025 03:57
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.

C compiler type error
3 participants