kitlang / kit

Kit: a magical, high performance programming language, designed for game development.
https://www.kitlang.org
Other
1.02k stars 29 forks source link

Monomorph confusion in function argument default values #106

Closed bendmorris closed 5 years ago

bendmorris commented 5 years ago

If this is a code issue, provide a minimal code example:

struct MyStruct {
    var a: Int;
}

function f(x: Option[MyStruct] = None) {
    return x;
}

function main() {
    var s = f();
    if s.isNone() {
        puts("hi");
    }
}

This types correctly, but generates code for the wrong None monomorph.