assemblyscript icon indicating copy to clipboard operation
assemblyscript copied to clipboard

Multi implements / extends issue

Open JesseCodeBones opened this issue 3 years ago • 1 comments

Hi Maintainers, I found the class resolver for implements only check the name of the property or function, with will cause compile error during multi implements or extends. here is demo code:

interface TwoDimensionalCoordinates {
    x: i32;
    y: i32;
}

interface ThreeDimensionalCoordinates {
    x: i32;
    y: i32;
    z: i32;
}

class RealCoordinates implements TwoDimensionalCoordinates, ThreeDimensionalCoordinates {
    x: i32 = 2;
    y: i32 = 2;
    z: i32 = 2;
}
let a = new RealCoordinates();

I think if the parents vitual function or parameter has same name should bypass this check. WDYT?

the main check logic should be in isCompatibleOverride of reslover.

JesseCodeBones avatar Sep 06 '22 08:09 JesseCodeBones

Also for the FunctionPrototype: This is one Demo code:

interface Car {
    getHeight():i32;
}

interface Mechanical {
    getHeight():i32;
}

class Nissan implements Mechanical, Car {
    getHeight():i32{return 1;}
}
let b = new Nissan();

JesseCodeBones avatar Sep 06 '22 08:09 JesseCodeBones