Skip to content

Commit

Permalink
feat: expand invalid projection type inference error (#5556)
Browse files Browse the repository at this point in the history
hopefully this will make debugging meta code a bit easier
  • Loading branch information
nomeata authored Oct 1, 2024
1 parent 3e2bca7 commit d0ee9d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Lean/Meta/InferType.lean
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ private def inferConstType (c : Name) (us : List Level) : MetaM Expr := do
throwIncorrectNumberOfLevels c us

private def inferProjType (structName : Name) (idx : Nat) (e : Expr) : MetaM Expr := do
let failed {α} : Unit → MetaM α := fun _ =>
throwError "invalid projection{indentExpr (mkProj structName idx e)}"
let structType ← inferType e
let structType ← whnf structType
let failed {α} : Unit → MetaM α := fun _ =>
throwError "invalid projection{indentExpr (mkProj structName idx e)} from type {structType}"
matchConstStruct structType.getAppFn failed fun structVal structLvls ctorVal =>
let n := structVal.numParams
let structParams := structType.getAppArgs
Expand Down

0 comments on commit d0ee9d0

Please sign in to comment.