kantan-lang icon indicating copy to clipboard operation
kantan-lang copied to clipboard

Enum Fields are the same type as the enum

Open Funkschy opened this issue 5 years ago • 1 comments

This allows weird behaviour like this:

type Enum enum {
     First
}

type Test struct {
    e: Enum
}

def main() {
    let t: Test = undefined;
    t.e.First; // this is currently valid
}

Funkschy avatar Jun 22 '20 16:06 Funkschy

we can also crash the compiler by doing:

let t = Test;

Funkschy avatar Jun 25 '20 17:06 Funkschy