Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #10641
- Loading branch information
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package unit.issues; | ||
|
||
private abstract A(Int) from Int { | ||
@:op(A++) | ||
function preInc():Void; | ||
|
||
@:op(++A) | ||
function postInc():Void; | ||
} | ||
|
||
macro function check() { | ||
#if macro | ||
final type = haxe.macro.ComplexTypeTools.toType(TPath({ | ||
pack: ["unit", "issues"], | ||
name: "Issue10641", | ||
sub: "A" | ||
})); | ||
var acc = []; | ||
function add(s:String) { | ||
acc.push(s); | ||
} | ||
switch type { | ||
case TAbstract(_.get() => t, params): | ||
final unop = t.unops[0]; | ||
for (unop in t.unops) { | ||
add("" + unop.op); | ||
add("" + unop.postFix); | ||
add(unop.field.name); | ||
} | ||
case _: | ||
} | ||
return macro $v{acc.join(" ")}; | ||
#end | ||
} | ||
|
||
class Issue10641 extends unit.Test { | ||
public function test() { | ||
eq("OpIncrement true preInc OpIncrement false postInc", check()); | ||
} | ||
} |