Commit c70f6e5
committed
Fix #6484: Properly unpickle some Scala 2 type lambdas
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.1 parent cdd844f commit c70f6e5
File tree
5 files changed
+24
-1
lines changed- compiler/src/dotty/tools/dotc/core/unpickleScala2
- sbt-dotty/sbt-test/scala2-compat/eff
- project
5 files changed
+24
-1
lines changedLines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
50 | 54 | | |
51 | 55 | | |
52 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments