فهرست منبع

add test (closes #3346)

Simon Krajewski 11 سال پیش
والد
کامیت
ae0e87b44e
1فایلهای تغییر یافته به همراه21 افزوده شده و 0 حذف شده
  1. 21 0
      tests/unit/issues/Issue3346.hx

+ 21 - 0
tests/unit/issues/Issue3346.hx

@@ -0,0 +1,21 @@
+package unit.issues;
+
+private abstract IntKey(String) {
+    function new(s) this = s;
+    @:to function toInt():Int return Std.parseInt(this);
+    @:from static function fromInt(v:Int):IntKey return new IntKey(Std.string(v));
+}
+
+
+class Issue3346 extends Test {
+	function test(){
+		t(m());
+	}
+
+    static macro function m() {
+        var actualType = haxe.macro.Context.typeof(macro 1);
+        var expectedType = haxe.macro.Context.typeof(macro (null : IntKey));
+        var unify = haxe.macro.Context.unify(actualType, expectedType);
+        return macro $v{unify};
+    }
+}