ソースを参照

[typer] fail upon encountering unprocessed reification metadata

closes #10883
Simon Krajewski 2 年 前
コミット
816f2b734e

+ 3 - 0
src/typing/typer.ml

@@ -1664,6 +1664,9 @@ and type_meta ?(mode=MGet) ctx m e1 with_type p =
 			| (EReturn e, p) -> type_return ~implicit:true ctx e with_type p
 			| _ -> e()
 			end
+		| (Meta.Dollar s,_,p) ->
+			display_error ctx.com (Printf.sprintf "Reification $%s is not allowed outside of `macro` expression" s) p;
+			e()
 		| _ -> e()
 	in
 	ctx.meta <- old;

+ 5 - 0
tests/misc/projects/Issue10883/Main.hx

@@ -0,0 +1,5 @@
+class Main {
+	static function main() {
+		trace($i{"wtf"});
+	}
+}

+ 2 - 0
tests/misc/projects/Issue10883/compile-fail.hxml

@@ -0,0 +1,2 @@
+--main Main
+--interp

+ 1 - 0
tests/misc/projects/Issue10883/compile-fail.hxml.stderr

@@ -0,0 +1 @@
+Main.hx:3: characters 9-11 : Reification $i is not allowed outside of `macro` expression