build_subtype: assert arrow type is known (#9348)
`build_subtype` is invoked only through `enlarge_type` when typechecking Pexp_coerce. The type passed to `build_subtype` can only have `Cok` arrows because: - the base type is the direct result of `Typetexp.transl_simple_type_delayed` which only introduces `Cok` arrows - the other source of arrows could be the result of unification; however at this point the type variables are fresh, they have not been unified with any existing types. Adding this assertion ensures that this property won't be broken by accident.master
parent
0c39193cc2
commit
bea2d04582
|
@ -4005,7 +4005,8 @@ let rec build_subtype env visited loops posi level t =
|
|||
(t, Unchanged)
|
||||
else
|
||||
(t, Unchanged)
|
||||
| Tarrow(l, t1, t2, _) ->
|
||||
| Tarrow(l, t1, t2, com) ->
|
||||
assert (com = Cok);
|
||||
if memq_warn t visited then (t, Unchanged) else
|
||||
let visited = t :: visited in
|
||||
let (t1', c1) = build_subtype env visited loops (not posi) level t1 in
|
||||
|
|
Loading…
Reference in New Issue