diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2015-01-11 19:01:09 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2015-03-24 14:59:26 +1000 |
commit | 3d9d1f6c99d2ee803402b02cccba72086af74b38 (patch) | |
tree | 852b76b3a707cd7e55689863f4e23d2a9dac6795 /src/compiler | |
parent | e6e5b146f19ac7bebf046a4bc0cbc0b8ce88a3a1 (diff) | |
download | scala-3d9d1f6c99d2ee803402b02cccba72086af74b38.tar.gz scala-3d9d1f6c99d2ee803402b02cccba72086af74b38.tar.bz2 scala-3d9d1f6c99d2ee803402b02cccba72086af74b38.zip |
SI-9074 Fix generic substitution with package objects, overloading
Takes a leaf out of dotty's book [1] and makes `asSeenFrom`
transparently change the prefix from the package class to the
package object when needed.
This fixes generic subsitution during overload resolution, as
reported in SI-9074.
This subsumes the former fix for SI-6225, which is removed here.
[1] https://github.com/lampepfl/dotty/pull/282
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Contexts.scala | 7 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Infer.scala | 2 |
2 files changed, 2 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index b3e207b334..98289f6a3c 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -810,12 +810,7 @@ trait Contexts { self: Analyzer => val qual = imp.qual val qualSym = qual.tpe.typeSymbol - val pre = - if (qualSym.isPackageClass) - // SI-6225 important if the imported symbol is inherited by the the package object. - qualSym.packageObject.typeOfThis - else - qual.tpe + val pre = qual.tpe def collect(sels: List[ImportSelector]): List[ImplicitInfo] = sels match { case List() => List() diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index cf97474d9a..b9ccf0977c 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -1447,7 +1447,7 @@ trait Infer extends Checkable { log(s"Attaching AntiPolyType-carrying overloaded type to $sym") // Multiple alternatives which are within bounds; spin up an // overloaded type which carries an "AntiPolyType" as a prefix. - val tparams = newAsSeenFromMap(pre, hd.owner) mapOver hd.typeParams + val tparams = new AsSeenFromMap(pre, hd.owner) mapOver hd.typeParams val bounds = tparams map (_.tpeHK) // see e.g., #1236 val tpe = PolyType(tparams, OverloadedType(AntiPolyType(pre, bounds), alts)) finish(sym setInfo tpe, tpe) |