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 Jun 29, 2024
1 parent 10efba5 commit 634fdb0
Show file tree
Hide file tree
Showing 2 changed files with 5 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)
&& selData.qualTpe =:= prefix
else
// Normal wildcard, check that the symbol is not a given (but can be implicit)
Expand Down
4 changes: 4 additions & 0 deletions tests/warn/i19657.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ def `i19657 check prefix to pick specific selector`: Unit =
import FooCodec.given_Schema_A
import BarCodec.given_Schema_A
summonSchemas

def `i20860 use result to check selector bound`: Unit =
import Ordering.Implicits.given Ordering[?]
summon[Ordering[Seq[Int]]]

0 comments on commit 634fdb0

Please sign in to comment.