Procházet zdrojové kódy

don't report null stuff in Cross mode

Simon Krajewski před 5 měsíci
rodič
revize
b9d75b3f6e

+ 3 - 1
src/filters/safe/sanitize.ml

@@ -76,7 +76,9 @@ let sanitize_expr config e =
 				| TFun _ -> () (* this is a bit a particular case, maybe flash-specific actually *)
 				(* TODO: this should use get_underlying_type, but we do not have access to Codegen here.  *)
 				| TAbstract(a,tl) when not (Meta.has Meta.CoreType a.a_meta) -> loop (apply_params a.a_params tl a.a_this)
-				| _ -> Error.raise_typing_error ("On static platforms, null can't be used as basic type " ^ s_type (print_context()) e.etype) e.epos
+				| _ ->
+					if config != Common.default_config then (* This is atrocious *)
+						Error.raise_typing_error ("On static platforms, null can't be used as basic type " ^ s_type (print_context()) e.etype) e.epos
 			in
 			loop e.etype
 		end;

+ 2 - 2
tests/display/src/cases/Issue11211.hx

@@ -31,7 +31,7 @@ class Issue11211 extends DisplayTestCase {
 		@:build(Issue11211.SafeAst.build())
 		class Main {
 			static function main() {
-				var errRa{-1-}nge:Null<Int> = 0;
+				var errRa{-1-}nge = 0;
 				{-4-}final pre{-2-}vId = trace("arg");{-5-}
 				if (errRange != null) {
 					final has{-3-}Comma = false;
@@ -41,7 +41,7 @@ class Issue11211 extends DisplayTestCase {
 		#end
 	**/
 	function test() {
-		eq("Null<Int>", type(pos(1)));
+		eq("Int", type(pos(1)));
 		eq("Void", type(pos(2)));
 		eq("Bool", type(pos(3)));
 		arrayEq([