for i := range 1 {
try(func() {
print("hello")
error("kaboom")
})
}
hello
panic: interface conversion: *object.NilType is not object.Iterator: missing method Entry
Assigning the return value of print(...) to a local variable fixes the problem
for i := range 1 {
try(func() {
x := print("hello")
error("kaboom")
})
}
hello
The bug seems to be related to the implicit nil return value from print(...) which pollutes the stack. The same behaviour is observed more clearly with the following code:
for i := range 1 {
try(func() {
"hello"
error("kaboom")
})
}
panic: interface conversion: *object.String is not object.Iterator: missing method Entry
The string "hello" is implicitly returned and is popped from the stack instead of the expected IntIter when resuming. Unfortunately i don't have any more insight on why this may be happening.
The following risor code panics when run:
Assigning the return value of
print(...)
to a local variable fixes the problemhello
The bug seems to be related to the implicit nil return value from
print(...)
which pollutes the stack. The same behaviour is observed more clearly with the following code:panic: interface conversion: *object.String is not object.Iterator: missing method Entry
The string
"hello"
is implicitly returned and is popped from the stack instead of the expectedIntIter
when resuming. Unfortunately i don't have any more insight on why this may be happening.Possibly related to #173