summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala14
-rw-r--r--test/files/pos/t9326a.scala6
2 files changed, 14 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index d5a3fba76f..7c931600e5 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -952,11 +952,18 @@ trait Contexts { self: Analyzer =>
private def importedAccessibleSymbol(imp: ImportInfo, name: Name, requireExplicit: Boolean): Symbol =
imp.importedSymbol(name, requireExplicit) filter (s => isAccessible(s, imp.qual.tpe, superAccess = false))
+ private def requiresQualifier(s: Symbol) = (
+ s.owner.isClass
+ && !s.owner.isPackageClass
+ && !s.isTypeParameterOrSkolem
+ && !s.isExistentiallyBound
+ )
+
/** Must `sym` defined in package object of package `pkg`, if
* it selected from a prefix with `pkg` as its type symbol?
*/
def isInPackageObject(sym: Symbol, pkg: Symbol): Boolean =
- pkg.isPackage && sym.owner != pkg
+ pkg.isPackage && sym.owner != pkg && requiresQualifier(sym)
def isNameInScope(name: Name) = lookupSymbol(name, _ => true).isSuccess
@@ -992,11 +999,6 @@ trait Contexts { self: Analyzer =>
|| unit.exists && s.sourceFile != unit.source.file
)
)
- def requiresQualifier(s: Symbol) = (
- s.owner.isClass
- && !s.owner.isPackageClass
- && !s.isTypeParameterOrSkolem
- )
def lookupInPrefix(name: Name) = pre member name filter qualifies
def accessibleInPrefix(s: Symbol) = isAccessible(s, pre, superAccess = false)
diff --git a/test/files/pos/t9326a.scala b/test/files/pos/t9326a.scala
new file mode 100644
index 0000000000..aefc735585
--- /dev/null
+++ b/test/files/pos/t9326a.scala
@@ -0,0 +1,6 @@
+package p
+
+trait M[A]
+
+class C extends M[Tuple1[X] forSome { type X }]
+