-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix java typer problems with inner class references and raw types #19747
Fix java typer problems with inner class references and raw types #19747
Conversation
|
@@ -34,7 +34,7 @@ object ContextOps: | |||
if (elem.name == name) return elem.sym.denot // return self | |||
} | |||
val pre = ctx.owner.thisType | |||
if ctx.isJava then javaFindMember(name, pre, required, excluded) | |||
if ctx.isJava then javaFindMember(name, pre, lookInCompanion = true, required, excluded) |
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.
Why are we allowed to look in the companion here? This probably deserves a comment more than the false
case.
tests/run/i19619/RawTypesGen.java
Outdated
|
||
package lib; | ||
|
||
public class RawTypesGen<W> { |
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 file is already not used in this commit, and it gets removed later. Consider removing it from this commit in the first place.
potential TODO: tree's of Raw types from Java are still incorrect once they are serialized to TASTy, however it is debateable if we care to support them.
df3273d
to
e8e295a
Compare
this was the error in CI: -- [E083] Type Error: tests/pos-java-interop-separate/inner-fbounds/Configurer_1.java:6:40 -----------------------------
6 | public final class Registry extends AbstractRegistry<Registry> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
| AbstractConfigurer is not a valid class prefix, since it is not an immutable path
|
| longer explanation available when compiling with `-explain` this basically means that we can not widen the prefix of Java types, or you have to turn off the stability checker in Typer for Java types, or you only widen at Pickler. So I'll have to give up on preventing illegal types in Scala sources for java types like |
858b609
to
114f168
Compare
(If we widen Foo.this.Inner in the parents of a class to AbstractFoo#Inner, i.e. an inherited class Inner prefixed by its owner abstract class AbstractFoo, this is not considered a stable prefix for a class parent type. But in Java this is the correct type so allow it.)
114f168
to
d37857c
Compare
Tests changes against source dependency, Tasty dependency, and class dependency.
fixes #19619