Skip to content

Commit

Permalink
feat: expose diff at "synthesized type class instance is not definiti…
Browse files Browse the repository at this point in the history
…onally equal" error

This PR exposes the difference in "synthesized type class instance is not definitionally equal" errors.
  • Loading branch information
kmill committed Nov 25, 2024
1 parent ba3f2b3 commit ac6079b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Lean/Elab/Term.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,9 @@ def synthesizeInstMVarCore (instMVar : MVarId) (maxResultSize? : Option Nat := n
let oldValType ← inferType oldVal
let valType ← inferType val
unless (← isDefEq oldValType valType) do
let (oldValType, valType) ← addPPExplicitToExposeDiff oldValType valType
throwError "synthesized type class instance type is not definitionally equal to expected type, synthesized{indentExpr val}\nhas type{indentExpr valType}\nexpected{indentExpr oldValType}{extraErrorMsg}"
let (oldVal, val) ← addPPExplicitToExposeDiff oldVal val
throwError "synthesized type class instance is not definitionally equal to expression inferred by typing rules, synthesized{indentExpr val}\ninferred{indentExpr oldVal}{extraErrorMsg}"
else
unless (← isDefEq (mkMVar instMVar) val) do
Expand Down

0 comments on commit ac6079b

Please sign in to comment.