aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools
diff options
context:
space:
mode:
authorDmitry Petrashko <dark@d-d.me>2014-07-21 23:29:09 +0200
committerDmitry Petrashko <dark@d-d.me>2014-07-21 23:29:09 +0200
commit7fe148dac6deb8dcf556cc24be03992be81502e6 (patch)
tree95caa9d3f3641cd0b82c8d18c43c8308a7e2ef55 /src/dotty/tools
parente1aecf1bd75fc4a1ff0e0c3a422b799adf0c9f64 (diff)
parenta9aa810472b5ee117b0865350a06b28a06b27c5c (diff)
downloaddotty-7fe148dac6deb8dcf556cc24be03992be81502e6.tar.gz
dotty-7fe148dac6deb8dcf556cc24be03992be81502e6.tar.bz2
dotty-7fe148dac6deb8dcf556cc24be03992be81502e6.zip
Merge pull request #152 from dotty-staging/fux/substThis
Fix of FullParameterization
Diffstat (limited to 'src/dotty/tools')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala4
-rw-r--r--src/dotty/tools/dotc/transform/FullParameterization.scala4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 2cf4516cd..1d1c326a0 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -832,6 +832,10 @@ object Types {
final def substThis(cls: ClassSymbol, tp: Type)(implicit ctx: Context): Type =
ctx.substThis(this, cls, tp, null)
+ /** As substThis, but only is class is a static owner (i.e. a globally accessible object) */
+ final def substThisUnlessStatic(cls: ClassSymbol, tp: Type)(implicit ctx: Context): Type =
+ if (cls.isStaticOwner) this else ctx.substThis(this, cls, tp, null)
+
/** Substitute all occurrences of `RefinedThis(rt)` by `tp` */
final def substThis(rt: RefinedType, tp: Type)(implicit ctx: Context): Type =
ctx.substThis(this, rt, tp, null)
diff --git a/src/dotty/tools/dotc/transform/FullParameterization.scala b/src/dotty/tools/dotc/transform/FullParameterization.scala
index fea0482a0..e21a10492 100644
--- a/src/dotty/tools/dotc/transform/FullParameterization.scala
+++ b/src/dotty/tools/dotc/transform/FullParameterization.scala
@@ -98,7 +98,7 @@ trait FullParameterization {
def resultType(mapClassParams: Type => Type) = {
val thisParamType = mapClassParams(clazz.classInfo.selfType)
MethodType(nme.SELF :: Nil, thisParamType :: Nil)(mt =>
- mapClassParams(origResult).substThis(clazz, MethodParam(mt, 0)))
+ mapClassParams(origResult).substThisUnlessStatic(clazz, MethodParam(mt, 0)))
}
/** Replace class type parameters by the added type parameters of the polytype `pt` */
@@ -203,7 +203,7 @@ trait FullParameterization {
typeMap = rewireType(_)
.subst(origTParams, trefs)
.subst(origVParams, argRefs.map(_.tpe))
- .substThis(origClass, thisRef.tpe),
+ .substThisUnlessStatic(origClass, thisRef.tpe),
ownerMap = (sym => if (sym eq origMeth) derived else sym),
treeMap = {
case tree: This if tree.symbol == origClass => thisRef