Navigation Menu

Skip to content

Commit

Permalink
Fixes #12418 (inference of return clause meets assert false).
Browse files Browse the repository at this point in the history
This is a quick fix to avoid the anomaly, with a fallback on before
b1b8243.
  • Loading branch information
herbelin committed May 29, 2020
1 parent d75b889 commit 22d0e5c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pretyping/cases.ml
Expand Up @@ -1716,7 +1716,7 @@ let abstract_tycon ?loc env sigma subst tycon extenv t =
let flags = (default_flags_of TransparentState.full) in
match solve_simple_eqn evar_unify flags !!env sigma (None,ev,substl inst ev') with
| Success evd -> evdref := evd
| UnifFailure _ -> assert false
| UnifFailure _ -> evdref := add_conv_pb (Reduction.CONV,!!env,substl inst ev',t) sigma
end;
ev'
| _ ->
Expand Down
29 changes: 29 additions & 0 deletions test-suite/bugs/closed/bug_12418.v
@@ -0,0 +1,29 @@
(* The second "match" below used to raise an anomaly *)

Class Monad@{d c} (m : Type@{d} -> Type@{c}) : Type :=
{ ret : forall {t : Type@{d}}, t -> m t }.

Record state {S : Type} (t : Type) : Type := mkState { runState : t }.

Global Declare Instance Monad_state : forall S, Monad (@state S).

Class Cava := {
constant : bool -> unit;
constant_vec : unit;
}.

Axiom F : forall {A : Type}, (bool -> A) -> Datatypes.unit.

Fail Instance T : Cava := {

constant b := match b with
| true => ret tt
| false => ret tt
end;

constant_vec := @F _ (fun b => match b with
| true => tt
| false => tt
end);

}.

0 comments on commit 22d0e5c

Please sign in to comment.