Skip to content

Compiler crashes when a generic method is used to implement a non-generic interface method #3006

@Changqing-JING

Description

@Changqing-JING

Bug description

The compiler crashes with an AssertionError: assertion failed instead of producing a diagnostic when a class implements an interface but uses a generic method where the interface declares a non-generic one.

Steps to reproduce

interface I {
  foo(x: i32): i32;
}

class CC implements I {
  foo<T>(x: i32): i32 {
    return x;
  }
}

let c:I = new CC();
c.foo(1);

run node ./bin/asc.js ./demo/test.ts

Whoops, the AssemblyScript compiler has crashed during compile :-(
▌
▌ Here is the stack trace hinting at the problem, perhaps it's useful?
▌
▌ AssertionError: assertion failed
▌     at assert2 (D:\code\workspace\github\assemblyscript\std\portable\index.js:216:11)
▌     at Resolver.resolveFunction (D:\code\workspace\github\assemblyscript\src\resolver.ts:2798:7)
▌     at Resolver.resolveOverrides (D:\code\workspace\gi42)
▌     at Module.compile (D:\code\workspace\github\assemblyscript\src\index-wasm.ts:358:32)
▌     at Module.main (D:\code\workspace\github\assemblyscript\cli\index.js:732:31)
▌     at async file:///D:/code/workspace/github/assemblyscript/bin/asc.js:33:22
▌
▌ 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!

AssemblyScript version

v0.28.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions