HaxeFoundation / HaxeFoundation/haxe

[ide] switch completion vs GADT-restricted cases

Open
#9,969 0 comments 0 reactions 0 assignees View on GitHub
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:

![e41gYWjanx](https://user-images.githubusercontent.com/49749/100552394-3ff61e00-3287-11eb-88b4-4e87dee1f966.gif)

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.