diff options
author | Paul Phillips <paulp@improving.org> | 2010-12-19 10:29:13 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-12-19 10:29:13 +0000 |
commit | b0623ae481c3f02f532c1e7a381158d9e10ac55c (patch) | |
tree | 846e343994b5209c8cc61fc2646e18c33b8b16af /src | |
parent | ab276e195a5f2a2b15f01ff8862cb49dc98b4cd1 (diff) | |
download | scala-b0623ae481c3f02f532c1e7a381158d9e10ac55c.tar.gz scala-b0623ae481c3f02f532c1e7a381158d9e10ac55c.tar.bz2 scala-b0623ae481c3f02f532c1e7a381158d9e10ac55c.zip |
One more insomniac try: the fix for -explaintyp...
One more insomniac try: the fix for -explaintypes having gone off the
deep end. Review by odersky.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Definitions.scala | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala index 5f9696c71d..8dc1d3fb3b 100644 --- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala +++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala @@ -311,11 +311,13 @@ trait Definitions extends reflect.generic.StandardDefinitions { def tupleField(n: Int, j: Int) = getMember(TupleClass(n), "_" + j) def isTupleType(tp: Type): Boolean = isTupleType(tp, false) def isTupleTypeOrSubtype(tp: Type): Boolean = isTupleType(tp, true) - private def isTupleType(tp: Type, subtypeOK: Boolean): Boolean = cond(tp.normalize) { - case t @ TypeRef(_, sym, elems) => - elems.length <= MaxTupleArity && - (sym == TupleClass(elems.length) || - subtypeOK && !tp.isHigherKinded && (t <:< TupleClass(elems.length).tpe)) + private def isTupleType(tp: Type, subtypeOK: Boolean) = tp.normalize match { + case TypeRef(_, sym, args) => + args.nonEmpty && args.length <= MaxTupleArity && { + val tsym = TupleClass(args.length) + (sym == tsym) || (subtypeOK && !tp.isHigherKinded && sym.isSubClass(tsym)) + } + case _ => false } def tupleType(elems: List[Type]) = |