Skip to content

Changes to StagedTuple #5409

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

Closed
odersky opened this issue Nov 8, 2018 · 3 comments
Closed

Changes to StagedTuple #5409

odersky opened this issue Nov 8, 2018 · 3 comments
Assignees

Comments

@odersky
Copy link
Contributor

odersky commented Nov 8, 2018

I noted the following problems when trying to make StageTuple optional:

  • there seems to be a build problem. If Tuple.stageIt is turned on, we fail with the following two error messages in dotty-bootstrapped/compile:
[error] -- Error: /Users/odersky/workspace/dotty/library/src-scala3/scala/Tuple.scala:315:17 
[error] 315 |    if (stageIt) stagedHead
[error]     |                 ^^^^^^^^^^
[error]     |Could not find class scala.StagedTuple$ in classpath. The most common reason for that is that you apply macros in the compilation run that defines them
[error]     | This location is in code that was inlined at /Users/odersky/workspace/dotty/library/src-scala3/scala/Tuple.scala:479
[error] -- Error: /Users/odersky/workspace/dotty/library/src-scala3/scala/Tuple.scala:346:17 
[error] 346 |    if (stageIt) stagedTail
[error]     |                 ^^^^^^^^^^
[error]     |Could not find class scala.StagedTuple$ in classpath. The most common reason for that is that you apply macros in the compilation run that defines them
[error]     | This location is in code that was inlined at /Users/odersky/workspace/dotty/library/src-scala3/scala/Tuple.scala:479

I am curious why the other 6 occurrences of splices do not give errors?

Other issues with StagedTuple.

  • It's for internal use only, so should definitely not be in scala package.
  • Inconsistent naming: stagedCons vs headStaged.
@nicolasstucki
Copy link
Contributor

This is the source of the issue is https://github.com/lampepfl/dotty/pull/5392/files#diff-901fed2e7fd7e86c4b92a9f7198b0cc7R797.
At https://github.com/lampepfl/dotty/pull/5392/files#diff-dae2a6166db3f0fad29edec3ff83f555R479 we have a top level splice that gets inlined when trying to compute the rhs of the inlined method.

StagedTuple tuples should be defined in a separate project and the lib should depend on it.

@nicolasstucki
Copy link
Contributor

nicolasstucki commented Nov 21, 2018

It works if we use the previous version of the code

inline def unapply[H, T <: Tuple](x: H *: T) =
    (NonEmptyTuple.dynamicHead(x), NonEmptyTuple.dynamicTail(x))

Which is also what gets inlined in the non-staged version and would be by the staged.

@nicolasstucki
Copy link
Contributor

Fixed in #5822 and then StagedTuple were removed from the library in #6311

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

No branches or pull requests

3 participants