-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@publicInBinary
override spec change
#19296
@publicInBinary
override spec change
#19296
Conversation
34f3dee
to
5e80305
Compare
@@ -544,6 +544,12 @@ object Checking { | |||
else if !sym.owner.isClass && !(sym.is(Param) && sym.owner.isConstructor) then fail(em"@publicInBinary cannot be used on local definitions") | |||
else if sym.is(ParamAccessor) && sym.is(Private) then fail(em"@publicInBinary cannot be non `val` constructor parameters") | |||
else if sym.is(Private) && !sym.privateWithin.exists && !sym.isConstructor then fail(em"@publicInBinary cannot be used on private definitions\n\nConsider using `private[${sym.owner.name}]` or `protected` instead") | |||
else | |||
sym.allOverriddenSymbols.find(sym => sym.hasAnnotation(defn.PublicInBinaryAnnot)) match |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned by @smarter somewhere else, there's a good chance that this code would behave much better in RefChecks
. One of the main purposes of RefChecks
is to check properties across the inheritance chain of methods, so it would make sense there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the change. I will test the community build with the CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It worked
5e80305
to
dcf42cf
Compare
else if !member.hasAnnotation(defn.PublicInBinaryAnnot) && other.hasAnnotation(defn.PublicInBinaryAnnot) then | ||
overrideError("also needs to be declared with @publicInBinary") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This must come before the overrideDeprecation
test, otherwise a deprecation warning can shadow an actual error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved and updated docs.
dcf42cf
to
7205496
Compare
Followup of #18402 (see #18402 (comment)).
This was split from the main PR due to the blocker described in #18402 (comment). During the Dotty meeting, we decided to merge #18402 without the second commit (Require @publicInBinary on overrides). If we manage to fix this issue before 3.4.0-RC1 we will include it there, otherwise it will be part of 3.4.0-RC2.