Skip to content

Commit

Permalink
Use final result type to check selector bound (#20989)
Browse files Browse the repository at this point in the history
Fixes #20860
  • Loading branch information
sjrd authored Jul 3, 2024
2 parents cd8c5ed + 21dad77 commit fa58f93
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/transform/CheckUnused.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
else
// Normal wildcard, check that the symbol is not a given (but can be implicit)
!sym.is(Given)
Expand Down
3 changes: 3 additions & 0 deletions tests/pos/i20860.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def `i20860 use result to check selector bound`: Unit =
import Ordering.Implicits.given Ordering[?]
summon[Ordering[Seq[Int]]]

0 comments on commit fa58f93

Please sign in to comment.