|
@@ -9,6 +9,12 @@ open Calls
|
|
open Fields
|
|
open Fields
|
|
open FieldAccess
|
|
open FieldAccess
|
|
|
|
|
|
|
|
+let check_error ctx err p = match err with
|
|
|
|
+ | Module_not_found ([],name) when Diagnostics.error_in_diagnostics_run ctx.com p ->
|
|
|
|
+ DisplayToplevel.handle_unresolved_identifier ctx name p true
|
|
|
|
+ | _ ->
|
|
|
|
+ Common.located_display_error ctx.com (error_msg p err)
|
|
|
|
+
|
|
module BinopResult = struct
|
|
module BinopResult = struct
|
|
|
|
|
|
type normal_binop = {
|
|
type normal_binop = {
|
|
@@ -547,7 +553,12 @@ let type_binop2 ctx op (e1 : texpr) (e2 : Ast.expr) is_assign_op with_type p =
|
|
|
|
|
|
let type_assign ctx e1 e2 with_type p =
|
|
let type_assign ctx e1 e2 with_type p =
|
|
let e1 = !type_access_ref ctx (fst e1) (snd e1) (MSet (Some e2)) with_type in
|
|
let e1 = !type_access_ref ctx (fst e1) (snd e1) (MSet (Some e2)) with_type in
|
|
- let type_rhs with_type = type_expr ctx e2 with_type in
|
|
|
|
|
|
+ let type_rhs with_type = try
|
|
|
|
+ type_expr ctx e2 with_type
|
|
|
|
+ with Error(e,p,_) ->
|
|
|
|
+ check_error ctx e p;
|
|
|
|
+ Texpr.Builder.make_null t_dynamic (pos e2)
|
|
|
|
+ in
|
|
let assign_to e1 =
|
|
let assign_to e1 =
|
|
let e2 = type_rhs (WithType.with_type e1.etype) in
|
|
let e2 = type_rhs (WithType.with_type e1.etype) in
|
|
let e2 = AbstractCast.cast_or_unify ctx e1.etype e2 p in
|
|
let e2 = AbstractCast.cast_or_unify ctx e1.etype e2 p in
|