Browse Source

don't do closure checks in display mode (closes #5122)

Simon Krajewski 9 years ago
parent
commit
1da0ca8b84

+ 1 - 1
src/typing/typer.ml

@@ -1338,7 +1338,7 @@ let rec type_ident_raise ctx i p mode =
 		| Some (params,e) ->
 			let t = monomorphs params v.v_type in
 			(match e with
-			| Some ({ eexpr = TFunction f } as e) ->
+			| Some ({ eexpr = TFunction f } as e) when ctx.com.display = DMNone ->
 				begin match mode with
 					| MSet -> error "Cannot set inline closure" p
 					| MGet -> error "Cannot create closure on inline closure" p

+ 9 - 0
tests/misc/projects/Issue5122/Main.hx

@@ -0,0 +1,9 @@
+class Main {
+    static function main() {
+        inline function start() {
+            return "foo";
+        }
+
+        start();
+    }
+}

+ 1 - 0
tests/misc/projects/Issue5122/compile.hxml

@@ -0,0 +1 @@
+--display Main.hx@131@type

+ 3 - 0
tests/misc/projects/Issue5122/compile.hxml.stderr

@@ -0,0 +1,3 @@
+<type>
+Void -&gt; String
+</type>