summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-08-29 13:04:03 +0000
committerMartin Odersky <odersky@gmail.com>2007-08-29 13:04:03 +0000
commitc61168109edaaf32cf43ce6a059043ffa7370c2f (patch)
treed04c7c90f2d7146a271e8865405e719c9df350c5 /src/compiler
parenteba18a359ec7fea69ce6a5486eb0ec50f549fbce (diff)
downloadscala-c61168109edaaf32cf43ce6a059043ffa7370c2f.tar.gz
scala-c61168109edaaf32cf43ce6a059043ffa7370c2f.tar.bz2
scala-c61168109edaaf32cf43ce6a059043ffa7370c2f.zip
FIXED DEFECTS 3, 9, 15
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala3
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala33
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala4
3 files changed, 20 insertions, 20 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
index d39329aab2..8d0a6f9649 100644
--- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
@@ -43,7 +43,6 @@ trait Symbols {
var rawflags: Long = 0
private var rawpos = initPos
val id = { ids += 1; ids }
-// assert(id != 6935, initName)
var validTo: Period = NoPeriod
@@ -682,7 +681,7 @@ trait Symbols {
/** A clone of this symbol, but with given owner */
final def cloneSymbol(owner: Symbol): Symbol =
- cloneSymbolImpl(owner).setInfo(info.cloneInfo(owner)).setFlag(this.rawflags)
+ cloneSymbolImpl(owner).setInfo(info.cloneInfo(this)).setFlag(this.rawflags)
/** Internal method to clone a symbol's implementation without flags or type
*/
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index e339a32257..97a037c8de 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -2257,18 +2257,20 @@ A type's typeSymbol should never be inspected directly.
}
case TypeRef(prefix, sym, args) if (sym.isTypeParameter) =>
def toInstance(pre: Type, clazz: Symbol): Type =
- if ((pre eq NoType) || (pre eq NoPrefix) || !clazz.isClass) mapOver(tp) //@M! see test pos/tcpoly_return_overriding.scala why mapOver is necessary
+ if ((pre eq NoType) || (pre eq NoPrefix) || !clazz.isClass) mapOver(tp)
+ //@M! see test pos/tcpoly_return_overriding.scala why mapOver is necessary
else {
def throwError =
throw new Error("" + tp + sym.locationString +
" cannot be instantiated from " + pre.widen);
def instParam(ps: List[Symbol], as: List[Type]): Type =
if (ps.isEmpty) throwError
- else if (sym eq ps.head) // @M! don't just replace the whole thing, might be followed by type application
+ else if (sym eq ps.head)
+ // @M! don't just replace the whole thing, might be followed by type application
appliedType(as.head, List.mapConserve(args)(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.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
@@ -2285,7 +2287,7 @@ A type's typeSymbol should never be inspected directly.
case _ =>
throwError
}
- else toInstance(base(pre, clazz).prefix, clazz.owner)
+ } else toInstance(base(pre, clazz).prefix, clazz.owner)
}
toInstance(pre, clazz)
case _ =>
@@ -2722,7 +2724,7 @@ A type's typeSymbol should never be inspected directly.
}
}
- private var sametypeRecursions: Int = 0
+ private var subsametypeRecursions: Int = 0
private def isUnifiable(pre1: Type, pre2: Type) =
(beginsWithTypeVar(pre1) || beginsWithTypeVar(pre2)) && (pre1 =:= pre2)
@@ -2734,25 +2736,25 @@ A type's typeSymbol should never be inspected directly.
/** Do `tp1' and `tp2' denote equivalent types?
*/
def isSameType(tp1: Type, tp2: Type): Boolean = try {
- sametypeRecursions += 1
+ subsametypeRecursions += 1
val lastUndoLog = undoLog
val result = isSameType0(tp1, tp2)
if (!result) undoTo(lastUndoLog)
result
} finally {
- sametypeRecursions -= 1
- if (sametypeRecursions == 0) undoLog = List()
+ subsametypeRecursions -= 1
+ if (subsametypeRecursions == 0) undoLog = List()
}
def isDifferentType(tp1: Type, tp2: Type): Boolean = try {
- sametypeRecursions += 1
+ subsametypeRecursions += 1
val lastUndoLog = undoLog
val result = isSameType0(tp1, tp2)
undoTo(lastUndoLog)
!result
} finally {
- sametypeRecursions -= 1
- if (sametypeRecursions == 0) undoLog = List()
+ subsametypeRecursions -= 1
+ if (subsametypeRecursions == 0) undoLog = List()
}
private def isSameType0(tp1: Type, tp2: Type): Boolean = {
@@ -2855,16 +2857,15 @@ A type's typeSymbol should never be inspected directly.
tps1.length == tps2.length &&
List.forall2(tps1, tps2)((tp1, tp2) => tp1 =:= tp2)
- private var subtypeRecursions: Int = 0
private var pendingSubTypes = new collection.mutable.HashSet[SubTypePair]
private var basetypeRecursions: Int = 0
private var pendingBaseTypes = new collection.mutable.HashSet[Type]
def isSubType(tp1: Type, tp2: Type): Boolean = try {
- subtypeRecursions += 1
+ subsametypeRecursions += 1
val lastUndoLog = undoLog
val result =
- if (subtypeRecursions >= LogPendingSubTypesThreshold) {
+ if (subsametypeRecursions >= LogPendingSubTypesThreshold) {
val p = new SubTypePair(tp1, tp2)
if (pendingSubTypes contains p)
false
@@ -2881,8 +2882,8 @@ A type's typeSymbol should never be inspected directly.
if (!result) undoTo(lastUndoLog)
result
} finally {
- subtypeRecursions -= 1
- if (subtypeRecursions == 0) undoLog = List()
+ subsametypeRecursions -= 1
+ if (subsametypeRecursions == 0) undoLog = List()
}
/** hook for IDE */
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 186abad06e..b9a95c84db 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2119,11 +2119,11 @@ trait Typers { self: Analyzer =>
def typedEta(expr1: Tree): Tree = expr1.tpe match {
case TypeRef(_, sym, _) if (sym == ByNameParamClass) =>
- val expr2 = Function(List(), expr1)
+ val expr2 = Function(List(), expr1) setPos expr1.pos
new ChangeOwnerTraverser(context.owner, expr2.symbol).traverse(expr2)
typed1(expr2, mode, pt)
case PolyType(List(), restpe) =>
- val expr2 = Function(List(), expr1)
+ val expr2 = Function(List(), expr1) setPos expr1.pos
new ChangeOwnerTraverser(context.owner, expr2.symbol).traverse(expr2)
typed1(expr2, mode, pt)
case PolyType(_, MethodType(formals, _)) =>