ponyc
ponyc copied to clipboard
"can't use an undefined variable in an expression" error message oddity around "always true" conditionals that defined the variable
This seems related to issue #2784.
Following code (Playground)
actor Main
var _x: U8
new create(env: Env) =>
while true do
_x = 5
break
end
let y = _x + 2
env.out.print("y = " + y .string())
does not compile with error
0.52.2-f7d01e80 [release]
Compiled with: LLVM 14.0.3 -- Clang-13.0.1-x86_64
Defaults: pic=true
Error:
main.pony:8:13: can't use an undefined variable in an expression
let y = _x + 2
^