aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-12-02 10:58:44 +0100
committerMartin Odersky <odersky@gmail.com>2015-12-06 16:09:20 +0100
commitf89b5628a66442edcc8c31193a559c6b5c32e837 (patch)
tree9f68cac5c14258449088d1021016377e7276c53b
parent0fde4b4902f81f9a020dbf460925596a276ab328 (diff)
downloaddotty-f89b5628a66442edcc8c31193a559c6b5c32e837.tar.gz
dotty-f89b5628a66442edcc8c31193a559c6b5c32e837.tar.bz2
dotty-f89b5628a66442edcc8c31193a559c6b5c32e837.zip
Add missing type params in test
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala2
-rw-r--r--src/dotty/tools/dotc/core/TypeApplications.scala8
-rw-r--r--src/dotty/tools/dotc/core/TypeComparer.scala2
-rw-r--r--src/dotty/tools/dotc/core/Types.scala12
-rw-r--r--src/dotty/tools/dotc/printing/RefinedPrinter.scala4
-rw-r--r--tests/pos/desugar.scala2
6 files changed, 15 insertions, 15 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index d7fa183c9..cc201b66b 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -446,7 +446,7 @@ object SymDenotations {
/** is this symbol a trait representing a type lambda? */
final def isLambdaTrait(implicit ctx: Context): Boolean =
- isClass && name.startsWith(tpnme.LambdaPrefix) && owner == defn.ScalaPackageClass
+ isClass && name.startsWith(tpnme.hkLambdaPrefix) && owner == defn.ScalaPackageClass
/** Is this symbol a package object or its module class? */
def isPackageObject(implicit ctx: Context): Boolean = {
diff --git a/src/dotty/tools/dotc/core/TypeApplications.scala b/src/dotty/tools/dotc/core/TypeApplications.scala
index c2738f4be..8417620f1 100644
--- a/src/dotty/tools/dotc/core/TypeApplications.scala
+++ b/src/dotty/tools/dotc/core/TypeApplications.scala
@@ -143,7 +143,7 @@ class TypeApplications(val self: Type) extends AnyVal {
/** Is receiver type higher-kinded (i.e. of kind != "*")? */
def isHK(implicit ctx: Context): Boolean = self.dealias match {
case self: TypeRef => self.info.isHK
- case RefinedType(_, name) => name == tpnme.hkApply || name.isLambdaArgName
+ case RefinedType(_, name) => name == tpnme.hkApply || name.isHkArgName
case TypeBounds(_, hi) => hi.isHK
case _ => false
}
@@ -465,7 +465,7 @@ class TypeApplications(val self: Type) extends AnyVal {
val lambda = defn.LambdaTrait(boundSyms.map(_.variance))
def toHK(tp: Type) = (rt: RefinedType) => {
val argRefs = boundSyms.indices.toList.map(i =>
- RefinedThis(rt).select(tpnme.LambdaArgName(i)))
+ RefinedThis(rt).select(tpnme.hkArg(i)))
val substituted =
if (cycleParanoid) new ctx.SafeSubstMap(boundSyms, argRefs).apply(tp)
else tp.subst(boundSyms, argRefs)
@@ -576,8 +576,8 @@ class TypeApplications(val self: Type) extends AnyVal {
new TypeMap {
def apply(tp: Type): Type = tp match {
case TypeRef(RefinedThis(binder), name) if binder eq self =>
- assert(name.isLambdaArgName)
- RefinedThis(reduced).select(reduced.typeParams.apply(name.LambdaArgIndex))
+ assert(name.isHkArgName)
+ RefinedThis(reduced).select(reduced.typeParams.apply(name.hkArgIndex))
case _ =>
mapOver(tp)
}
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala
index 1d9928e2d..6b37227b2 100644
--- a/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -669,7 +669,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
private def needsEtaLift(tp: Type, target: RefinedType): Boolean = {
// if (tp.isLambda != tp.isHK) println(i"discrepancy for $tp, isLambda = ${tp.isLambda}, isHK = ${tp.isHK}")
val name = target.refinedName
- (name.isLambdaArgName || (name eq tpnme.hkApply)) &&
+ (name.isHkArgName || (name eq tpnme.hkApply)) &&
tp.exists && !tp.isLambda // we do encounter Lambda classes without any arguments here
}
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 61d9093bc..566268455 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -855,7 +855,7 @@ object Types {
object instantiate extends TypeMap {
var isSafe = true
def apply(tp: Type): Type = tp match {
- case TypeRef(RefinedThis(`pre`), name) if name.isLambdaArgName =>
+ case TypeRef(RefinedThis(`pre`), name) if name.isHkArgName =>
member(name).info match {
case TypeAlias(alias) => alias
case _ => isSafe = false; tp
@@ -868,7 +868,7 @@ object Types {
}
}
def instArg(tp: Type): Type = tp match {
- case tp @ TypeAlias(TypeRef(RefinedThis(`pre`), name)) if name.isLambdaArgName =>
+ case tp @ TypeAlias(TypeRef(RefinedThis(`pre`), name)) if name.isHkArgName =>
member(name).info match {
case TypeAlias(alias) => tp.derivedTypeAlias(alias) // needed to keep variance
case bounds => bounds
@@ -1899,15 +1899,15 @@ object Types {
private def checkInst(implicit ctx: Context): this.type = {
if (Config.checkLambdaVariance)
refinedInfo match {
- case refinedInfo: TypeBounds if refinedInfo.variance != 0 && refinedName.isLambdaArgName =>
+ case refinedInfo: TypeBounds if refinedInfo.variance != 0 && refinedName.isHkArgName =>
val cls = parent.LambdaClass(forcing = false)
if (cls.exists)
- assert(refinedInfo.variance == cls.typeParams.apply(refinedName.LambdaArgIndex).variance,
- s"variance mismatch for $this, $cls, ${cls.typeParams}, ${cls.typeParams.apply(refinedName.LambdaArgIndex).variance}, ${refinedInfo.variance}")
+ assert(refinedInfo.variance == cls.typeParams.apply(refinedName.hkArgIndex).variance,
+ s"variance mismatch for $this, $cls, ${cls.typeParams}, ${cls.typeParams.apply(refinedName.hkArgIndex).variance}, ${refinedInfo.variance}")
case _ =>
}
if (Config.checkProjections &&
- (refinedName == tpnme.hkApply || refinedName.isLambdaArgName) &&
+ (refinedName == tpnme.hkApply || refinedName.isHkArgName) &&
parent.noHK)
assert(false, s"illegal refinement of first-order type: $this")
this
diff --git a/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
index 06fe0c9ef..04c9252eb 100644
--- a/src/dotty/tools/dotc/printing/RefinedPrinter.scala
+++ b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
@@ -190,14 +190,14 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
// LambdaI{...}.HK$i
val simplifyArgs = new TypeMap {
override def apply(tp: Type) = tp match {
- case tp @ TypeRef(RefinedThis(_), name) if name.isLambdaArgName =>
+ case tp @ TypeRef(RefinedThis(_), name) if name.isHkArgName =>
TypeRef(NoPrefix, tp.symbol.asType)
case _ =>
mapOver(tp)
}
}
(parent, simplifyArgs(tp.refinedInfo.followTypeAlias), Nil)
- } else if (name.isLambdaArgName) {
+ } else if (name.isHkArgName) {
val (prefix, body, argBindings) = decomposeHKApply(parent)
(prefix, body, (name, tp.refinedInfo) :: argBindings)
} else (tp, NoType, Nil)
diff --git a/tests/pos/desugar.scala b/tests/pos/desugar.scala
index 0d3b6d8ca..cc6794985 100644
--- a/tests/pos/desugar.scala
+++ b/tests/pos/desugar.scala
@@ -72,7 +72,7 @@ object desugar {
object misc {
'hello
s"this is a $x + ${x + y} string"
- type ~ = Tuple2
+ type ~[X, Y] = Tuple2[X, Y]
val pair: Int ~ String = 1 -> "abc"
def foo(xs: Int*) = xs.length
foo(list: _*)