Skip to content

Commit

Permalink
chore: add comment for why anonymous constructor notation isn't flatt…
Browse files Browse the repository at this point in the history
…ened during pretty printing (#4764)
  • Loading branch information
kmill authored Jul 16, 2024
1 parent 1cf47bc commit 94cc8eb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Lean/PrettyPrinter/Delaborator/Builtins.lean
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ def unexpandStructureInstance (stx : Syntax) : Delab := whenPPOption getPPStruct
let mut fields := #[]
guard $ fieldNames.size == stx[1].getNumArgs
if hasPPUsingAnonymousConstructorAttribute env s.induct then
/- Note that we don't flatten anonymous constructor notation. Only a complete such notation receives TermInfo,
and flattening would cause the flattened-in notation to lose its TermInfo.
Potentially it would be justified to flatten anonymous constructor notation when the terms are
from the same type family (think `Sigma`), but for now users can write a custom delaborator in such instances. -/
return ← withTypeAscription (cond := (← withType <| getPPOption getPPStructureInstanceType)) do
`(⟨$[$(stx[1].getArgs)],*⟩)
let args := e.getAppArgs
Expand Down

0 comments on commit 94cc8eb

Please sign in to comment.