Procházet zdrojové kódy

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

Dan Korostelev před 10 roky
rodič
revize
93b8758998
1 změnil soubory, kde provedl 19 přidání a 0 odebrání
  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;
+    }
+}