diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2015-05-25 22:15:43 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2015-05-25 23:12:43 +1000 |
commit | 09dbf3f148b0dc04e10dd50ed2aa626c26afaeec (patch) | |
tree | 2c98de654e879da8532b1503c03a2cee8f02a607 | |
parent | ba81cf068c36cceaaf49ccbdbb86a45dc3b3a40f (diff) | |
download | scala-09dbf3f148b0dc04e10dd50ed2aa626c26afaeec.tar.gz scala-09dbf3f148b0dc04e10dd50ed2aa626c26afaeec.tar.bz2 scala-09dbf3f148b0dc04e10dd50ed2aa626c26afaeec.zip |
SI-9326 Fix regression with existentials in parent types
The typechecker rewrites `p.foo` to `p.<package>.foo` if `foo`
must come from a package object. This logic was overhauled in
51745c06f3, but this caused a regression.
I reverted to the predecessor of that commit to see how things
worked before. The lookup of the name `X` bound to the existential
quantifier, but incorrectly included the prefix `test.type` in the
result of the lookup. However, the subsequent call to
`isInPackageObject` (from `makeAccessible`) returned false, so
we didn't try to rewrite `X` to `test.<package>.X`.
This commit makes a minimal fix that makes `isInPackageObject`
return false for existentials.
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Contexts.scala | 2 | ||||
-rw-r--r-- | test/files/pos/t9326a.scala | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index d5a3fba76f..25c800e4d0 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -956,7 +956,7 @@ trait Contexts { self: Analyzer => * 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 && !sym.isExistentiallyBound def isNameInScope(name: Name) = lookupSymbol(name, _ => true).isSuccess 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 }] + |