lean4-htt/tests/lean/run/privateInPublic.lean
Sebastian Ullrich 663df8f7e8
feat: backward.privateInPublic option (#10807)
This PR introduces the `backward.privateInPublic` option to aid in
porting projects to the module system by temporarily allowing access to
private declarations from the public scope, even across modules. A
warning will be generated by such accesses unless
`backward.privateInPublic.warn` is disabled.
2025-10-16 20:51:45 +00:00

25 lines
666 B
Text

module
set_option backward.privateInPublic true
private def fpriv := 1
/--
warning: Private declaration `fpriv` accessed publicly; this is allowed only because the `backward.privateInPublic` option is enabled. ⏎
Disable `backward.privateInPublic.warn` to silence this warning.
-/
#guard_msgs in
@[expose] public def fpub := fpriv
public structure S
private def S.fpriv (s : S) := s
/--
warning: Private declaration `S.fpriv` accessed publicly; this is allowed only because the `backward.privateInPublic` option is enabled. ⏎
Disable `backward.privateInPublic.warn` to silence this warning.
-/
#guard_msgs in
@[expose] public def fpub2 (s : S) := s.fpriv