Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add accessor function types in MemberDescription #19

Closed
wants to merge 0 commits into from

Conversation

Shanks0224
Copy link
Contributor

Joint debugging with @zhenweijin

@xujuntwt95329
Copy link
Contributor

@Shanks0224 Is there any test cases to cover this fix?

@Shanks0224
Copy link
Contributor Author

Shanks0224 commented Oct 9, 2023

@Shanks0224 Is there any test cases to cover this fix?

interface I {
    _row?: number;

    set row(val: number);

    get row(): number;
}

class A implements I {
    _row: number;

    constructor(row: number) {
        this._row = row;
    }

    get row() {
        return this._row;
    }

    set row(val: number) {
        this._row = val;
    }
}

export function test() {
    const a: A = new A(1);
    const i: I = a;
    i.row = 5;
}

When there is an optional field in the interface and this field is operated on through the accessor, the compiler will report an error.

@xujuntwt95329
Copy link
Contributor

@Shanks0224 Is there any test cases to cover this fix?

interface I {
    _row?: number;

    set row(val: number);

    get row(): number;
}

class A implements I {
    _row: number;

    constructor(row: number) {
        this._row = row;
    }

    get row() {
        return this._row;
    }

    set row(val: number) {
        this._row = val;
    }
}

export function test() {
    const a: A = new A(1);
    const i: I = a;
    i.row = 5;
}

When there is an optional field in the interface and this field is operated on through the accessor, the compiler will report an error.

Can we add this into test cases?

@Shanks0224
Copy link
Contributor Author

@Shanks0224 Is there any test cases to cover this fix?

interface I {
    _row?: number;

    set row(val: number);

    get row(): number;
}

class A implements I {
    _row: number;

    constructor(row: number) {
        this._row = row;
    }

    get row() {
        return this._row;
    }

    set row(val: number) {
        this._row = val;
    }
}

export function test() {
    const a: A = new A(1);
    const i: I = a;
    i.row = 5;
}

When there is an optional field in the interface and this field is operated on through the accessor, the compiler will report an error.

Can we add this into test cases?

This work has not been finished yet and needs to be modified on the back end. I think we can add the case after the back-end code has been modified.

Copy link
Contributor

@kylo5aby kylo5aby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants