-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12747 from dotty-staging/fix-10900
Fix #10900: Avoid loop for F-bounds in checkCanEqual
- Loading branch information
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import scala.collection.IterableOps | ||
def foo[CC[A] <: IterableOps[A, CC, CC[A]], A](collection: CC[A]) = | ||
collection == collection | ||
|
||
object Test1 { | ||
import scala.collection.IterableOps | ||
implicit class RichCollection[CC[A] <: IterableOps[A, CC, CC[A]], A](val collection: CC[A]) { | ||
def awm(update: CC[A] => CC[A]): CC[A] = { | ||
val newCollection = update(collection) | ||
if (newCollection == collection) collection else newCollection.awm(update) | ||
} | ||
} | ||
} | ||
|
||
object Test2 { | ||
import scala.collection.IterableOps | ||
implicit class RichCollection[CC[A] <: IterableOps[A, CC, CC[A]], A](val collection: CC[A]) { | ||
def awm(update: CC[A] => CC[A]): CC[A] = update(collection) match { | ||
case `collection` => collection | ||
case updated => updated.awm(update) | ||
} | ||
} | ||
} |