Closed
Description
What
The compiler crashes like this:
▌ Whoops, the AssemblyScript compiler has crashed during compile :-(
▌
▌ Here is a stack trace that may or may not be useful:
▌
▌ AssertionError: assertion failed
▌ at i.assert (/usr/local/lib/node_modules/asbuild/node_modules/assemblyscript/dist/assemblyscript.js:7:737201)
▌ at p.addScopedDummyLocal (/usr/local/lib/node_modules/asbuild/node_modules/assemblyscript/dist/assemblyscript.js:7:416126)
▌ at f.compileVariableStatement (/usr/local/lib/node_modules/asbuild/node_modules/assemblyscript/dist/assemblyscript.js:7:232586)
▌ at f.compileStatement (/usr/local/lib/node_modules/asbuild/node_modules/assemblyscript/dist/assemblyscript.js:7:223388)
▌ at f.compileStatements (/usr/local/lib/node_modules/asbuild/node_modules/assemblyscript/dist/assemblyscript.js:7:223935)
▌ at f.compileFunctionBody (/usr/local/lib/node_modules/asbuild/node_modules/assemblyscript/dist/assemblyscript.js:7:213143)
▌ at f.compileFunction (/usr/local/lib/node_modules/asbuild/node_modules/assemblyscript/dist/assemblyscript.js:7:212127)
▌ at f.compileElement (/usr/local/lib/node_modules/asbuild/node_modules/assemblyscript/dist/assemblyscript.js:7:204050)
▌ at f.compileExports (/usr/local/lib/node_modules/asbuild/node_modules/assemblyscript/dist/assemblyscript.js:7:204790)
▌ at f.compile (/usr/local/lib/node_modules/asbuild/node_modules/assemblyscript/dist/assemblyscript.js:7:195042)
▌
▌ If it refers to the dist files, try to 'npm install source-map-support' and
▌ run again, which should then show the actual code location in the sources.
▌
▌ If you see where the error is, feel free to send us a pull request. If not,
▌ please let us know: https://github.com/AssemblyScript/assemblyscript/issues
▌
▌ Thank you!
When
Doing variable shadowing like this:
export function foo(): i32 {
let a = 20 + 20;
let b = 50;
let a = a + b;
return 42;
}
Expected
It would be nice to have some kind of user friendly error message on this. It seems like a very simple error, but the problem is that I'm working in a huge codebase and it was a bit annoying to find that it was a problem with variable shadowing.
Context
By the way I only got this problem because we're updating from v0.6 to v0.19, so yeah quite a big jump 😅 .
And yeah, shadowing didn't seem to be a problem back then.
I have no problems in this feature not existing anymore (variable shadowing), I would just be more pleased to have a better error message, if possible 😊 .
Thanks
Also, huge thanks for this project, we use extensively here at The Graph (@graphprotocol).