assemblyscript icon indicating copy to clipboard operation
assemblyscript copied to clipboard

asc crash when use same name in class and namespace

Open HerrCai0907 opened this issue 2 years ago • 1 comments

Bug description

class NS {
  static v: i32 = 2;
}

namespace NS {
  let v: i32 = 1;
}
Fatal: Module::addGlobal: assembly/index/NS.v already exists

▌ Whoops, the AssemblyScript compiler has crashed during compile :-(
▌ 
▌ There is no stack trace. Perhaps a Binaryen exception above / in console?
▌ 
▌ > undefined
▌ 
▌ 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!

Steps to reproduce

npm run asbuild

AssemblyScript version

latest

HerrCai0907 avatar Nov 14 '23 06:11 HerrCai0907

That looks like a bug from how internal names are generated.

CountBleck avatar Nov 14 '23 06:11 CountBleck