HaxeFoundation / HaxeFoundation/haxe

Exhaustiveness checks thrown off by enum abstract with only null value

Open
#11,521 1 comment 0 reactions 1 assignee Claimed by @Simn View on GitHub
feature-pattern-matching
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

Weird edge case incoming:

```haxe
import haxe.ds.Option;

class Test {
static function main() {
switch Some(Working) {
case Some(Working | Somehow): // fine
case None:
}

switch Some(Broken) {
case Some(Broken): // [ERROR] Unmatched patterns: Some(_)
case None:
}
}
}

enum abstract Working(Null) {
var Working = null;
var Somehow = 123;
}

enum abstract Broken(Null) {
var Broken = null;
}
```

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.