Added `withRef` when processing the LHS or RHS. Without this, in an expression such as `true = ()` the entire expression would be highlighted with "type mismatch, `()` has type `Unit` but is expected to have type `Bool`". Now the error is localized to `()`. This behavior was pointed out [on Zulip](https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/error.20location.20bug/near/422665805).
20 lines
499 B
Text
20 lines
499 B
Text
/-!
|
|
# Testing that type mismatch errors for binary operations are localized to the LHS or RHS
|
|
|
|
Before #3442, the error was placed on the entire expression than just the RHS.
|
|
-/
|
|
|
|
/-!
|
|
When there's no max type, the ensureHasType failure is localized to the RHS.
|
|
-/
|
|
#check true = ()
|
|
|
|
/-!
|
|
When there's no max type, toBoolIfNecessary error is localized to LHS.
|
|
-/
|
|
#check ∀ (p : Prop), p == ()
|
|
|
|
/-!
|
|
When there's no max type, toBoolIfNecessary error is localized to RHS.
|
|
-/
|
|
#check ∀ (p : Prop), () == p
|