chore: show @[expose] attribute in #print (#9722)

This commit is contained in:
Sebastian Ullrich 2025-08-05 17:59:49 +02:00 committed by GitHub
parent ed860dfa23
commit d07ec9a19f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 2 deletions

View file

@ -34,6 +34,10 @@ private def mkHeader (kind : String) (id : Name) (levelParams : List Name) (type
| ReducibilityStatus.reducible => attrs := attrs.push m!"reducible"
| ReducibilityStatus.semireducible => pure ()
let env ← getEnv
if env.header.isModule && (env.setExporting true |>.find? id |>.any (·.isDefinition)) then
attrs := attrs.push m!"expose"
if defeqAttr.hasTag (← getEnv) id then
attrs := attrs.push m!"defeq"

View file

@ -152,7 +152,7 @@ public structure Public where
deriving Repr
/--
info: def instReprPublic : Repr Public :=
info: @[expose] def instReprPublic : Repr Public :=
{ reprPrec := reprPublic✝ }
-/
#guard_msgs in

View file

@ -6,9 +6,34 @@ public axiom testSorry : α
/-- A definition (not exposed). -/
public def f := 1
/-- An definition (exposed) -/
/--
info: def f : Nat :=
1
-/
#guard_msgs in
#print f
/-- A definition (exposed) -/
@[expose] public def fexp := 1
/--
info: @[expose] def fexp : Nat :=
1
-/
#guard_msgs in
#print fexp
/-- An abbrev (auto-exposed). -/
public abbrev fabbrev := 1
/--
info: @[reducible, expose] def fabbrev : Nat :=
1
-/
#guard_msgs in
#print fabbrev
#guard_msgs(drop warning) in
/-- A theorem. -/
public theorem t : f = 1 := testSorry