Skip to content

compiler crashed when generic function override non generic function #3013

@Changqing-JING

Description

@Changqing-JING

Bug description

compiler crashed when generic function override non generic function

Steps to reproduce

var called: string = "";

class A {
  foo<T>(x: T): void {
    called = "A";
  }
}

class B extends A {
  foo(x: i32): void { // non-generic overrides generic
    called = "B";
  }
}

// Static dispatch: B.foo called directly
var b = new B();
b.foo(1);
assert(called == "B");
called = "";

// Virtual dispatch through A reference: which gets called?
var a: A = new B();
a.foo<i32>(1);
assert(called == "B"); // if vtable works, "B"; if fallback to base, "A"

build above code

AssemblyScript version

v0.28.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions