Compiler crashes with array on toplevel
Repro
Code:
a := [1]
println(a[0])
- Save above code as
foo.v - Run
v foo.v
Expected
Successfully generates binary which prints 1
Actual
v foo.v hangs up
Environment
- macOS 10.12
- V ac66d49 or 889d564
EDIT: Confirmed with 889d564
It still occurs with the latest commit 889d564 for me.
spams out this when i run it https://i-got.banned.today/4rF5Y3t.png i run linux latest commit, 889d564
With optimized build, it just hangs up. But with non-optimized build, it conitnues to dump a lot to stdout.
I took screencast:

^ verified this just now
Verified this. Weird parsing issue:
With following code i get the above issue:
a := [1]
println(a[0])
But if i indent like below:
a := [1]
println(a[0])
i get the following parsing error:
a
println
0
pass=1 fn=``
panic: foo.v:2
Fn "println" wrong arg #1. Expected "string" (s) but got "void"
exit():
also, i thought global state is not supported at all, so without an enclosing function (like main. btw enclosing works as expected), this should always give parser error ?
This works now.