diff options
author | Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr> | 2018-02-12 14:46:05 +0100 |
---|---|---|
committer | Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr> | 2018-02-15 18:02:14 +0100 |
commit | d6ca9b2f71bced8711b184400fa7e80061497fd7 (patch) | |
tree | 7d7591a2a1a9cf6e9bb0202e95c68902dae934b2 /checker/univ.ml | |
parent | 8dd6d091ffbfa237f7266eeca60187263a9b521f (diff) |
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 |