haxe icon indicating copy to clipboard operation
haxe copied to clipboard

Matching same enum twice seems to duplicate the default case.

Open back2dos opened this issue 7 months ago • 6 comments

Minmal example

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.

back2dos avatar Apr 02 '25 12:04 back2dos