@@ -1402,13 +1402,6 @@ type _ t_ =
1402
1402
(* -- Core flow constructors -- *)
1403
1403
| From_witness_locl : witness_locl -> locl_phase t_
1404
1404
(* * Lift a typing-time witness into a reason *)
1405
- | Upper_bound : {
1406
- bound : locl_phase t_ ;
1407
- of_ : locl_phase t_ ;
1408
- }
1409
- -> locl_phase t_
1410
- (* * Records that a type with reason [bound] acted as an upper bound
1411
- for the type with reason [of_] *)
1412
1405
| Lower_bound : {
1413
1406
bound : locl_phase t_ ;
1414
1407
of_ : locl_phase t_ ;
@@ -1527,7 +1520,6 @@ let rec to_raw_pos : type ph. ph t_ -> Pos_or_decl.t =
1527
1520
(* Recurse into flow-like reasons to find the position of the leftmost witness *)
1528
1521
| Flow { from = t; _ }
1529
1522
| Lower_bound { bound = t; _ }
1530
- | Upper_bound { bound = t; _ }
1531
1523
| Axiom { next = t; _ }
1532
1524
| Prj_both { sub_prj = t; _ }
1533
1525
| Prj_one { part = t; _ }
@@ -1609,12 +1601,6 @@ let rec map_pos :
1609
1601
bound = map_pos pos pos_or_decl bound;
1610
1602
of_ = map_pos pos pos_or_decl of_;
1611
1603
}
1612
- | Upper_bound { bound; of_ } ->
1613
- Upper_bound
1614
- {
1615
- bound = map_pos pos pos_or_decl bound;
1616
- of_ = map_pos pos pos_or_decl of_;
1617
- }
1618
1604
| Axiom { prev; axiom; next } ->
1619
1605
Axiom
1620
1606
{
@@ -1660,7 +1646,6 @@ let to_constructor_string : type ph. ph t_ -> string = function
1660
1646
| From_witness_locl witness -> constructor_string_of_witness_locl witness
1661
1647
| From_witness_decl witness -> constructor_string_of_witness_decl witness
1662
1648
| Axiom _ -> " Raxiom"
1663
- | Upper_bound _ -> " Rupper_bound"
1664
1649
| Lower_bound _ -> " Rlower_bound"
1665
1650
| Flow _ -> " Rflow"
1666
1651
| Prj_both _ -> " Rprj_both"
@@ -1795,7 +1780,6 @@ let rec pp_t_ : type ph. _ -> ph t_ -> unit =
1795
1780
| Dynamic_coercion r -> pp_t_ fmt r
1796
1781
| Flow { from; _ } -> pp_t_ fmt from
1797
1782
| Axiom { next; _ } -> pp_t_ fmt next
1798
- | Upper_bound { bound; _ } -> pp_t_ fmt bound
1799
1783
| Lower_bound { bound; _ } -> pp_t_ fmt bound
1800
1784
| Prj_both { sub_prj; _ } -> pp_t_ fmt sub_prj
1801
1785
| Prj_one { part; _ } -> pp_t_ fmt part
@@ -1992,14 +1976,6 @@ let rec to_json_help : type a. a t_ -> Hh_json.json list -> Hh_json.json list =
1992
1976
] );
1993
1977
])
1994
1978
:: acc
1995
- | Upper_bound { bound; of_ } ->
1996
- Hh_json. (
1997
- JSON_Object
1998
- [
1999
- ( " Upper_bound" ,
2000
- JSON_Object [(" bound" , to_json bound); (" of" , to_json of_)] );
2001
- ])
2002
- :: acc
2003
1979
| Lower_bound { bound; of_ } ->
2004
1980
Hh_json. (
2005
1981
JSON_Object
@@ -2097,7 +2073,6 @@ let rec to_string_help :
2097
2073
to_string_help prefix solutions r
2098
2074
| From_witness_locl witness -> [witness_locl_to_string prefix witness]
2099
2075
| From_witness_decl witness -> [witness_decl_to_string prefix witness]
2100
- | Upper_bound { bound = r; _ }
2101
2076
| Lower_bound { bound = r; _ }
2102
2077
| Axiom { next = r; _ }
2103
2078
| Def (_, r)
@@ -2552,8 +2527,6 @@ module Constructors = struct
2552
2527
let axiom_lower_bound ~bound ~of_ =
2553
2528
Axiom { axiom = Lower_bound ; prev = of_; next = bound }
2554
2529
2555
- let trans_upper_bound ~bound ~of_ = Upper_bound { bound; of_ }
2556
-
2557
2530
let trans_lower_bound ~bound ~of_ = Lower_bound { bound; of_ }
2558
2531
2559
2532
let definition def of_ = Def (def, of_)
@@ -2707,8 +2680,6 @@ module Visitor = struct
2707
2680
| Axiom { prev; axiom; next } ->
2708
2681
Axiom
2709
2682
{ prev = this#on_reason prev; axiom; next = this#on_reason next }
2710
- | Upper_bound { bound; of_ } ->
2711
- Upper_bound { bound = this#on_reason bound; of_ = this#on_reason of_ }
2712
2683
| Lower_bound { bound; of_ } ->
2713
2684
Lower_bound { bound = this#on_reason bound; of_ = this#on_reason of_ }
2714
2685
| Solved { solution; of_; in_ } ->
@@ -3237,10 +3208,6 @@ module Derivation = struct
3237
3208
bound : t ;
3238
3209
in_ : t ;
3239
3210
}
3240
- | Upper of {
3241
- bound : t ;
3242
- in_ : t ;
3243
- }
3244
3211
| Transitive of {
3245
3212
lower : t ;
3246
3213
upper : t ;
@@ -3252,19 +3219,13 @@ module Derivation = struct
3252
3219
3253
3220
let transitive ~upper ~lower ~on_ ~in_ = Transitive { in_; on_; upper; lower }
3254
3221
3255
- let upper_bound ~bound ~in_ = Upper { bound; in_ }
3256
-
3257
3222
let lower_bound ~bound ~in_ = Lower { bound; in_ }
3258
3223
3259
3224
let to_json t =
3260
3225
let rec aux = function
3261
3226
| Derivation steps ->
3262
3227
Hh_json. (
3263
3228
JSON_Object [(" Derivation" , array_ Subtype_step. to_json steps)])
3264
- | Upper { bound; in_ } ->
3265
- Hh_json. (
3266
- JSON_Object
3267
- [(" Upper" , JSON_Object [(" bound" , aux bound); (" in_" , aux in_)])])
3268
3229
| Lower { bound; in_ } ->
3269
3230
Hh_json. (
3270
3231
JSON_Object
@@ -3325,7 +3286,6 @@ module Derivation = struct
3325
3286
| Axiom { prev; _ } -> extract_last prev
3326
3287
| Flow { into; _ } -> extract_last into
3327
3288
| Lower_bound { of_; _ } -> extract_last of_
3328
- | Upper_bound { of_; _ } -> extract_last of_
3329
3289
| Solved _
3330
3290
| No_reason
3331
3291
| From_witness_decl _
@@ -3358,7 +3318,6 @@ module Derivation = struct
3358
3318
| Axiom { next; _ } -> extract_first next
3359
3319
| Flow { from; _ } -> extract_first from
3360
3320
| Lower_bound { bound; _ } -> extract_first bound
3361
- | Upper_bound { bound; _ } -> extract_first bound
3362
3321
| Solved _
3363
3322
| No_reason
3364
3323
| From_witness_decl _
@@ -3405,8 +3364,12 @@ module Derivation = struct
3405
3364
let solutions = Tvid.Map. add of_ (extract_first solution) solutions in
3406
3365
aux (sub, in_) ~deriv ~solutions
3407
3366
(* -- Transitive constraints -- *)
3408
- | ( Lower_bound { bound = lb_sub; of_ = lb_super },
3409
- Upper_bound { bound = ub_super; of_ = ub_sub } ) ->
3367
+ | ( Lower_bound
3368
+ {
3369
+ bound = Lower_bound { bound = lb_sub; of_ = lb_super };
3370
+ of_ = ub_sub;
3371
+ },
3372
+ ub_super ) ->
3410
3373
let lower = aux (lb_sub, lb_super) ~deriv: [] ~solutions
3411
3374
and upper = aux (ub_sub, ub_super) ~deriv: [] ~solutions
3412
3375
and in_ = aux (lb_sub, ub_super) ~deriv ~solutions
@@ -3420,14 +3383,6 @@ module Derivation = struct
3420
3383
let bound = aux (bound, of_) ~deriv: [] ~solutions
3421
3384
and in_ = aux (sub, bound) ~deriv ~solutions in
3422
3385
lower_bound ~bound ~in_
3423
- | (sub , Upper_bound { bound; of_ } ) ->
3424
- let bound = aux (of_, bound) ~deriv: [] ~solutions
3425
- and in_ = aux (sub, bound) ~deriv ~solutions in
3426
- upper_bound ~bound ~in_
3427
- | (Upper_bound { bound; of_ } , super ) ->
3428
- let bound = aux (of_, bound) ~deriv: [] ~solutions
3429
- and in_ = aux (bound, super) ~deriv ~solutions in
3430
- upper_bound ~bound ~in_
3431
3386
(* -- One-sided projection on subtype -- *)
3432
3387
| (Prj_one { part; whole; prj } , _ ) ->
3433
3388
let step =
@@ -3785,36 +3740,6 @@ module Derivation = struct
3785
3740
@ with_prefix expl_lower ~prefix: prefix_lower ~sep: " \n\n "
3786
3741
in
3787
3742
(expl, st)
3788
- | Upper { bound; in_ } ->
3789
- let (expl_main, st) =
3790
- explain in_ ~st ~cfg ~ctxt: (Context. enter_main ctxt)
3791
- in
3792
- let ctxt = Context. deepen ctxt in
3793
- let (expl_upper, st) =
3794
- explain bound ~st ~cfg ~ctxt: (Context. enter_upper ctxt)
3795
- in
3796
-
3797
- let main_path =
3798
- Context. (Option. value_exn @@ explain_path @@ enter_main ctxt)
3799
- in
3800
- let prefix_main =
3801
- Format. sprintf
3802
- " I checked the subtype constraint in [%s] because it was implied by transitivity."
3803
- main_path
3804
- and prefix_upper =
3805
- let upper_path =
3806
- Context. (Option. value_exn @@ explain_path @@ enter_upper ctxt)
3807
- in
3808
- Format. sprintf
3809
- " I found the supertype for [%s] is when I checked the subtype constraint in [%s]."
3810
- main_path
3811
- upper_path
3812
- in
3813
- let expl =
3814
- with_prefix expl_main ~prefix: prefix_main ~sep: " \n\n "
3815
- @ with_prefix expl_upper ~prefix: prefix_upper ~sep: " \n\n "
3816
- in
3817
- (expl, st)
3818
3743
3819
3744
and explain_steps steps ~st ~cfg ~ctxt =
3820
3745
let steps =
@@ -3971,9 +3896,7 @@ module Derivation = struct
3971
3896
since we can have `Prj_one` in both subtype and supertype or
3972
3897
`Prj_both` as subtype and `Prj_one` in supertype and we will always
3973
3898
follow `Prj_one` before moving into `Prj_both` *)
3974
- | Lower_bound { of_; _ }
3975
- | Upper_bound { of_; _ } ->
3976
- explain_reason of_ ~st ~cfg ~ctxt
3899
+ | Lower_bound { of_; _ } -> explain_reason of_ ~st ~cfg ~ctxt
3977
3900
| Prj_both { sub_prj; _ } -> explain_reason sub_prj ~st ~cfg ~ctxt
3978
3901
| Prj_one { part; _ } -> explain_reason part ~st ~cfg ~ctxt
3979
3902
| Axiom { next; _ } -> explain_reason next ~st ~cfg ~ctxt
0 commit comments