|
@@ -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 =
|