diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 2 | ||||
-rw-r--r-- | test/files/bug3938/Parent.java | 9 | ||||
-rw-r--r-- | test/files/bug3938/UseParent.scala | 7 |
3 files changed, 17 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 7ba561136d..fb8b0058eb 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -4267,7 +4267,7 @@ trait Typers extends Modes { val result = typed(tree, forTypeMode(mode) | FUNmode, WildcardType) val restpe = result.tpe.normalize // normalize to get rid of type aliases for the following check (#1241) - if (!phase.erasedTypes && restpe.isInstanceOf[TypeRef] && !restpe.prefix.isStable) { + if (!phase.erasedTypes && restpe.isInstanceOf[TypeRef] && !restpe.prefix.isStable && !context.unit.isJava) { error(tree.pos, restpe.prefix+" is not a legal prefix for a constructor") } diff --git a/test/files/bug3938/Parent.java b/test/files/bug3938/Parent.java new file mode 100644 index 0000000000..08fae330bb --- /dev/null +++ b/test/files/bug3938/Parent.java @@ -0,0 +1,9 @@ +public class Parent<A>{ + class I1 {} + class I2 extends Parent.I1 {} + + // OKAY: + class I3 extends I1 {} + static class I4 {} + static class I5 extends Parent.I4 {} +} diff --git a/test/files/bug3938/UseParent.scala b/test/files/bug3938/UseParent.scala new file mode 100644 index 0000000000..685d1a03a8 --- /dev/null +++ b/test/files/bug3938/UseParent.scala @@ -0,0 +1,7 @@ +object UseParent { + classOf[Parent[AnyRef]#I2] + + // OKAY + classOf[Parent[AnyRef]#I3] + classOf[Parent.I5] +} |