Put implicit support for evidence from predef types#3508
Merged
Conversation
travisbrown
previously approved these changes
Jul 5, 2020
| * value. | ||
| */ | ||
| @inline final def toPredef: A <:< B = | ||
| substitute[<:<[*, B]](implicitly[B <:< B]) |
Contributor
There was a problem hiding this comment.
I think this needs the same treatment as above? Something like:
type F[-Z] = Z <:< B
substitute[F](implicitly[B <:< B])
Contributor
Author
There was a problem hiding this comment.
yes, you are right! I got impatient because on my slow machine the tests took too long. I've fixed the tests on 2.12 and 2.13 so I think it will be green now.
Thank you for the review and thanks for considering it for 2.2.0.
Codecov Report
@@ Coverage Diff @@
## master #3508 +/- ##
==========================================
- Coverage 91.75% 91.74% -0.02%
==========================================
Files 383 383
Lines 8406 8418 +12
Branches 232 220 -12
==========================================
+ Hits 7713 7723 +10
- Misses 693 695 +2 |
barambani
approved these changes
Jul 5, 2020
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close #2569
There is no reason not to create Is and As instances from the predef ones. The changes in 2.13 make this perfectly safe, but nothing in 2.12 (or before) made it unsafe, the types just lacked a substitute method.
This PR improves matters a bit.
I did notice that
Isis not sealed, butAsis. In general these two types have a pretty different API considering how similar they are conceptually.I only did a bit, I added
toPredefto both of them to convert back to predef types.