diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Infer.scala | 10 | ||||
-rw-r--r-- | test/files/pos/t4402/A.scala | 3 | ||||
-rw-r--r-- | test/files/pos/t4402/Bar.java | 7 | ||||
-rw-r--r-- | test/files/pos/t4402/Foo.java | 8 |
4 files changed, 24 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index 296e555559..45724f96dd 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -236,10 +236,9 @@ trait Infer { def accessError(tree: Tree, sym: Symbol, pre: Type, explanation: String): Tree = { val realsym = underlying(sym) - errorTree(tree, realsym + realsym.locationString + " cannot be accessed in " + - (if (sym.isClassConstructor) context.enclClass.owner else pre.widen) + - explanation) + (if (sym.isClassConstructor) context.enclClass.owner else pre.widen) + + explanation) } /* -- Tests & Checks---------------------------------------------------- */ @@ -258,9 +257,12 @@ trait Infer { if (context.unit != null) context.unit.depends += sym.toplevelClass - val sym1 = sym filter (alt => context.isAccessible(alt, pre, site.isInstanceOf[Super])) + var sym1 = sym filter (alt => context.isAccessible(alt, pre, site.isInstanceOf[Super])) // Console.println("check acc " + (sym, sym1) + ":" + (sym.tpe, sym1.tpe) + " from " + pre);//DEBUG + if (sym1 == NoSymbol && sym.isJavaDefined && context.unit.isJava) // don't try to second guess Java; see #4402 + sym1 = sym + if (sym1 == NoSymbol) { if (settings.debug.value) { Console.println(context) diff --git a/test/files/pos/t4402/A.scala b/test/files/pos/t4402/A.scala new file mode 100644 index 0000000000..f43f0865f0 --- /dev/null +++ b/test/files/pos/t4402/A.scala @@ -0,0 +1,3 @@ +package ohmy + +class A extends other.Bar diff --git a/test/files/pos/t4402/Bar.java b/test/files/pos/t4402/Bar.java new file mode 100644 index 0000000000..edc00a5fd1 --- /dev/null +++ b/test/files/pos/t4402/Bar.java @@ -0,0 +1,7 @@ +package other; + +public class Bar extends test.Foo { + void createMeSth(test.Foo.Inner aaa) { + aaa.hello(); + } +} diff --git a/test/files/pos/t4402/Foo.java b/test/files/pos/t4402/Foo.java new file mode 100644 index 0000000000..585a5e0a2c --- /dev/null +++ b/test/files/pos/t4402/Foo.java @@ -0,0 +1,8 @@ +package test; + +public abstract class Foo { + protected interface Inner { + public void hello(); + } +} + |