@@ -2423,10 +2423,14 @@ and type_expect_ ?type_clash_context ?in_function ?(recarg = Rejected) env sexp
24232423 begin_def () ;
24242424 let total_app = not partial in
24252425 let type_clash_context = type_clash_context_from_function sexp sfunct in
2426+ let _ = translate_unified_ops in
24262427 let args, ty_res, fully_applied =
2427- match translate_unified_ops env funct sargs with
2428- | Some (targs , result_type ) -> (targs, result_type, true )
2429- | None -> type_application ?type_clash_context total_app env funct sargs
2428+ if false then
2429+ type_application ?type_clash_context total_app env funct sargs
2430+ else
2431+ match translate_unified_ops env funct sargs with
2432+ | Some (targs , result_type ) -> (targs, result_type, true )
2433+ | None -> type_application ?type_clash_context total_app env funct sargs
24302434 in
24312435 end_def () ;
24322436 unify_var env (newvar () ) funct.exp_type;
@@ -3379,22 +3383,22 @@ and translate_unified_ops (env : Env.t) (funct : Typedtree.expression)
33793383 let result_type =
33803384 match (lhs_type.desc, specialization) with
33813385 | Tconstr (path , _ , _ ), _ when Path. same path Predef. path_int ->
3382- Predef. type_int
3386+ instance_def Predef. type_int
33833387 | Tconstr (path, _, _), {bool = Some _}
33843388 when Path. same path Predef. path_bool ->
3385- Predef. type_bool
3389+ instance_def Predef. type_bool
33863390 | Tconstr (path, _, _), {float = Some _}
33873391 when Path. same path Predef. path_float ->
3388- Predef. type_float
3392+ instance_def Predef. type_float
33893393 | Tconstr (path, _, _), {bigint = Some _}
33903394 when Path. same path Predef. path_bigint ->
3391- Predef. type_bigint
3395+ instance_def Predef. type_bigint
33923396 | Tconstr (path, _, _), {string = Some _}
33933397 when Path. same path Predef. path_string ->
3394- Predef. type_string
3398+ instance_def Predef. type_string
33953399 | _ ->
3396- unify env lhs_type Predef. type_int;
3397- Predef. type_int
3400+ unify env lhs_type (instance_def Predef. type_int) ;
3401+ instance_def Predef. type_int
33983402 in
33993403 let targs = [(to_noloc lhs_label, Some lhs)] in
34003404 Some (targs, result_type)
@@ -3409,50 +3413,50 @@ and translate_unified_ops (env : Env.t) (funct : Typedtree.expression)
34093413 match (lhs_type.desc, specialization) with
34103414 | Tconstr (path , _ , _ ), _ when Path. same path Predef. path_int ->
34113415 let rhs = type_expect env rhs_expr Predef. type_int in
3412- (lhs, rhs, Predef. type_int)
3416+ (lhs, rhs, instance_def Predef. type_int)
34133417 | Tconstr (path, _, _), {bool = Some _}
34143418 when Path. same path Predef. path_bool ->
34153419 let rhs = type_expect env rhs_expr Predef. type_bool in
3416- (lhs, rhs, Predef. type_bool)
3420+ (lhs, rhs, instance_def Predef. type_bool)
34173421 | Tconstr (path, _, _), {float = Some _}
34183422 when Path. same path Predef. path_float ->
34193423 let rhs = type_expect env rhs_expr Predef. type_float in
3420- (lhs, rhs, Predef. type_float)
3424+ (lhs, rhs, instance_def Predef. type_float)
34213425 | Tconstr (path, _, _), {bigint = Some _}
34223426 when Path. same path Predef. path_bigint ->
34233427 let rhs = type_expect env rhs_expr Predef. type_bigint in
3424- (lhs, rhs, Predef. type_bigint)
3428+ (lhs, rhs, instance_def Predef. type_bigint)
34253429 | Tconstr (path, _, _), {string = Some _}
34263430 when Path. same path Predef. path_string ->
34273431 let rhs = type_expect env rhs_expr Predef. type_string in
3428- (lhs, rhs, Predef. type_string)
3432+ (lhs, rhs, instance_def Predef. type_string)
34293433 | _ -> (
34303434 (* Rule 2. Try unifying to rhs *)
34313435 match (rhs_type.desc, specialization) with
34323436 | Tconstr (path , _ , _ ), _ when Path. same path Predef. path_int ->
34333437 let lhs = type_expect env lhs_expr Predef. type_int in
3434- (lhs, rhs, Predef. type_int)
3438+ (lhs, rhs, instance_def Predef. type_int)
34353439 | Tconstr (path, _, _), {bool = Some _}
34363440 when Path. same path Predef. path_bool ->
34373441 let lhs = type_expect env lhs_expr Predef. type_bool in
3438- (lhs, rhs, Predef. type_bool)
3442+ (lhs, rhs, instance_def Predef. type_bool)
34393443 | Tconstr (path, _, _), {float = Some _}
34403444 when Path. same path Predef. path_float ->
34413445 let lhs = type_expect env lhs_expr Predef. type_float in
3442- (lhs, rhs, Predef. type_float)
3446+ (lhs, rhs, instance_def Predef. type_float)
34433447 | Tconstr (path, _, _), {bigint = Some _}
34443448 when Path. same path Predef. path_bigint ->
34453449 let lhs = type_expect env lhs_expr Predef. type_bigint in
3446- (lhs, rhs, Predef. type_bigint)
3450+ (lhs, rhs, instance_def Predef. type_bigint)
34473451 | Tconstr (path, _, _), {string = Some _}
34483452 when Path. same path Predef. path_string ->
34493453 let lhs = type_expect env lhs_expr Predef. type_string in
3450- (lhs, rhs, Predef. type_string)
3454+ (lhs, rhs, instance_def Predef. type_string)
34513455 | _ ->
34523456 (* Rule 3. Fallback to int *)
34533457 let lhs = type_expect env lhs_expr Predef. type_int in
34543458 let rhs = type_expect env rhs_expr Predef. type_int in
3455- (lhs, rhs, Predef. type_int))
3459+ (lhs, rhs, instance_def Predef. type_int))
34563460 in
34573461 let targs =
34583462 [(to_noloc lhs_label, Some lhs); (to_noloc rhs_label, Some rhs)]
0 commit comments