-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 sum type holding alias ptrs #20786
Conversation
…ath { sin, cos }`" This reverts commit ddf0468.
vlib/v/checker/tests/sum_type_holding_alias_ptr_err.vv:3:12: error: sum type cannot hold a reference type
1 | type Alias1 = &int
2 | type Alias2 = &string
3 | type Qwe = Alias1 | Alias2
| ~~~~~~
4 |
5 | fn main() {
Details: declare the sum type with non-reference types: `Qwe = Alias1 | ...`
and use a reference to the sum type instead: `var := &Qwe(Alias1(val))` Can we get other Details message? |
Like what? |
Current one is confusing, since |
It makes it clear, thanks! |
Forbid |
This already works
|
Hmm... that last error message is incorrect/confusing. Should be fixed in another PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work.
Fixes #20782