Simn / genjvm

13 stars 1 forks source link

Exhaustive switches on compile-time-finite values #9

Closed Simn closed 5 years ago

Simn commented 5 years ago

This is currently not generated correctly:

enum E {
    A;
    B;
}

class Main {
    static public function main() {
        switch (a) {
            case A:
                return 1;
            case B:
                return 2;
        }
    }

    static var a = A;
}

I think that in cases like this we should treat the last case as default to make JVM happy.