8000 Delay package object decls entering to the package object phase by dwijnand · Pull Request #9661 · scala/scala · GitHub
[go: up one dir, main page]

Skip to content

Delay package object decls entering to the package object phase #9661

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

Conversation

dwijnand
Copy link
Member
@dwijnand dwijnand commented Jun 7, 2021

Existing code in the compiler avoids loading package.class when a source file contains a new definition for the package object. The source definition would be used instead in the packageObjects phase.

This PR takes it a step further and defers forcing the info of all package.class until the packageObjects phase. This avoids spurious symbol not found errors when in a particular incremental compilation scenarion, when: a) super-class of the package object (defined within the same package) is provided as a source file and B) the package object is not supplied as a source file.

This change is intended to obviate the workaround in Zinc that supplies package.scala to the compiler more often than should be strictly necessary.

As a bonus, this addresses an issue with compiler determinism:

Fixes scala/bug#12092

Relates to #3389

Fixes scala/bug#5954 (properly this time, workaround removed and tests still pass)
Fixes scala/bug#4695

@scala-jenkins scala-jenkins added this to the 2.13.7 milestone Jun 7, 2021
@dwijnand dwijnand requested a review from retronym June 7, 2021 16:14
@dwijnand dwijnand marked this pull request as draft June 7, 2021 16:30
@retronym
Copy link
Member

Another sketch, as discussed: #9664

@dwijnand dwijnand force-pushed the package-object-with-source-parent-cleaned-up branch from a60c638 to 17b085a Compare June 10, 2021 14:29
@dwijnand dwijnand changed the title Delay package object type completion & exclude entering stale classes Delay package object decls entering to the package object phase Jun 10, 2021
@dwijnand dwijnand added the internal not resulting in user-visible changes (build changes, tests, internal cleanups) label Jun 10, 2021
@dwijnand dwijnand force-pushed the package-object-with-source-parent-cleaned-up branch from 17b085a to a5d03cd Compare June 10, 2021 15:25
@dwijnand dwijnand marked this pull request as ready for review June 10, 2021 15:25
@dwijnand dwijnand requested a review from retronym June 30, 2021 09:06
@dwijnand dwijnand force-pushed the package-object-with-source-parent-cleaned-up branch from 8a15b1c to 45e4837 Compare July 8, 2021 07:51
@dwijnand dwijnand enabled auto-merge July 8, 2021 07:51
@dwijnand dwijnand force-pushed the package-object-with-source-parent-cleaned-up branch from 45e4837 to 8a15b1c Compare July 9, 2021 09:04
@dwijnand dwijnand merged commit 1bc158b into scala:2.13.x Jul 9, 2021
@dwijnand dwijnand deleted the package-object-with-source-parent-cleaned-up branch July 9, 2021 09:04
@som-snytt
Copy link
Contributor

Possibly this broke -Yimports:scala.util.chaining where chaining is an object in a package object. Maybe there is API to force loading the package object, and maybe someone is awake on the other side of the earth to tell me what that is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal not resulting in user-visible changes (build changes, tests, internal cleanups)
Projects
None yet
4 participants
0