diff options
author | Paul Phillips <paulp@improving.org> | 2010-02-14 06:52:11 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-02-14 06:52:11 +0000 |
commit | d7ad3f348753884e154ab40aa848b6f9d85d7b52 (patch) | |
tree | aa76c186cd77d09f6426286dc757787d8905f024 /src | |
parent | 730720552b80eacd2581f860fbd861098e54fa7e (diff) | |
download | scala-d7ad3f348753884e154ab40aa848b6f9d85d7b52.tar.gz scala-d7ad3f348753884e154ab40aa848b6f9d85d7b52.tar.bz2 scala-d7ad3f348753884e154ab40aa848b6f9d85d7b52.zip |
Added some error logic so if #2956 strikes agai...
Added some error logic so if #2956 strikes again we'll have a better
idea why. No review.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Types.scala | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index ab8c34d44d..e46d7bea84 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -3130,12 +3130,13 @@ A type's typeSymbol should never be inspected directly. protected def matches(sym: Symbol, sym1: Symbol): Boolean = sym eq sym1 /** Map target to type, can be tuned by subclasses */ - protected def toType(fromtp: Type, t: T): Type + protected def toType(fromtp: Type, tp: T): Type - def subst(tp: Type, sym: Symbol, from: List[Symbol], to: List[T]): Type = - if (from.isEmpty) tp - else if (matches(from.head, sym)) toType(tp, to.head) - else subst(tp, sym, from.tail, to.tail) + def subst(tp: Type, sym: Symbol, from: List[Symbol], to: List[T]): Type = + if (from.isEmpty) tp + else if (to.isEmpty) error("Unexpected substitution on '%s': from = %s but to == Nil".format(tp, from)) + else if (matches(from.head, sym)) toType(tp, to.head) + else subst(tp, sym, from.tail, to.tail) private def renameBoundSyms(tp: Type): Type = tp match { case MethodType(ps, restp) => @@ -3189,6 +3190,7 @@ A type's typeSymbol should never be inspected directly. override def apply(tp: Type): Type = if (from.isEmpty) tp else { def subst(sym: Symbol, from: List[Symbol], to: List[Symbol]): Symbol = if (from.isEmpty) sym + else if (to.isEmpty) error("Unexpected substitution on '%s': from = %s but to == Nil".format(sym, from)) else if (matches(from.head, sym)) to.head else subst(sym, from.tail, to.tail) tp match { @@ -3240,7 +3242,6 @@ A type's typeSymbol should never be inspected directly. extends SubstMap(from, to) { protected def toType(fromtp: Type, tp: Type) = tp - override def mapOver(tree: Tree, giveup: ()=>Nothing): Tree = { object trans extends TypeMapTransformer { override def transform(tree: Tree) = |