Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #6484: Properly unpickle some Scala 2 type lambdas #6494

Merged
merged 1 commit into from
May 11, 2019

Conversation

smarter
Copy link
Member

@smarter smarter commented May 10, 2019

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 (because Reader is defined in cats as
type Reader[A, B] = Kleisli[Id, A, B], and Id is defined as
type Id[A] = A), somehow the owner of the symbol for A is the
object 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.

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` (because `Reader` is defined in cats as
`type Reader[A, B] = Kleisli[Id, A, B]`, and `Id` is defined as
`type Id[A] = A`), somehow the owner of the symbol for `A` is the
object `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.
@smarter smarter merged commit 3aa217f into scala:master May 11, 2019
@allanrenucci allanrenucci deleted the fix-eff branch May 11, 2019 12:24
@anatoliykmetyuk anatoliykmetyuk added this to the 0.15 Tech Preview milestone May 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants