Skip to content

Commit

Permalink
Use final result type to check selector bound
Browse files Browse the repository at this point in the history
  • Loading branch information
som-snytt committed Jul 3, 2024
1 parent 1efbb92 commit 21dad77
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 21dad77

Please sign in to comment.