Fix #6484: Properly unpickle some Scala 2 type lambdas #6494
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.
Scala 2 pickles both type lambdas and polymorphic methods using the
POLYtpe tag. When we unpickle them, we distinguish them based on whether
the symbol for the owner of the type parameters is a term or a type, but
it seems that some type parameter symbols for type lambdas are pickled
with a term owner. In Eff for example, the pickled information for the
runReader
method in:https://github.com/atnos-org/eff/blob/85bd7b2dc1cd26c22e45d69910755f2a9ea4ece4/shared/src/main/scala/org/atnos/eff/syntax/reader.scala#L12
contains a POLYtpe
[A] => A
(becauseReader
is defined in cats astype Reader[A, B] = Kleisli[Id, A, B]
, andId
is defined astype Id[A] = A
), somehow the owner of the symbol forA
is theobject
reader
defined in the same file.That doesn't make any sense to me, but just checking if the owner is
actually a method should work just as well and fixes the problem. Given
that Scala 2 unpickling support is a temporary crutch I think that's
good enough.