Skip to content

Commit 9befc30

Browse files
committed
Revise isLocalToCompilationUnit
Previously, public constructors or members of private classes were not considered local. Now they are.
1 parent f1d6aac commit 9befc30

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
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)

0 commit comments

Comments
 (0)