-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Mention if missing symbol is on the class path #10774
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
Mention if missing symbol is on the class path #10774
Conversation
|
I re-ran the Jenkins build, now that the community build runs that were using all the disk have finished. I wonder sometimes if we should have a dedicated worker behemoth just for PR validation, separate from the behemoths used for the community build. |
Needs refinement, as it does add verbiage for incremental compilation error.
because (as will surprise no one) the class is still there, i.e., previous artifacts are not cleaned first.
|
a41bb8c
to
f89150a
Compare
The clever test is tweaked to allow The output check in typer may require tweaking: it uses single output only, and compares the path strings to mean "includes". |
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.
It seems a helpful addition. Given
package p {
object T
class C extends T
}
and
package p {
trait T
}
I assume IntelliJ would happily navigate from extends T
to the definition of trait T
, which makes it harder to figure why compilation fails.
val hidden = !unit.isJava && name.isTypeName && hasOutput && { | ||
startContext.lookupSymbol(name.toTermName, _ => true) match { | ||
case LookupSucceeded(qualifier, symbol) if symbol.owner.hasPackageFlag && symbol.sourceFile != null => | ||
symbol.owner.info.decls.lookupAll(name).toList match { |
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 I don't immediately understand; lookup for name
failed (we're about to issue an error), but lookupSymbol(name.toTermName).owner.info.decls.lookupAll(name)
gives a result. How is that?
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.
The package is loaded from class path first, which creates symbols of existing class + its module & module class. Then compilation of source takes over the existing module symbol, which is entered into scope.
It's fishy that the package class has a set of members but not all are in scope. Previously I've read a comment about stale symbols from previous run; symbol history, like human history, is a story of wreckage and detritus. Somehow I had never fully considered the state of the environment during incremental compilation.
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.
🤯
User code may reference a class C on the class path which is shadowed because user code introduces "false friend" companion object C and its companion class C. Similarly when referring to an object C while intoducing a class C. Only add the hint if the hidden symbol is on the class path but not in a current output directory, i.e., a stale symbol from a previous compilation.
f89150a
to
14b7b8d
Compare
Followed suggestions for better message, tweak test so I agree with the previous comment that REPL's reminder that "companions must be defined together" is not optional. This synthetic shadowing is very tricky. dotty has same behavior:
FSR I don't understand yet, the test under Vulpix says
|
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 hope this will prevent a lot of headscratching! Thanks.
Periodic reminder to get out the xpres spa scalp massager device. It's quite soothing. |
Some soothing might be needed because this PR broke on Windows... https://github.com/scala/scala/actions/runs/9369646735/job/25794666793
|
https://travis-ci.community/t/travis-focal-ubuntu-image-uses-now-expired-mongodb-4-4-package/14293/4 |
Well, you warned me about |
Hint if there is an object in scope, in a package, which has a class, and the class path finds it.
Fixes scala/bug#12289