-
Notifications
You must be signed in to change notification settings - Fork 341
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
Typed iota value changes depending on declaration order #1596
Comments
I'm using this case currently to check the difference: package main
const (
A1 = Enum1(iota)
A2
A3
)
type Enum1 int
type Enum2 int
const (
B1 = Enum2(iota)
B2
B3
)
func main() {
println(A1, A2, A3)
println(B1, B2, B3)
} Expected output:
Actual output:
The However for Actually, completely removing this GTA iota reset/increment code passes all the tests including the new one, so I'm wondering if it's needed there at all 🤔 Lines 103 to 107 in f5b5481
@mvertes any thoughts on this? For now I'm not sure how to prevent the second increment from running, since constant value is assigned after both CFG and GTA increments run. Maybe we could track the last node that caused the increment in the scope? Dropping GTA increment sounds dangerous, even though the tests are good. |
The following program
sample.go
triggers an unexpected resultExpected result
Got
Yaegi Version
f5b5481
Additional Notes
Moving
type Enum int
beforeconst
fixes the issue.The text was updated successfully, but these errors were encountered: