This PR fixes a bug where the monad lift coercion elaborator would partially unify expressions even if they were not monads. This could be taken advantage of to propagate information that could help elaboration make progress, for example the first `change` worked because the monad lift coercion elaborator was unifying `@Eq _ _` with `@Eq (Nat × Nat) p`: ```lean example (p : Nat × Nat) : p = p := by change _ = ⟨_, _⟩ -- used to work (yielding `p = (p.fst, p.snd)`), now it doesn't change ⟨_, _⟩ = _ -- never worked ``` As such, this is a breaking change; you may need to adjust expressions to include additional implicit arguments.
64 lines
949 B
Text
64 lines
949 B
Text
@[irreducible] def f (x : Nat) := x + 1
|
|
set_option allowUnsafeReducibility true
|
|
set_option pp.mvars false
|
|
/--
|
|
error: type mismatch
|
|
rfl
|
|
has type
|
|
?_ = ?_ : Prop
|
|
but is expected to have type
|
|
f x = x + 1 : Prop
|
|
-/
|
|
#guard_msgs in
|
|
example : f x = x + 1 :=
|
|
rfl
|
|
|
|
section
|
|
attribute [local reducible] f
|
|
example : f x = x + 1 :=
|
|
rfl
|
|
end
|
|
|
|
/--
|
|
error: type mismatch
|
|
rfl
|
|
has type
|
|
?_ = ?_ : Prop
|
|
but is expected to have type
|
|
f x = x + 1 : Prop
|
|
-/
|
|
#guard_msgs in
|
|
example : f x = x + 1 :=
|
|
rfl
|
|
|
|
namespace Boo
|
|
attribute [scoped semireducible] f
|
|
end Boo
|
|
|
|
/--
|
|
error: type mismatch
|
|
rfl
|
|
has type
|
|
?_ = ?_ : Prop
|
|
but is expected to have type
|
|
f x = x + 1 : Prop
|
|
-/
|
|
#guard_msgs in
|
|
example : f x = x + 1 :=
|
|
rfl
|
|
|
|
open Boo in -- `f` should be `semireducible
|
|
example : f x = x + 1 :=
|
|
rfl
|
|
|
|
/--
|
|
error: type mismatch
|
|
rfl
|
|
has type
|
|
?_ = ?_ : Prop
|
|
but is expected to have type
|
|
f x = x + 1 : Prop
|
|
-/
|
|
#guard_msgs in
|
|
example : f x = x + 1 :=
|
|
rfl
|