HaxeFoundation / HaxeFoundation/haxe
Exhaustive check for multiple Null<T> types
Open
bug
feature-pattern-matching
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
4.0.5
```haxe
import haxe.ds.Option;
class Main {
public static function main() {
var o:{ foo : Null>, bar : Null> } = null;
switch [o.foo, o.bar] {
case [Some(foo), Some(bar)]:
1;
case [None, _]:
2;
case [_, None]:
3;
}
}
}
```
gives `Unmatched patterns: Some` at `o.bar`
adding two more cases fixes it:
```haxe
case [_, null]: 4;
case [null, _]: 5;
```
Doesn't seem to be consistent with pattern matching on single value (no need `case null`):
```haxe
switch o.bar {
case Some(bar):
1;
case None:
2;
}
```
Contributor guide
Assessment
This issue has not been assessed yet.