Skip to content

Fix trait setter validity #12144

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

Merged
merged 2 commits into from
Apr 20, 2021
Merged

Fix trait setter validity #12144

merged 2 commits into from
Apr 20, 2021

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Apr 19, 2021

Trait setters had a validity interval that started before they were created.
This caused stale symbol errors in macro compilations.

Fixes #12140

@odersky odersky requested a review from sjrd April 19, 2021 12:30
@@ -146,6 +147,7 @@ class Mixin extends MiniPhase with SymTransformer { thisPhase =>
// !decl.isClass avoids forcing nested traits, preventing cycles
if !decl.isClass && needsTraitSetter(decl) then
val setter = makeTraitSetter(decl.asTerm)
setter.validFor = Period(ctx.runId, thisPhase.next.id, decl.validFor.lastPhaseId)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@sjrd sjrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no objection, but I can't really say that I understand why this really does or why it solves the issue.

@odersky
Copy link
Contributor Author

odersky commented Apr 19, 2021

Now I get:

Unable to get Dotty latest nightly build version. Make sure you are connected to internet

in CommunityBuildC, when trying to compile shapeless. Any ideas what this could be?

@odersky
Copy link
Contributor Author

odersky commented Apr 19, 2021

Another PR of mine fails for the same reason, so it looks like a CI problem.

@smarter
Copy link
Member

smarter commented Apr 19, 2021

not sure, but I see shapeless has been updated upstream to remove the call to dottyLatestNightly, @milessabin could you open a PR to update shapeless in our community build?

@griggt
Copy link
Contributor

griggt commented Apr 19, 2021

Publishing 3.0.0-RC3 today made https://dotty.epfl.ch/versions/latest-nightly-base return 3.0.0-RC3 but there are no 3.0.0-RC3 nightlies.

I believe this will fix itself after the next successful nightly build, but dottyLatestNightlyBuild will (temporarily) break each time we publish from a branch without nightlies.

@griggt griggt mentioned this pull request Apr 19, 2021
30 tasks
@milessabin
Copy link
Contributor

@smarter here you go: #12152

odersky added 2 commits April 20, 2021 14:34
Trait setters had a validity interval that started before they were created.
This caused stale symbol errors in macro compilations.
@odersky odersky merged commit 056c897 into scala:master Apr 20, 2021
@odersky odersky deleted the fix-12140 branch April 20, 2021 18:55
@Kordyjan Kordyjan added this to the 3.0.1 milestone Aug 2, 2023
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

Successfully merging this pull request may close these issues.

stale symbol involving trait mixin when defining and using macro in same project
6 participants