Re-encode relationships to avoid implicit conversion functions #3323
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.
This change only affects test code that I added recently, so it should be fairly uncontroversial.
In #3307 I introduced some abstraction for
NonEmptyX
testing, since there were a lot of inconsistencies and gaps not just in the interfaces themselves, but also in their tests.In that change I encoded the relationship between the non-empty type and the type that has its operations as a couple of implicit parameters:
I couldn't use
<:<
because forNonEmpty
types that use the newtype encoding,NE
isn't actually a subtype ofNEC
(e.g.NonEmptyChain
andNonEmptyChainOps
).The issue is that this encoding in the tests doesn't work on Dotty, and in any case is a little inelegant—if for example we want to work with additional
NE[x]
values in the future, we'd need newevX
parameters here.I've changed
NonEmptyCollectionSuite
to use a new abstract method instead:This fixes the tests on Dotty and provides a bit of extra future-proofing even on Scala 2.