Skip to content

Commit f4bde0b

Browse files
Backport "Use final result type to check selector bound" to 3.5.0 (#21010)
Backports #20989 to 3.5.0-RC3
2 parents 9ca1d0a + 3677eaf commit f4bde0b

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
@@ -728,7 +728,7 @@ object CheckUnused:
728728
if selector.isGiven then
729729
// Further check that the symbol is a given or implicit and conforms to the bound
730730
sym.isOneOf(Given | Implicit)
731-
&& (selector.bound.isEmpty || sym.info <:< selector.boundTpe)
731+
&& (selector.bound.isEmpty || sym.info.finalResultType <:< selector.boundTpe)
732732
else
733733
// Normal wildcard, check that the symbol is not a given (but can be implicit)
734734
!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)