Skip to content

Commit

Permalink
Update src/Lean/PrettyPrinter/Delaborator/Basic.lean
Browse files Browse the repository at this point in the history
Co-authored-by: Kyle Miller <kmill31415@gmail.com>
  • Loading branch information
eric-wieser and kmill authored Dec 28, 2024
1 parent 6071281 commit f5cd80a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Lean/PrettyPrinter/Delaborator/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,15 @@ unsafe def mkDelabAttribute : IO (KeyedDeclsAttribute Delab) :=
} `Lean.PrettyPrinter.Delaborator.delabAttribute
@[builtin_init mkDelabAttribute] opaque delabAttribute : KeyedDeclsAttribute Delab

/-- `@[app_delab c]` registers a declaration of type `Lean.PrettyPrinter.Delaborator.Delab` for applications
of the constant `c` (including "nullary applications").
/--
`@[app_delab c]` registers a delaborator for applications with head constant `c`.
Such delaborators also apply to the constant `c` itself (known as a "nullary application").
This attribute should be applied to definitions of type `Lean.PrettyPrinter.Delaborator.Delab`.
It should be preferred over the otherwise-equivalent `@[delab app.c]`, as it first performs name-resolution
on `c`. -/
When defining delaborators for constant applications, one should prefer this attribute over `@[delab app.c]`,
as `@[app_delab c]` first performs name resolution on `c` in the current scope.
-/
macro "app_delab" id:ident : attr => do
match ← Macro.resolveGlobalName id.getId with
| [] => Macro.throwErrorAt id s!"unknown declaration '{id.getId}'"
Expand Down

0 comments on commit f5cd80a

Please sign in to comment.