safe_&: handle higher-kinded arguments like regular & #9470
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.
Unfortunately, i9346.scala has to be put in pending because it
still crashes (due to a cycle involving a LazyRef) after this fix, and
because
safe_&
is only called fromrecoverable_&
when there is somesort of cycle in the first place, I haven't been able to make another
testcase that exercises this codepath.
It would be good if we could figure out how to get i9346.scala to
compile (see also #9346 for discussions). It is is a minimization of a pattern heavily used in
akka-stream, similar to the use of the
CC
type parameter in thescala-library collections but using a type member instead.
Unfortunately, it seems that Dotty is not really prepared to handle
F-bounds in type members currently. I was able to get the testcase as
well as akka-stream to compile by tweaking
findMember
to not computean intersection when the refinement is an alias:
This seems to work, but to be sound it means that we need to check for
invalid bounds in PostTyper (see tests/neg/i5556.scala for an example where
this matter), like we do for type parameters in
checkAppliedType
.