Skip to content

Commit 162a3f0

Browse files
committed
Rename on import is never wildcard
1 parent bef520f commit 162a3f0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/src/dotty/tools/dotc/transform/CheckUnused.scala

+4-1
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,11 @@ class CheckUnused private (phaseMode: PhaseMode, suffix: String) extends MiniPha
284284
case sel :: sels =>
285285
val matches =
286286
if sel.isWildcard then
287+
// if name is different from sym.name, it must be a rename on import, not a wildcard selector
288+
!name.exists(_.toTermName != sym.name.toTermName)
287289
// the qualifier must have the target symbol as a member
288-
hasAltMember(sym.name) && {
290+
&& hasAltMember(sym.name)
291+
&& {
289292
if sel.isGiven then // Further check that the symbol is a given or implicit and conforms to the bound
290293
sym.isOneOf(GivenOrImplicit)
291294
&& (sel.bound.isEmpty || sym.info.finalResultType <:< sel.boundTpe)

0 commit comments

Comments
 (0)