Explorar o código

rename haxe.Unsafe to haxe.NullUnsafe (closes #7731)

Alexander Kuzmenko %!s(int64=6) %!d(string=hai) anos
pai
achega
63625d010c
Modificáronse 3 ficheiros con 7 adicións e 7 borrados
  1. 3 3
      src/typing/nullSafety.ml
  2. 2 2
      std/haxe/NullUnsafe.hx
  3. 2 2
      tests/nullsafety/src/cases/Test.hx

+ 3 - 3
src/typing/nullSafety.ml

@@ -187,11 +187,11 @@ class unificator =
 	end
 
 (**
-	Check if provided type is `Unsafe<T>`
+	Check if provided type is `NullUnsafe<T>`
 *)
 let is_special_type_unsafe t =
 	match t with
-		| TType ({ t_path = (["haxe"], "Unsafe") }, _) -> true
+		| TType ({ t_path = (["haxe"], "NullUnsafe") }, _) -> true
 		| _ -> false
 
 (**
@@ -889,7 +889,7 @@ class expr_checker immediate_execution report =
 			Don't cast nullable expressions to not-nullable types
 		*)
 		method private check_cast expr to_type p =
-			(* Don't check `(expr:Unsafe<T>)` *)
+			(* Don't check `(expr:NullUnsafe<T>)` *)
 			if not (is_special_type_unsafe to_type) then begin
 				self#check_expr expr;
 				match to_type with

+ 2 - 2
std/haxe/Unsafe.hx → std/haxe/NullUnsafe.hx

@@ -3,6 +3,6 @@ package haxe;
 /**
 	Special type which is handled in null safety checks to force using of nullable values as not-nullable.
 	Nullable values will be passed to/from this type without any checks.
-	Also expressions like `(expr:Unsafe<T>)` are not checked for null safety.
+	Also expressions like `(expr:NullUnsafe<T>)` are not checked for null safety.
 **/
-typedef Unsafe<T> = T;
+typedef NullUnsafe<T> = T;

+ 2 - 2
tests/nullsafety/src/cases/Test.hx

@@ -2,7 +2,7 @@ package cases;
 
 import TestSafeFieldInUnsafeClass;
 import Validator.shouldFail;
-import haxe.Unsafe;
+import haxe.NullUnsafe;
 
 private enum DummyEnum {
 	DummyOne;
@@ -44,7 +44,7 @@ class UnsafeFields {
 
 	static function unsafeExpr() {
 		var s:String;
-		(s = null:Unsafe<String>);
+		(s = null:NullUnsafe<String>);
 	}
 }