Skip to content

Commit 32e416e

Browse files
authored
Revise isLocalToCompilationUnit (scala#24856)
Previously, public constructors or members of private classes were not considered local to a compilation unit. Now they are.
2 parents 72f0dc1 + 5cc4bff commit 32e416e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,12 +1247,12 @@ object SymDenotations {
12471247
|| isClass
12481248
&& (!isOneOf(EffectivelyOpenFlags) || isLocalToCompilationUnit)
12491249

1250-
final def isLocalToCompilationUnitIgnoringPrivate(using Context): Boolean =
1251-
owner.ownersIterator.takeWhile(!_.isStaticOwner).exists(_.isTerm)
1252-
|| accessBoundary(defn.RootClass).isProperlyContainedIn(symbol.topLevelClass)
1253-
1250+
/** Is symbol visible only in the current compilation unit? */
12541251
final def isLocalToCompilationUnit(using Context): Boolean =
1255-
is(Private) || isLocalToCompilationUnitIgnoringPrivate
1252+
is(Private)
1253+
|| owner.isTerm
1254+
|| privateWithin.exists && !privateWithin.is(Package)
1255+
|| !owner.is(Package) && owner.isLocalToCompilationUnit
12561256

12571257
final def isTransparentClass(using Context): Boolean =
12581258
is(TransparentType) || defn.isAssumedTransparent(symbol)

tests/generic-java-signatures/outer-ref-elimination.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +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(T10))
10+
List(public T10$C10())
1111
List(public T11$D11$C11())

0 commit comments

Comments
 (0)