Skip to content

Type checker appears to be unable to handle this and super #69

Open
@mattcce

Description

@mattcce

Attempting to use the this and super keywords results in a failure before the CSE machine starts to run; outputted errors appear to suggest the problem originates from the type checker.

Test code:

class C {
    private int x = 2;
    
    public C(int y) {
    }
    
    public void instanceMethod(int y) {
        C d = new C(2);
        int i = d.x;
        x = 0;
    }
    
    public static void main(String[] args) {
        C c = new C(1);
        c.instanceMethod(1);
    }
}

class D extends C {
    public void instanceMethod(int y) {
        // code does not 'compile'; CSE machine never starts running
        this.instanceMethod(1); // fails (error A)
        super.instanceMethod(1); // fails (error B)
    }
}

Console Output
error A (truncated): Error: Check is not implemented for this type of node This.
error B (truncated): Error: not implemented

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions