Given these enums:
enum Either1<A> {
A(v:A);
}
enum Either2<A, B> {
A(v:A);
B(v:B);
}
enum Either3<A, B, C> {
A(v:A);
B(v:B);
C(v:C);
}
enum Either4<A, B, C, D> {
A(v:A);
B(v:B);
C(v:C);
D(v:D);
}
And this function:
public static function getValue(e: Dynamic): Dynamic {
switch(Type.getEnum(e)) {
case Either1:
switch(e) {
case A(a):
a;
}
case Either2:
switch(e) {
case A(a):
a;
case B(b):
b;
}
case Either3:
switch(e) {
case A(a):
a;
case B(b):
b;
case C(c):
c;
}
case Either4:
switch(e) {
case A(a):
a;
case B(b):
b;
case C(c):
c;
case D(d):
d;
}
case _:
e;
}
}
I get this compilation error on haxe 3.4.7:
Unmatched patterns: A | B | C
But, I only get this compilation error only AFTER I add the Either4 case. Up until then it compiles as expected.
Am I missing something?