diff options
author | Maxime Dénès <mail@maximedenes.fr> | 2018-02-21 18:53:56 +0100 |
---|---|---|
committer | Maxime Dénès <mail@maximedenes.fr> | 2018-02-21 18:53:56 +0100 |
commit | 6ee9f47718fa9929de4d8e724d9df6d389ea9dc8 (patch) | |
tree | 99651982cd8f5c20ebc86a2124297af72884e97d /checker/univ.ml | |
parent | aec63ba9c8f6840d98ba731640a786138d836343 (diff) | |
parent | d50cee3fa401246061c106248b749be03e108298 (diff) |
Merge PR #6740: Adding a sanity check on inductive variance subtyping.
Diffstat (limited to 'checker/univ.ml')
-rw-r--r-- | checker/univ.ml | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/checker/univ.ml b/checker/univ.ml index 46b3ce680..ebc37bc10 100644 --- a/checker/univ.ml +++ b/checker/univ.ml @@ -1011,6 +1011,13 @@ struct A'] as opposed to [A' <= A]. *) type t = Irrelevant | Covariant | Invariant + let check_subtype x y = match x, y with + | (Irrelevant | Covariant | Invariant), Irrelevant -> true + | Irrelevant, Covariant -> false + | (Covariant | Invariant), Covariant -> true + | (Irrelevant | Covariant), Invariant -> false + | Invariant, Invariant -> true + let leq_constraint csts variance u u' = match variance with | Irrelevant -> csts |