HaxeFoundation / HaxeFoundation/haxe

enum abstract, array matching and exhaustiveness bug

Open
#9,182 0 comments 0 reactions 0 assignees View on GitHub
bug feature-pattern-matching
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

This code does not compile with error message: `Unmatched patterns: false`.
Similar code but with `enum` instead of `enum abstract` compiles and works fine.
```haxe
@:enum abstract EFoo(Int) {
var Foo=1;
var Bar=2;
var FooBar=3;
}

class Test {

static function test(foo: EFoo, flag: Bool): String {

return
switch [foo, flag] {
case [Foo, _]: "Foo *";
case [_, true]: "* true";
case [Bar, _]: "Bar false";
case [FooBar, _]: "FooBar false";
}
}

static function main() {
trace(test(Bar, true));
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.