Browse Source

reverted #6825 (closes #6847)

Alexander Kuzmenko 7 years ago
parent
commit
bad35d8aad
3 changed files with 2 additions and 27 deletions
  1. 0 12
      src/core/type.ml
  2. 1 14
      src/typing/typer.ml
  3. 1 1
      std/haxe/io/BufferInput.hx

+ 0 - 12
src/core/type.ml

@@ -1641,18 +1641,6 @@ let has_meta m ml = List.exists (fun (m2,_,_) -> m = m2) ml
 let get_meta m ml = List.find (fun (m2,_,_) -> m = m2) ml
 let no_meta = []
 
-(**
-	Check if type `t` has meta `m`.
-	Does not follow typedefs, monomorphs etc.
-*)
-let type_has_meta t m =
-	match t with
-		| TMono _ | TFun _ | TAnon _ | TDynamic _ | TLazy _ -> false
-		| TEnum ({ e_meta = metadata }, _)
-		| TInst ({ cl_meta = metadata }, _)
-		| TType ({ t_meta = metadata }, _)
-		| TAbstract ({ a_meta = metadata }, _) -> has_meta m metadata
-
 (*
 	we can restrict access as soon as both are runtime-compatible
 *)

+ 1 - 14
src/typing/typer.ml

@@ -2586,15 +2586,6 @@ and type_access ctx e p mode =
 	| _ ->
 		AKExpr (type_expr ctx (e,p) Value)
 
-and should_be_nullable_array_access ctx array_type access_mode =
-	if access_mode = MSet then
-		false
-	else
-		match array_type with
-		| TInst ({ cl_path = [],"Array"},[t]) ->
-			not ((Common.defined ctx.com Define.Static) && (type_has_meta (Abstract.follow_with_abstracts t) Meta.NotNull))
-		| _ -> false
-
 and type_array_access ctx e1 e2 p mode =
 	let e1 = type_expr ctx e1 Value in
 	let e2 = type_expr ctx e2 Value in
@@ -2614,7 +2605,6 @@ and type_array_access ctx e1 e2 p mode =
 		| _ -> raise Not_found)
 	with Not_found ->
 		unify ctx e2.etype ctx.t.tint e2.epos;
-		let is_nullable = ref false in
 		let rec loop et =
 			match follow et with
 			| TInst ({ cl_array_access = Some t; cl_params = pl },tl) ->
@@ -2627,9 +2617,7 @@ and type_array_access ctx e1 e2 p mode =
 				t_dynamic
 			| TAbstract(a,tl) when Meta.has Meta.ArrayAccess a.a_meta ->
 				loop (apply_params a.a_params tl a.a_this)
-			| t ->
-				if should_be_nullable_array_access ctx t mode then
-					is_nullable := true;
+			| _ ->
 				let pt = mk_mono() in
 				let t = ctx.t.tarray pt in
 				(try unify_raise ctx et t p
@@ -2640,7 +2628,6 @@ and type_array_access ctx e1 e2 p mode =
 				pt
 		in
 		let pt = loop e1.etype in
-		let pt = if !is_nullable then ctx.t.tnull pt else pt in
 		AKExpr (mk (TArray (e1,e2)) pt p)
 
 and type_vars ctx vl p =

+ 1 - 1
std/haxe/io/BufferInput.hx

@@ -43,7 +43,7 @@ class BufferInput extends haxe.io.Input {
 		available += i.readBytes(buf, available, buf.length - available);
 	}
 
-	override function readByte():Int {
+	override function readByte() {
 		if( available == 0 ) refill();
 		var c = buf.get(pos);
 		pos++;