Ver Fonte

[macro] reset typer.curclass before each init macro
fixes #9483

Aleksandr Kuzmenko há 5 anos atrás
pai
commit
e993e9d78d

+ 1 - 0
extra/CHANGES.txt

@@ -3,6 +3,7 @@
 	Bugfixes:
 
 	flash : fixed var shadowing issue for variables captured in a closure inside of a loop (#9624)
+	nullsafety: fixed "Type not found NullSafetyMode_Impl_" (#9483)
 
 2020-06-19 4.1.2
 

+ 1 - 0
src/typing/macroContext.ml

@@ -757,6 +757,7 @@ let type_macro ctx mode cpath f (el:Ast.expr list) p =
 
 let call_macro ctx path meth args p =
 	let mctx, (margs,_,mclass,mfield), call = load_macro ctx false path meth p in
+	mctx.curclass <- null_class;
 	let el, _ = Calls.unify_call_args mctx args margs t_dynamic p false false in
 	call (List.map (fun e -> try Interp.make_const e with Exit -> error "Parameter should be a constant" e.epos) el)
 

+ 9 - 0
tests/misc/projects/Issue9483/Macro.hx

@@ -0,0 +1,9 @@
+import haxe.macro.Context;
+import sys.FileSystem;
+import sys.io.File;
+
+class Macro {
+	macro static function build():haxe.macro.Expr {
+		return macro null;
+	}
+}

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

@@ -0,0 +1,5 @@
+class Main {
+	static function main() {
+
+	}
+}

+ 3 - 0
tests/misc/projects/Issue9483/compile-success.hxml

@@ -0,0 +1,3 @@
+--main Main
+--macro Macro.build()
+--macro nullSafety("pack", Loose)