summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2010-02-26 09:16:22 +0000
committerAdriaan Moors <adriaan.moors@epfl.ch>2010-02-26 09:16:22 +0000
commitcc9e8eda3364dcb7bf5b92a3d3824b66c85ef05f (patch)
treefaeea05030f6e003f8560acf74e807462fe4714b /src
parent1911d4e96a7681d86d4735a63832a04cac0fb7a4 (diff)
downloadscala-cc9e8eda3364dcb7bf5b92a3d3824b66c85ef05f.tar.gz
scala-cc9e8eda3364dcb7bf5b92a3d3824b66c85ef05f.tar.bz2
scala-cc9e8eda3364dcb7bf5b92a3d3824b66c85ef05f.zip
closes #2797 -- no review (already done in tick...
closes #2797 -- no review (already done in ticket by Martin) 1) isHigherKindedType is now false for singletontype 2) toInstance recurses when pre is a typevar: the problem is that pre.widen.typeSymbol isNonBottomSubClass symclazz is true while pre.baseType(symclazz) is NoType
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index aa88996876..509f9b3835 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -968,6 +968,7 @@ trait Types extends reflect.generic.Types { self: SymbolTable =>
incCounter(singletonBaseTypeSeqCount)
underlying.baseTypeSeq prepend this
}
+ override def isHigherKinded = false // singleton type classifies objects, thus must be kind *
override def safeToString: String = prefixString + "type"
/*
override def typeOfThis: Type = typeSymbol.typeOfThis
@@ -1082,9 +1083,9 @@ trait Types extends reflect.generic.Types { self: SymbolTable =>
underlyingPeriod = currentPeriod
if (!isValid(period)) {
underlyingCache = pre.memberType(sym).resultType;
+ assert(underlyingCache ne this, this)
}
}
- assert(underlyingCache ne this, this)
underlyingCache
}
@@ -3051,17 +3052,13 @@ A type's typeSymbol should never be inspected directly.
var capturedPre = emptySymMap
- def stabilize(pre: Type, clazz: Symbol): Type = {
- capturedPre get clazz match {
- case Some(qvar) =>
- qvar
- case _ =>
+ def stabilize(pre: Type, clazz: Symbol): Type =
+ capturedPre.getOrElse(clazz, {
val qvar = clazz freshExistential ".type" setInfo singletonBounds(pre)
capturedPre += (clazz -> qvar)
capturedParams = qvar :: capturedParams
qvar
- }
- }.tpe
+ }).tpe
/** Return pre.baseType(clazz), or if that's NoType and clazz is a refinement, pre itself.
* See bug397.scala for an example where the second alternative is needed.
@@ -3122,7 +3119,7 @@ A type's typeSymbol should never be inspected directly.
appliedType(as.head, args mapConserve (this)) // @M: was as.head
else instParam(ps.tail, as.tail);
val symclazz = sym.owner
- if (symclazz == clazz && (pre.widen.typeSymbol isNonBottomSubClass symclazz)) {
+ if (symclazz == clazz && !pre.isInstanceOf[TypeVar] && (pre.widen.typeSymbol isNonBottomSubClass symclazz)) {
pre.baseType(symclazz) match {
case TypeRef(_, basesym, baseargs) =>
//Console.println("instantiating " + sym + " from " + basesym + " with " + basesym.typeParams + " and " + baseargs+", pre = "+pre+", symclazz = "+symclazz);//DEBUG