@@ -2136,10 +2136,11 @@ type type_jkind_sub_result =
2136
2136
| Missing_cmi of Jkind .t * Path .t
2137
2137
| Failure of Jkind .t
2138
2138
2139
- let type_jkind_sub env ty ~ check_sub =
2139
+ let type_jkind_sub env ty jkind =
2140
2140
let shallow_check ty =
2141
2141
match estimate_type_jkind env ty with
2142
- | Jkind ty_jkind -> if check_sub ty_jkind then Success else Failure ty_jkind
2142
+ | Jkind ty_jkind ->
2143
+ if Jkind. sub ty_jkind jkind then Success else Failure ty_jkind
2143
2144
| TyVar (ty_jkind , ty ) -> Type_var (ty_jkind, ty)
2144
2145
in
2145
2146
(* The "fuel" argument here is used because we're duplicating the loop of
@@ -2165,7 +2166,7 @@ let type_jkind_sub env ty ~check_sub =
2165
2166
try (Env. find_type p env).type_jkind
2166
2167
with Not_found -> Jkind. any ~why: (Missing_cmi p)
2167
2168
in
2168
- if check_sub jkind_bound
2169
+ if Jkind. sub jkind_bound jkind
2169
2170
then Success
2170
2171
else if fuel < 0 then Failure jkind_bound
2171
2172
else begin match unbox_once env ty with
@@ -2188,8 +2189,7 @@ let type_jkind_sub env ty ~check_sub =
2188
2189
correct on [any].)
2189
2190
*)
2190
2191
let constrain_type_jkind ~fixed env ty jkind =
2191
- match type_jkind_sub env ty
2192
- ~check_sub: (fun ty_jkind -> Jkind. sub ty_jkind jkind) with
2192
+ match type_jkind_sub env ty jkind with
2193
2193
| Success -> Ok ()
2194
2194
| Type_var (ty_jkind , ty ) ->
2195
2195
if fixed then Jkind. sub_or_error ty_jkind jkind else
@@ -2221,14 +2221,12 @@ let () =
2221
2221
Env. constrain_type_jkind := constrain_type_jkind
2222
2222
2223
2223
let check_type_externality env ty ext =
2224
- let check_sub ty_jkind =
2225
- Jkind. ( Externality. le (get_externality_upper_bound ty_jkind ) ext)
2224
+ let upper_bound =
2225
+ Jkind. set_externality_upper_bound ( Jkind. any ~why: Dummy_jkind ) ext
2226
2226
in
2227
- match type_jkind_sub env ty ~check_sub with
2228
- | Success -> true
2229
- | Type_var (ty_jkind , _ ) -> check_sub ty_jkind
2230
- | Missing_cmi _ -> false (* safe answer *)
2231
- | Failure _ -> false
2227
+ match check_type_jkind env ty upper_bound with
2228
+ | Ok () -> true
2229
+ | Error _ -> false
2232
2230
2233
2231
let check_decl_jkind env decl jkind =
2234
2232
match Jkind. sub_or_error decl.type_jkind jkind with
0 commit comments