forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make toplevel protected qualified protected
For private toplevel definitions we expand `private` to `private[p]` where `p` is the enclosing package. This PR applies the same scheme to protected toplevel definitions. Rationale: scala#18057 fixed an issue where toplevel protected members were always accessible because explicit package object prefixes were added after the accessibility check was done, and would re-establish the previous members without doing an accessibility check. The fix was done by adding package objects first, then doing he rest of the checks. But that also means that protected toplevel objects now get checked as members of their synthetic package object instead of as members of their package. To avoid that we make the package explicit as qalifier. Thsi shouls also make specs2 compile again.
- Loading branch information
Showing
5 changed files
with
28 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// definition.scala | ||
package oolong.bson: | ||
|
||
trait BsonValue | ||
protected def merge( | ||
base: BsonValue, | ||
patch: BsonValue, | ||
arraySubvalues: Boolean = false | ||
): BsonValue = ??? | ||
|
||
private def foo: Int = 1 | ||
|
||
package inner: | ||
protected[bson] def bar = 2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// usage.scala | ||
package oolong.bson | ||
|
||
extension (bv: BsonValue) | ||
def :+(other: BsonValue): BsonValue = merge(other, bv, false) | ||
|
||
val x = foo | ||
val y = inner.bar |