File tree 4 files changed +31
-9
lines changed
compiler/src/dotty/tools/dotc/core
4 files changed +31
-9
lines changed Original file line number Diff line number Diff line change @@ -93,11 +93,7 @@ class CommunityBuildTestC:
93
93
@ Test def sconfig = projects.sconfig.run()
94
94
@ Test def shapeless = projects.shapeless.run()
95
95
@ Test def sourcecode = projects.sourcecode.run()
96
-
97
- // Disabled. Currently fails in FutureMatchers.scala. The call to
98
- // `checkResultFailure` goes to a protected method which is not accessible.
99
- // I tried to fix it, but get test failures.
100
- // @Test def specs2 = projects.specs2.run()
96
+ @ Test def specs2 = projects.specs2.run()
101
97
102
98
@ Test def stdLib213 = projects.stdLib213.run()
103
99
@ Test def ujson = projects.ujson.run()
Original file line number Diff line number Diff line change @@ -907,10 +907,13 @@ object SymDenotations {
907
907
false
908
908
val cls = owner.enclosingSubClass
909
909
if ! cls.exists then
910
- val encl = if ctx.owner.isConstructor then ctx.owner.enclosingClass.owner.enclosingClass else ctx.owner.enclosingClass
911
- fail(i """
912
- | Access to protected $this not permitted because enclosing ${encl.showLocated}
913
- | is not a subclass of ${owner.showLocated} where target is defined """ )
910
+ if pre.termSymbol.isPackageObject && accessWithin(pre.termSymbol.owner) then
911
+ true
912
+ else
913
+ val encl = if ctx.owner.isConstructor then ctx.owner.enclosingClass.owner.enclosingClass else ctx.owner.enclosingClass
914
+ fail(i """
915
+ | Access to protected $this not permitted because enclosing ${encl.showLocated}
916
+ | is not a subclass of ${owner.showLocated} where target is defined """ )
914
917
else if isType || pre.derivesFrom(cls) || isConstructor || owner.is(ModuleClass ) then
915
918
// allow accesses to types from arbitrary subclasses fixes #4737
916
919
// don't perform this check for static members
Original file line number Diff line number Diff line change
1
+ // definition.scala
2
+ package oolong .bson:
3
+
4
+ trait BsonValue
5
+ protected def merge (
6
+ base : BsonValue ,
7
+ patch : BsonValue ,
8
+ arraySubvalues : Boolean = false
9
+ ): BsonValue = ???
10
+
11
+ private def foo : Int = 1
12
+
13
+ package inner:
14
+ protected [bson] def bar = 2
15
+
Original file line number Diff line number Diff line change
1
+ // usage.scala
2
+ package oolong .bson
3
+
4
+ extension (bv : BsonValue )
5
+ def :+ (other : BsonValue ): BsonValue = merge(other, bv, false )
6
+
7
+ val x = foo
8
+ val y = inner.bar
You can’t perform that action at this time.
0 commit comments