Skip to content

Assigning a boolean literal to a bool-typed class field causes a compiler crash #94

@alangpierce

Description

@alangpierce

Here's a simple test case that crashes when I run it through asc:

class A {
  boolValue: bool;
}

export function test(): void {
  let a: A;
  a.boolValue = true;
}

I get this error:

$ asc src/index.ts -b test.wasm

/Users/alanpierce/code/assemblyscript/node_modules/binaryen/index.js:6
if(m){var da,ea;a.read=function(b,d){var c=p(b);c||(da||(da=require("fs")),ea||(ea=require("path")),b=ea.normalize(b),c=da.readFileSync(b));return d?c:c.toString()};a.readBinary=function(b){b=a.read(b,!0);b.buffer||(b=new Uint8Array(b));assert(b.buffer);return b};1<process.argv.length&&(a.thisProgram=process.argv[1].replace(/\\/g,"/"));a.arguments=process.argv.slice(2);process.on("uncaughtException",function(b){if(!(b instanceof fa))throw b;});process.on("unhandledRejection",function(){process.exit(1)});
                                                                                                                                                                                                                                                                                                                                                                                                                                                     ^
abort(). Build with -s ASSERTIONS=1 for more info.

I'll see if I can contribute a fix for this. Any pointers would be helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions