Skip to content

Commit fa58f93

Browse files
authored
Use final result type to check selector bound (#20989)
Fixes #20860
2 parents cd8c5ed + 21dad77 commit fa58f93

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

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
else
734734
// Normal wildcard, check that the symbol is not a given (but can be implicit)
735735
!sym.is(Given)

tests/pos/i20860.scala

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
def `i20860 use result to check selector bound`: Unit =
2+
import Ordering.Implicits.given Ordering[?]
3+
summon[Ordering[Seq[Int]]]

0 commit comments

Comments
 (0)