diff --git a/src/Lean/Elab/StructInst.lean b/src/Lean/Elab/StructInst.lean index 4bd8b71d52..220d7b8e91 100644 --- a/src/Lean/Elab/StructInst.lean +++ b/src/Lean/Elab/StructInst.lean @@ -9,6 +9,7 @@ import Lean.Parser.Term import Lean.Meta.Structure import Lean.Elab.App import Lean.Elab.Binders +import Lean.PrettyPrinter namespace Lean.Elab.Term.StructInst @@ -433,7 +434,7 @@ private def expandParentFields (s : Struct) : TermElabM Struct := do | { lhs := .fieldName ref fieldName :: _, .. } => addCompletionInfo <| CompletionInfo.fieldId ref fieldName (← getLCtx) s.structName match findField? env s.structName fieldName with - | none => throwErrorAt ref "'{fieldName}' is not a field of structure '{s.structName}'" + | none => throwErrorAt ref "'{fieldName}' is not a field of structure '{MessageData.ofConstName s.structName}'" | some baseStructName => if baseStructName == s.structName then pure field else match getPathToBaseStructure? env baseStructName s.structName with