File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
compiler/src/dotty/tools/dotc/transform
tests/neg-custom-args/fatal-warnings Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -603,11 +603,13 @@ object CheckUnused:
603603 case (sel, sym) if dealias(sym) == dealiasedSym => sel
604604 }.headOption else None
605605 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
607607 selector.orElse(dealiasedSelector).orElse(wildcard) // selector with name or wildcard (or given)
608608 else
609609 None
610610
611+ private def isRenamedSymbol (symNameInScope : Option [Name ])(using Context ) =
612+ sym.name != nme.NO_NAME && symNameInScope.exists(_.toSimpleName != sym.name.toSimpleName)
611613
612614 private def dealias (symbol : Symbol )(using Context ): Symbol =
613615 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:
287287 package c:
288288 import b .Xd
289289 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