Skip to content

Commit 3266eb7

Browse files
mbovelWojciechMazur
authored andcommitted
Symbol with top-level access boundary is not local to compilation unit
Co-Authored-By: Dale Wijnand <[email protected]> [Cherry-picked f8a5583]
1 parent a328130 commit 3266eb7

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

Diff for: compiler/src/dotty/tools/dotc/core/SymDenotations.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ object SymDenotations {
12031203
final def isLocalToCompilationUnit(using Context): Boolean =
12041204
is(Private)
12051205
|| owner.ownersIterator.takeWhile(!_.isStaticOwner).exists(_.isTerm)
1206-
|| accessBoundary(defn.RootClass).isContainedIn(symbol.topLevelClass)
1206+
|| accessBoundary(defn.RootClass).isProperlyContainedIn(symbol.topLevelClass)
12071207

12081208
final def isTransparentClass(using Context): Boolean =
12091209
is(TransparentType)

Diff for: tests/generic-java-signatures/outer-ref-elimination.check

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ List(public T6$$anon$3$C6())
77
List(public T7$C7$1())
88
List(public T8$$anon$4$C8())
99
List(public T9$C9$1(T9))
10-
List(public T10$C10())
10+
List(public T10$C10(T10))
11+
List(public T11$D11$C11())

Diff for: tests/generic-java-signatures/outer-ref-elimination.scala

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class T9 { var x = 451; def t9(): Unit = { class C9 {def getX = x}; test(classOf
2828

2929
class T10 { private[T10] class C10; test(classOf[C10]) }
3030

31+
class T11 { class D11 { private[D11] class C11; test(classOf[C11]) } }
32+
3133
object Test {
3234
def main(args: Array[String]): Unit = {
3335
T1
@@ -40,5 +42,6 @@ object Test {
4042
new T8().t8()
4143
new T9().t9()
4244
new T10()
45+
val t11 = new T11(); new t11.D11()
4346
}
4447
}

0 commit comments

Comments
 (0)