-
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
Make def generated from givens not synthetic #12979
Conversation
The problem is how to know whether some method is a structural given instance or The old scheme is still recognized in order to maintain Tasty backwards compatibility. A better fix would be to give the synthetic class of a structural given instance a special semantic name. given foo: C with ... is visible under the name |
So this means this PR will be merged only from 3.1? |
@soronpo Yes, but I think we'll move to 3.1 soon anyway. |
Then I better get to finding more compatibility braking bugs soon 😉 |
@soronpo Not sure exactly what the warning should do and who would design and implement it. |
Currently (until 3.1)
I don't mind helping out, but unfortunately currently my table is full. I'm trying my best minimizing and documenting the issues I find as I'm migrating my library to Scala 3. |
That's a bit extremist. What does not work is wildcard exports for them. They are nevertheless widely used, so introducing a blanket warning would be extremely annoying. If someone can find a targeted warning that is clearly not annoying then I am happy to see a PR. But personally i think it will be very difficult to achieve and not worth the effort. |
@@ -809,7 +809,10 @@ object desugar { | |||
Nil | |||
} | |||
} | |||
val classMods = if mods.is(Given) then mods &~ Given | Synthetic else mods | |||
val classMods = | |||
if mods.is(Given) then mods &~ Given | Synthetic | GivenClass |
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.
Instead of dropping Given
and adding a new GivenClass
, what prevents us from keeping Given
?
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.
I think this can be done without the need for new flags and TASTy changes, unless there is a good reason for the new flag
I think this should not be merged without a minor TASTy bump, it breaks the assumption that a type can not have Given or Implicit flag. Unless we say that implementations should expect any possible flag |
I think flags are sufficiently underspecified that we don't need to worry about this. The TreeUnpickler works unchanged for old as well as new version. That should be our test for version bumps. If an old TreeUnpickler works with the new format, we are good. |
That's good enough for the compiler but not necessarily for macro authors, who might have to adjust their macros if the semantics of tasty change, but anyway it seems that we'll bump to 3.1.0-RC1 (and therefore bump tasty) before the release. |
At present the Scala 2 TASTy reader scans flags not compatible with Scala 2 to see if it needs to special case certain definitions, (such as TLDR: this will break Scala 2 TASTy reader for previously accepted code |
OK, we have this under next minor release anyway. |
this needs a rebase |
@bishabosha Can you check that the semanticdb expect files are now correct? Thanks! |
don't add definition occurences for given instance parameters
@odersky please may you check the addition I made, (I added a test for a symbol being a structural given instance method) otherwise I think the semanticdb changes are good |
We will not explore the alternative proposed in this review
@odersky I have updated so that in semanticdb the type parameter in the structural given is recorded as belonging to the summoner method |
So to summarise the point about the semanticdb changes: |
@dos65 are you able to finish reviewing this today? |
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.
Now, It looks good from my side.
I haven't dived in code details, only checked how it affects semanticdb output.
Fixes #12949