-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Support tuple specialisation #15060
Support tuple specialisation #15060
Conversation
Despite trying not to to start with, I ended up needing to allow for the parsing of specialised tuple (and product) classes, so that I could reach for the class and their constructor. Without that it ends up in a weird state where it gets removed as soon as you touch it ("implode-on-touch") due to, I expect, the deletion and markAbsent that using But now I realised I need to replace |
Could this be disabled when the |
Yep: |
10f2f48
to
b1bd1df
Compare
Requires pushing Show[Showable] down a notch
Of both construction (both `new` and `apply`) and of selection (`_1$mcI$sp`).
b1bd1df
to
e6042a5
Compare
package scala does not have a member class Tuple2$mcCI$sp while compiling /__w/dotty/dotty/community-build/community-projects/stdLib213/src/library/scala/AnyValCompanion.scala, ... [error] dotty.tools.dotc.core.TypeError: package scala does not have a member class Tuple2$mcCI$sp [error] at dotty.tools.dotc.core.Denotations$Denotation.requiredSymbol(Denotations.scala:305) [error] at dotty.tools.dotc.core.Denotations$Denotation.requiredClass(Denotations.scala:340) [error] at dotty.tools.dotc.core.Definitions.SpecialisedTuple(Definitions.scala:1335) [error] at dotty.tools.dotc.transform.SpecializeTuples.transformApply(SpecializeTuples.scala:27)
I was able to drop the hackaround I had in the classfile parser, so now it's just an exception in TreeChecker (-Ycheck). Compiling the standard library didn't work, for reasons that weren't clear, but it seemed niche so I just found a simple way to deal with it. |
@sjrd any chance you could help me land this? I worked on it because it was desired for 3.2, and I believe we want to cut the RC1 for that next Tuesday (and Martin is traveling atm). |
What is it blocked on? / How would you like me to help? |
It needs a review to be merged. |
... not the new name from the import.
Handle the contrived example constructing a non-elideable construction of a tuple. Requires exposing isElideableExpr, tweaking its "isCaseClassApply" (to disallow block select qualifiers - while still allowing bare ident applies), also fixing the StableRealizable flag on tuple constructors so that isPureApply is true for those, so they can elideable too.
... and leave a comment now that I understand it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Sorry for the delay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to get this in!
Curious where/how it was decided to stop at arity 2? (I wouldn't necessarily expect it to go up real high, like 22, but I guess I'd expect it to support the sizes that I have used in practice, which is up to about, idk, 5? At least 3, anyway?) |
It was decided in the standard library. Tuple1 has 3 specialised classes: Double, Int and Long. Tuple2 has 25! (Int, Long, Double, Char, Boolean) x (Int, Long, Double, Char, Boolean)... |
You're talking about the maximum number of specialised classes right @dwijnand? |
No description provided.