File tree 2 files changed +17
-1
lines changed
compiler/src/dotty/tools/dotc/transform
tests/neg-custom-args/fatal-warnings
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -603,11 +603,13 @@ object CheckUnused:
603
603
case (sel, sym) if dealias(sym) == dealiasedSym => sel
604
604
}.headOption else None
605
605
def wildcard = sels.find(sel => sel.isWildcard && ((sym.is(Given ) == sel.isGiven) || sym.is(Implicit )))
606
- if qualHasSymbol && ! isAccessible && sym.exists then
606
+ if qualHasSymbol && ( ! isAccessible || sym.isRenamedSymbol(symName)) && sym.exists then
607
607
selector.orElse(dealiasedSelector).orElse(wildcard) // selector with name or wildcard (or given)
608
608
else
609
609
None
610
610
611
+ private def isRenamedSymbol (symNameInScope : Option [Name ])(using Context ) =
612
+ sym.name != nme.NO_NAME && symNameInScope.exists(_.toSimpleName != sym.name.toSimpleName)
611
613
612
614
private def dealias (symbol : Symbol )(using Context ): Symbol =
613
615
if (symbol.isType && symbol.asType.denot.isAliasType) then
Original file line number Diff line number Diff line change @@ -287,3 +287,17 @@ package foo.test.i17156:
287
287
package c:
288
288
import b .Xd
289
289
trait Z derives Xd
290
+
291
+ package foo .test .i17117:
292
+ package example {
293
+ object test1 {
294
+ val test = " test"
295
+ }
296
+
297
+ object test2 {
298
+
299
+ import example .test1 as t1
300
+
301
+ val test = t1.test
302
+ }
303
+ }
You can’t perform that action at this time.
0 commit comments