|
@@ -1871,8 +1871,9 @@ and type_expr ?(mode=MGet) ctx (e,p) (with_type:WithType.t) =
|
|
| TAbstract({a_path = [],"Null"},[t]) -> tmin
|
|
| TAbstract({a_path = [],"Null"},[t]) -> tmin
|
|
| _ -> follow_null tmin
|
|
| _ -> follow_null tmin
|
|
in
|
|
in
|
|
- let e1 = vr#as_var "tmp" {e1 with etype = ctx.t.tnull tmin} in
|
|
|
|
- let e_null = Builder.make_null e1.etype e1.epos in
|
|
|
|
|
|
+ let e1_null_t = if is_nullable e1.etype then e1.etype else ctx.t.tnull e1.etype in
|
|
|
|
+ let e1 = vr#as_var "tmp" {e1 with etype = e1_null_t} in
|
|
|
|
+ let e_null = Builder.make_null e1_null_t e1.epos in
|
|
let e_cond = mk (TBinop(OpNotEq,e1,e_null)) ctx.t.tbool e1.epos in
|
|
let e_cond = mk (TBinop(OpNotEq,e1,e_null)) ctx.t.tbool e1.epos in
|
|
let e_if = mk (TIf(e_cond,cast e1,Some e2)) iftype p in
|
|
let e_if = mk (TIf(e_cond,cast e1,Some e2)) iftype p in
|
|
vr#to_texpr e_if
|
|
vr#to_texpr e_if
|