- Notifications
You must be signed in to change notification settings - Fork3.1k
For migration to 3, accommodate case companion as function#10648
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
joroKr21 commentedJan 2, 2024
Oh wait, why add a feature that is deprecated right away? 🤔 |
som-snytt commentedJan 2, 2024
Not sure about knobs for enablement yet, but Scala 3 warns about apply insertion. It's strictly a migration mitigation. |
som-snytt commentedJan 2, 2024
blocked by#10573 |
lrytz left a comment
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 👍 thanks!
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
joroKr21 commentedJan 3, 2024
|
som-snytt commentedJan 3, 2024
@joroKr21 iirc the tupled case is not handled because scala 2 doesn't do parameter untupling adaptation. I'll try to nail it down while polishing. The other missing parts are compose & andThen, so the adaptation here is incomplete in that sense. So really, we're just trying to make it easier for those slick users. I used slick once, do I have to try it again to test out the use case? 😿 |
som-snytt commentedJan 4, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@lrytz about to contribute a bit of doc for the incompatibility matrix as you pointed out. I haven't tried it, but maybe it makes sense to support It was interesting that the recommended idiom is what is implemented here. |
lrytz commentedJan 4, 2024
Since this doesn't currently work on Scala 2, and only works in Scala 3 with a warning and is therefore discouraged, I don't think this is needed. |
som-snytt commentedJan 4, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
My case for
Also, as@joroKr21 pointed out, this is true of everything in this PR. It has limited shelf life, as was true for the Scala 3 feature when it was introduced recently. |
lrytz commentedJan 5, 2024
OK, good point |
som-snytt commentedJan 6, 2024
Not sure I'll get around to tupled. |
This comment was marked as resolved.
This comment was marked as resolved.
d1986de to0996ac6Compare
lrytz left a comment
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 once the details are worked out
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
e897b8a to751a250Compare This comment was marked as resolved.
This comment was marked as resolved.
lrytz left a comment
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.
This LGTM, let me know if you want to add anything or we can merge.
Uh oh!
There was an error while loading.Please reload this page.
som-snytt commentedFeb 1, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@lrytz added a commit for "insert apply with tupling adaptation". It's a bit tricky (subtle), so it is unsquashed. I re-enabled the lrytz maneuver for your convenience. (Feel free to push here again.) Perhaps there is better API usage for the simple questions in Slightly augmented tests. My takeaway vis-a-vis TDD is that for a code change of a certain complexity, discipline is required to add tests for intersecting cases. I don't evince that discipline here. A nice IDE tool would be a test generator that probes feature interactions, scalacheck + fuzzing + chatgpt. It's nice to have the community build, but we could use the corpus to generate targeted tests (because we know how people use case classes and tupled, for instance). Oh, I just thought of another test. Edit: I checked that |
Uh oh!
There was an error while loading.Please reload this page.
393e77e tod8958d0Comparesom-snytt commentedFeb 2, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Rebased and added support for The first typecheck of Note: using wildcard first emits spurious warning about "empty application" of Also added test for overloaded apply. Instead of erroring nicely, it just works because expected type is used first. |
d8958d0 tof57bef9Compare This comment was marked as resolved.
This comment was marked as resolved.
som-snytt commentedFeb 3, 2024
/rebuild |
SethTisue commentedFeb 3, 2024
wasn't sure if |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
SethTisue commentedFeb 10, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@som-snytt can you do a round of making the PR description user-facing? I think it would be valuable to include an example, and to explicitly say what the behavior is on |
som-snytt commentedOct 19, 2024
The pun was 💅 . |
lrytz commentedOct 21, 2024
9 months and noone noticed... |
Uh oh!
There was an error while loading.Please reload this page.
Scala 2 sometimes makes the companion object of a case class extend
Function; Scala 3 does not, but includes other adaptations which are backported under-Xsource:3-crossand allow the following idioms with reduced ceremony:Under
-Xsource:3, using the case class companion as a function will warn.Backports Dotty migration support of case class companions by inserting
apply. Dotty does not automatically addFunctionas a parent of the companion; for Scala 2 under-Xsource:3-cross, follow Dotty but also adapt where the companion is not already aFunction.Since Scala 2 lacks parameter untupling, also support explicit
C.tupledand for completenessC.curried.Fixesscala/bug#3664