Skip to content

Commit

Permalink
Merge PR #17853: Fix #17852 (universe issue with reverse coercions)
Browse files Browse the repository at this point in the history
Reviewed-by: SkySkimmer
Co-authored-by: gares <gares@users.noreply.github.com>
  • Loading branch information
coqbot-app[bot] and gares committed Jul 15, 2023
2 parents 72e72dc + 03d078f commit 9066520
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pretyping/coercion.ml
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,12 @@ let add_reverse_coercion env sigma v'_ty v_ty v' v =
match Coqlib.lib_ref_opt "core.coercion.reverse_coercion" with
| None -> sigma, v'
| Some reverse_coercion ->
let sigma, v'_ty =
Evarsolve.refresh_universes ~onlyalg:true ~status:Evd.univ_flexible
(Some false) env sigma v'_ty in
let sigma, v_ty =
Evarsolve.refresh_universes ~onlyalg:true ~status:Evd.univ_flexible
(Some false) env sigma v_ty in
let sigma, reverse_coercion = Evd.fresh_global env sigma reverse_coercion in
Typing.checked_appvect env sigma reverse_coercion [| v'_ty; v_ty; v'; v |]

Expand Down
26 changes: 26 additions & 0 deletions test-suite/bugs/bug_17852.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Module Ex0.

Record S : Type := Pack { sort :> Type }.

Canonical SSet := Pack Set.

Check Set : S.
(* Error: Anomaly "Unable to handle arbitrary u+k <= v constraints." *)

End Ex0.

Module Ex1.

Record type : Type := Pack { sort :> nat -> Type }.

Definition set := fun _ : nat => Set.

Canonical inst := Pack set.

Set Printing All.
Set Printing Universes.

Check set : type.
(* Error: Anomaly "Unable to handle arbitrary u+k <= v constraints." *)

End Ex1.

0 comments on commit 9066520

Please sign in to comment.