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

Invalid code generated when capture variable and match expession have the same name #97

Closed bendmorris closed 5 years ago

bendmorris commented 5 years ago

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

function f(): Option[Int] {
    return Some(1);
}

function main() {
    var result = f();
    match result {
        Some(result) => {
            printf("%i\n", result);
        }
    }
}
[2019-01-05 13:33:56.8171] ===> compiling
----------------------------------------
Error: build/lib/kit_main.c: In function ‘main’:
build/lib/kit_main.c:10:32: error: request for member ‘__var’ in something not a structure or union
             int result = result.__var.variant_Some.value;
                                ^
build/lib/kit_main.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-shift-op-parentheses’