Forráskód Böngészése

handle EDisplay in pattern matching (see #5118)

Dan Korostelev 9 éve
szülő
commit
de2342cec9

+ 3 - 0
src/typing/matcher.ml

@@ -401,6 +401,9 @@ module Pattern = struct
 				v.v_name <- "tmp";
 				let pat = make pctx e1.etype e2 in
 				PatExtractor(v,e1,pat)
+			| EDisplay(e,call) ->
+				Typer.handle_display ctx e call (WithType t) p;
+				fail()
 			| _ ->
 				fail()
 		in

+ 11 - 0
tests/misc/projects/Issue5118/Main.hx

@@ -0,0 +1,11 @@
+import haxe.ds.Option;
+
+class Main {
+    static function main() {
+        var a = Some(10);
+        switch (a) {
+            case None:
+            case Some(v):
+        }
+    }
+}

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

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

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

@@ -0,0 +1,3 @@
+<type>
+haxe.ds.Option&lt;Unknown&lt;0&gt;&gt;
+</type>