浏览代码

add test for Null<T> unwrapping in inline functions (closes #3585)

Dan Korostelev 10 年之前
父节点
当前提交
93b8758998
共有 1 个文件被更改,包括 19 次插入0 次删除
  1. 19 0
      tests/unit/src/unit/issues/Issue3585.hx

+ 19 - 0
tests/unit/src/unit/issues/Issue3585.hx

@@ -0,0 +1,19 @@
+package unit.issues;
+import unit.Test;
+
+class Issue3585 extends Test {
+    function test() {
+        var v = inlineUnwrap();
+        eq(getType(v), "Int");
+    }
+
+    static macro function getType(v:haxe.macro.Expr) {
+        var t = haxe.macro.Context.typeof(v);
+        return macro $v{haxe.macro.TypeTools.toString(t)};
+    }
+
+    inline function inlineUnwrap():Int {
+        var tmp:Null<Int> = 1;
+        return tmp;
+    }
+}