Thanks to visit codestin.com
Credit goes to github.com

Skip to content

PC invalidates previous work on new run #10867

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

Draft
wants to merge 1 commit into
base: 2.13.x
Choose a base branch
from

Conversation

som-snytt
Copy link
Contributor

The "up-to-date" check is not sufficient when fetching doc comments, since a unit may have been typechecked, with doc wrapper trees removed.

A test instability was due to whether the scheduler was checked by a callback or the runner thread.
One sample file had no parser callbacks at all.

Probably the change at demandNewCompilerRun can be refined, as it matters just for doc comments.

askParse is tweaked to submit one file at a time, since otherwise the parser callback on the first job will look for work and start the next parse. (In this test, the chain stopped there because the second file was trivial and invoked no callback.)

Fixes scala/scala-dev#840

@scala-jenkins scala-jenkins added this to the 2.13.16 milestone Sep 20, 2024
Copy link
Member

@lrytz lrytz left a comment

Choose a reason for hiding this comment

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

Looks good / safe to me, I don't fully follow (what are the "parser callbacks"?)

@@ -301,6 +301,7 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
def isOutOfDate: Boolean = outOfDate

def demandNewCompilerRun() = {
if (!lastWasReload) allSources.foreach(getUnit(_).foreach(reset(_)))
Copy link
Member

Choose a reason for hiding this comment

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

would it be equivalent to add a boolean param to demandNewCompilerRun and set it true at the callsite in reload?

@som-snytt
Copy link
Contributor Author

There is signalParseProgress and then signalDone when a tree is typed (TIL).

@som-snytt
Copy link
Contributor Author

BTW I was curious (or annoyed) about the test; it's not my intention to muck with (or break) the PC. I assumed incorrectly that it would be a mechanism problem that required no special knowledge of PC semantics and operations.

@SethTisue SethTisue modified the milestones: 2.13.16, 2.13.17 Dec 12, 2024
The "up-to-date" check is not sufficient when fetching
doc comments, since a unit may have been typechecked,
with doc wrapper trees removed.

A test instability was due to whether the scheduler
was checked by a callback or the runner thread.
One sample file had no parser callbacks at all.
@som-snytt
Copy link
Contributor Author

I was following the "outdated symbols in the IDE" comment to collectImplicitImports which leads to the infamous flaky PC test, i.e., back to here. (I'm considering the extra imported test in isQualifyingImplicit, whereby an import would always be shadowed by an entry in the current scope. That had an exists to combat staleness. I was able to make the stale object test fail on the shadowing PR, but I've forgotten the precious test number, a dir for separate compilation; and I've forgotten how I fixed the broken lookup. Oh I left a code comment, how clever.

 // if lookup fails, it's a stale symbol problem, not our problem (pos/t5639)

which is why that doesn't drop on failed lookup, only on successful lookup of the wrong (shadowing) symbol.

(I was recently reminded to look again at the 2.13.15 PR to warn about "phantom object" from the classpath: the class got a module, so the same module defined in source is hidden; the method of detection is to look in the package owner.)

The test in isQualifyingImiplicit looks benign and correct, except for the staleness caveat. (Not sure it's much more efficient than lookup test.)

The change in collectImplicitImports to use import's qual.tpe (the package) instead of the pre (the package object). Actually the new shadowed check says

            // ii.pre or skipPackageObject
            val pre = if (ii.pre.typeSymbol.isPackageObjectClass) ii.pre.typeSymbol.owner.module.info else ii.pre

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.

The most infamous flaky test
4 participants