assemblyscript icon indicating copy to clipboard operation
assemblyscript copied to clipboard

The bug for `implements` interface and `extends` class when meet same function name

Open yjhmelody opened this issue 2 years ago • 0 comments

Bug description

export interface CoreVisitor<T>  {
    visitBool(v: boolean): T;
}

class A implements CoreVisitor<string>, CoreVisitor<boolean> {
    // @ts-ignore
    visitBool(v: boolean): string {
        throw new Error("Method not implemented.");
    }
}

let a: A = new A();

// Or the following code
abstract class Foo {
   abstract visitBool(v: boolean): string;
}
export interface CoreVisitor<T>  {
    visitBool(v: boolean): T;
}

class A extends Foo implements  CoreVisitor<boolean> {
    // @ts-ignore
    visitBool(v: boolean): string {
        throw new Error("Method not implemented.");
    }
}

// Or

abstract class Bar<T> {
    abstract visitBool(v: boolean): T;
}

export interface CoreVisitor<T>  {
    visitBool(v: boolean): T;
}

class A extends Bar<string> implements  CoreVisitor<boolean> {
    // @ts-ignore
    visitBool(v: boolean): string {
        throw new Error("Method not implemented.");
    }
}

This code should report compile error.

Steps to reproduce

Playground

AssemblyScript version

v0.27

yjhmelody avatar Feb 13 '23 14:02 yjhmelody