Skip to content

Commit fb6b679

Browse files
committed
Fix incorrect access flag for PrivateWithin
For `protected[within]`, the symbol has `protected` flag, but `private[within]` doesn't have flag related to access information.
1 parent 338e6d2 commit fb6b679

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@ class ExtractSemanticDB extends Phase:
464464
else PublicAccess()
465465
else
466466
val ssym = symbolName(sym.privateWithin)
467-
if (sym.isPrivate) PrivateWithinAccess(ssym)
468-
else ProtectedWithinAccess(ssym)
467+
if (sym.is(Protected)) ProtectedWithinAccess(ssym)
468+
else PrivateWithinAccess(ssym)
469469

470470
private def symbolInfo(sym: Symbol, symbolName: String, symkinds: Set[SymbolKind])(using Context): SymbolInformation =
471471
val kind = symbolKind(sym, symkinds)

tests/semanticdb/metac.expect

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ example/Access# => class Access
1414
example/Access#`<init>`(). => primary ctor <init>
1515
example/Access#m1(). => private[this] method m1
1616
example/Access#m2(). => private[this] method m2
17-
example/Access#m3(). => protected[example/Access#] method m3
17+
example/Access#m3(). => private[example/Access#] method m3
1818
example/Access#m4(). => protected method m4
1919
example/Access#m5(). => protected[this] method m5
2020
example/Access#m6(). => protected[example/] method m6
@@ -3812,7 +3812,7 @@ flags/p/package.`y_=`(). => protected var method y_=
38123812
flags/p/package.`y_=`().(x$1) => param x$1
38133813
flags/p/package.m(). => macro m
38143814
flags/p/package.m().[TT] => typeparam TT
3815-
flags/p/package.x. => protected[flags/p/] lazy val method x
3815+
flags/p/package.x. => private[flags/p/] lazy val method x
38163816
flags/p/package.xs1. => val method xs1
38173817
flags/p/package.y(). => protected implicit var method y
38183818
flags/p/package.z(). => method z

0 commit comments

Comments
 (0)