| 1 |
(* Non regression for bug #1302 *) |
| 2 |
|
| 3 |
(* With universe polymorphism for inductive types, subtyping of |
| 4 |
inductive types needs a special treatment: the standard conversion |
| 5 |
algorithm does not work as it only knows to deal with constraints of |
| 6 |
the form alpha = beta or max(alphas, alphas+1) <= beta, while |
| 7 |
subtyping of inductive types in Type generates constraints of the form |
| 8 |
max(alphas, alphas+1) <= max(betas, betas+1). |
| 9 |
|
| 10 |
These constraints are anyway valid by monotonicity of subtyping but we |
| 11 |
have to detect it early enough to avoid breaking the standard |
| 12 |
algorithm for constraints on algebraic universes. *) |
| 13 |
|
| 14 |
Module Type T. |
| 15 |
|
| 16 |
Parameter A : Type (* Top.1 *) . |
| 17 |
|
| 18 |
Inductive L : Type (* max(Top.1,1) *) := |
| 19 |
| L0 |
| 20 |
| L1 : (A -> Prop) -> L. |
| 21 |
|
| 22 |
End T. |
| 23 |
|
| 24 |
Axiom Tp : Type (* Top.5 *) . |
| 25 |
|
| 26 |
Module TT : T. |
| 27 |
|
| 28 |
Definition A : Type (* Top.6 *) := Tp. (* generates Top.5 <= Top.6 *) |
| 29 |
|
| 30 |
Inductive L : Type (* max(Top.6,1) *) := |
| 31 |
| L0 |
| 32 |
| L1 : (A -> Prop) -> L. |
| 33 |
|
| 34 |
End TT. (* Generates Top.6 <= Top.1 (+ auxiliary constraints for L_rect) *) |
| 35 |
|
| 36 |
(* Note: Top.6 <= Top.1 is generated by subtyping on A; |
| 37 |
subtyping of L follows and has not to be checked *) |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
(* The same bug as #1302 but for Definition *) |
| 42 |
(* Check that inferred algebraic universes in interfaces are considered *) |
| 43 |
|
| 44 |
Module Type U. Definition A := Type -> Type. End U. |
| 45 |
Module M:U. Definition A := Type -> Type. End M. |
| 46 |
|