HaxeFoundation / HaxeFoundation/haxe
[ide] switch completion vs GADT-restricted cases
Open
feature-ide
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
As I [recently learned](https://github.com/haxetink/tink_state/pull/53), it is possible to restrict enum variants to specific GADT instances, e.g. this works fine:
```haxe
enum E {
A;
B;
C:E;
}
function main() {
var o:E = A;
switch o {
case A: trace("a");
case B: trace("b");
}
}
```
However the postfix `.switch` completion still generates `case C` in this case, which will of course fail to compile:

Contributor guide
Assessment
This issue has not been assessed yet.