Skip to content

Commit 634fdb0

Browse files
committed
Use final result type to check selector bound
1 parent 10efba5 commit 634fdb0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Diff for: compiler/src/dotty/tools/dotc/transform/CheckUnused.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ object CheckUnused:
729729
if selector.isGiven then
730730
// Further check that the symbol is a given or implicit and conforms to the bound
731731
sym.isOneOf(Given | Implicit)
732-
&& (selector.bound.isEmpty || sym.info <:< selector.boundTpe)
732+
&& (selector.bound.isEmpty || sym.info.finalResultType <:< selector.boundTpe)
733733
&& selData.qualTpe =:= prefix
734734
else
735735
// Normal wildcard, check that the symbol is not a given (but can be implicit)

Diff for: tests/warn/i19657.scala

+4
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ def `i19657 check prefix to pick specific selector`: Unit =
3030
import FooCodec.given_Schema_A
3131
import BarCodec.given_Schema_A
3232
summonSchemas
33+
34+
def `i20860 use result to check selector bound`: Unit =
35+
import Ordering.Implicits.given Ordering[?]
36+
summon[Ordering[Seq[Int]]]

0 commit comments

Comments
 (0)