Skip to content

Fix #3807: Handle selection on raw Java type #3809

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
merged 2 commits into from
Jan 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2370,7 +2370,16 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
def adaptType(tp: Type): Tree = {
val tree1 =
if ((pt eq AnyTypeConstructorProto) || tp.typeParamSymbols.isEmpty) tree
else tree.withType(tree.tpe.EtaExpand(tp.typeParamSymbols))
else {
val tp1 =
if (ctx.compilationUnit.isJava)
// Cook raw type
AppliedType(tree.tpe, tp.typeParams.map(Function.const(TypeBounds.empty)))
else
// Eta-expand higher-kinded type
tree.tpe.EtaExpand(tp.typeParamSymbols)
tree.withType(tp1)
}
if ((ctx.mode is Mode.Pattern) || tree1.tpe <:< pt) tree1
else err.typeMismatch(tree1, pt)
}
Expand Down
9 changes: 9 additions & 0 deletions tests/pos-java-interop/selectOnRaw/Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
public class Test {
public Outer.Inner foo() {
return null;
}
}

class Outer<A> {
class Inner {}
}