Skip to content
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

[forward port] Use Java semantics for imports in .java files #8784

Merged
merged 2 commits into from
Mar 4, 2020

Conversation

retronym
Copy link
Member

@retronym retronym commented Mar 3, 2020

Forward port of #8755 that was too conflicting to be part of the routine merge.

hrhino and others added 2 commits March 4, 2020 07:31
An static member of a superclass may be referred to in an
static import in Java sources qualified by a reference to the subclass.

We've accounted for related problems previously in `typedIdent`
and `typedSelect` by delegating to `javaFindMember`.

This commit uses the same facility when checking that import
selectors are valid and when checking if such an import contributes
a name we are looking up.

The test cases here use `-Ypickle-java` as a straightforward
way to force typechecking all Java imports and signatures, however
the bug fix is also beneficial outside of that mode if Scala
code transitively depends on the correct interpretation of such a
Java import.

(cherry picked from ca7dc4d)
If we're typechecking a Java source file skip implicit gathering.
It might have found some (from the imported Scala code, for instance)
but they serve no purpose.

I noticed this opportunity when I implemented Java semantics
for static imports in the previous commit and looked at the callers
of the changed code.

I don't think we can add a similar fast path to Symbol.implicitMembers
because a Java defined symbol might have Scala base classes that
could contribute implicits to Scala code.

(cherry picked from commit 398a891)
@scala-jenkins scala-jenkins added this to the 2.13.3 milestone Mar 3, 2020
@SethTisue SethTisue modified the milestones: 2.13.3, 2.13.2 Mar 4, 2020
@lrytz lrytz merged commit db6fa85 into scala:2.13.x Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants