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.
25 lines
666 B
Text
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
|