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: add check if as cast used incorrectly for selector-expr #20725

Merged
merged 4 commits into from Feb 4, 2024

Conversation

Delta456
Copy link
Member

@Delta456 Delta456 commented Feb 3, 2024

Adds a checker error as proposed at #20718 (comment)

vlib/v/checker/tests/as_cast_selector_expr_err.vv:15:14: error: indeterminate `as` cast, use parenthesis to clarity
   13 | fn main() {
   14 |     mut bar := Foobar(Bar{y: 123})
   15 |     println(bar as Bar.y == 123)
      |                 ~~
   16 | }
Details: for example `(bar as main.Bar).y`

@Delta456 Delta456 marked this pull request as draft February 3, 2024 21:22
@Delta456 Delta456 marked this pull request as ready for review February 4, 2024 06:37
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.

Excellent work.

@spytheman spytheman merged commit 932574e into vlang:master Feb 4, 2024
54 checks passed
@Delta456 Delta456 deleted the selector_expr_as_cast branch February 4, 2024 08:39
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.

None yet

2 participants