Skip to content

Commit 4b39c6f

Browse files
som-snyttWojciechMazur
authored andcommitted
Use final result type to check selector bound
[Cherry-picked 21dad77]
1 parent 1b9b913 commit 4b39c6f

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)