diff --git a/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala b/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala index 36958397f97f..cec009b12289 100644 --- a/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala +++ b/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala @@ -729,7 +729,7 @@ object CheckUnused: if selector.isGiven then // Further check that the symbol is a given or implicit and conforms to the bound sym.isOneOf(Given | Implicit) - && (selector.bound.isEmpty || sym.info <:< selector.boundTpe) + && (selector.bound.isEmpty || sym.info.finalResultType <:< selector.boundTpe) && selData.qualTpe =:= prefix else // Normal wildcard, check that the symbol is not a given (but can be implicit) diff --git a/tests/warn/i19657.scala b/tests/warn/i19657.scala index cb0e1d3c289d..efd20e36aefb 100644 --- a/tests/warn/i19657.scala +++ b/tests/warn/i19657.scala @@ -30,3 +30,7 @@ def `i19657 check prefix to pick specific selector`: Unit = import FooCodec.given_Schema_A import BarCodec.given_Schema_A summonSchemas + +def `i20860 use result to check selector bound`: Unit = + import Ordering.Implicits.given Ordering[?] + summon[Ordering[Seq[Int]]]