We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
#20270
type TestSum = int | string struct Abc { s TestSum } fn gen[T](struc T) { $if T is $struct { $for field in T.fields { field_value := struc.$(field.name) $if field_value is $sumtype { $for v in field_value.variants { if field_value is v { // smartcast // works beautifully dump(field_value) // Not Works $if field_value is string { println('text') // bug } $else $if field_value is int { println('text') } $else { println('text') } } } } } } } fn main() { a := Abc{TestSum(123)} b := Abc{TestSum('foo')} gen[Abc](a) gen[Abc](b) }
[discardable.v:15] field_value: 123 text [discardable.v:15] field_value: foo text
discardable.v:19:8: cgen error: checker bug; print arg.typ is 0 17 | $if field_value is string { 18 | // dump(field_value) 19 | println('text') | ~~~~~~~~~~~~~~~ 20 | } $else $if field_value is int { 21 | println('text')
No response
V 0.4.3 4690fec
Ubuntu
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.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
#20270
Reproduction Steps
Expected Behavior
Current Behavior
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.3 4690fec
Environment details (OS name and version, etc.)
Ubuntu
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.
The text was updated successfully, but these errors were encountered: