HaxeFoundation / HaxeFoundation/haxe
Matching same enum twice seems to duplicate the default case.
Open
Nobody has claimed this yet.
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
import haxe.ds.Option;
class Test {
static function main() {
var a = [
Live,
Offline({ vct: None, ot: Some('foo') }),
Offline({ vct: Some('bar'), ot: None }),
];
switch a[Std.random(a.length)] {
case Offline({ vct: Some(v) }): trace('1 $v');
case Offline({ ot: Some(v) }): trace('2 $v');
case _:
trace("default!");
}
}
}
enum A {
Offline(v:{ vct:Option<String>, ot:Option<String> });
Live;
}
You'll find the code generated for trace("default!"") twice in the output, both with Haxe 4 and nighly.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the minimal Haxe example from the issue with Haxe 4 and the nightly compiler, then inspect the generated output around the two copies of trace("default!"). Done means matching the same enum twice no longer emits duplicate default-case code.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100