Skip to content

Pickling error with match type as method argument type #5680

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

Open
milessabin opened this issue Jan 6, 2019 · 3 comments
Open

Pickling error with match type as method argument type #5680

milessabin opened this issue Jan 6, 2019 · 3 comments
Assignees

Comments

@milessabin
Copy link
Contributor

Compiling the following,

object Test {
  // The identity on Unit
  type Id[X] = X match {
    case _ => X
  }

  def foo[T](it: Id[T]) = ???
  foo(())
}

with -Xprint-types -Ytest-pickler -Yprint-pos -Yprint-pos-syms as in CompilationTests.pickling results in a round trip failure,

miles@tarski:dotty (master)% diff before-pickling.txt after-pickling.txt
33c33
<       <<Test.foo:([T](it: T): scala.Nothing)>@<118..121>[scala.Unit]:
---
>       <<Test.foo:([T](it: Test.Id[T]): scala.Nothing)>@<118..121>[scala.Unit]:
@odersky
Copy link
Contributor

odersky commented Jan 7, 2019

I believe that's an artifact how things are printed. If a match type has been reduced to some type T we print that type, otherwise we print the match type. Immediately after reading back the match type has not been reduced, hence the difference. To fix this, we'd have to change the printer to not print the reduced type when comparing pickled info.

@milessabin
Copy link
Contributor Author

Which direction should the change go? Print unreduced before? Or print reduced after?

@smarter
Copy link
Member

smarter commented Jan 7, 2019

print unreduced is useful by itself for debugging, so I would go in that direction

@milessabin milessabin self-assigned this Jan 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants