diff options
author | Paul Phillips <paulp@improving.org> | 2011-06-30 21:37:45 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-06-30 21:37:45 +0000 |
commit | fa2a19746252334f1691a0b63f4c263db878d438 (patch) | |
tree | 5584816d8e26d4c5d7f99a3944238bcdc1cc9be4 | |
parent | d782ab3246247a46607365d8c5e43b20ac211de3 (diff) | |
download | scala-fa2a19746252334f1691a0b63f4c263db878d438.tar.gz scala-fa2a19746252334f1691a0b63f4c263db878d438.tar.bz2 scala-fa2a19746252334f1691a0b63f4c263db878d438.zip |
Restored tiark's RefinedType-exclusion fast pat...
Restored tiark's RefinedType-exclusion fast path for implicit search.
The issue was that in a subtype check like
lhs <:< { val someName }
...you cannot determine it is impossible if the left hand side is an
abstract type, because you don't know what its members will be. Review
by rompf.
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Infer.scala | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index 2bf1d0035d..0fe50cb76e 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -425,17 +425,19 @@ trait Infer { private def isPlausiblySubType(tp1: Type, tp2: Type) = !isImpossibleSubType(tp1, tp2) private def isImpossibleSubType(tp1: Type, tp2: Type) = tp1.normalize.widen match { case tr1 @ TypeRef(_, sym1, _) => - tp2.normalize.widen match { + // If the lhs is an abstract type, we can't rule out a subtype + // relationship because we don't know what it is. + !sym1.isAbstractType && (tp2.normalize.widen match { case TypeRef(_, sym2, _) => sym1.isClass && sym2.isClass && !(sym1 isSubClass sym2) && !(sym1 isNumericSubClass sym2) - // XXX - disabled for preventing scalaz from building. - // case RefinedType(_, decls) => - // decls.nonEmpty && tp1.member(decls.head.name) == NoSymbol + case RefinedType(parents, decls) => + decls.nonEmpty && + tr1.member(decls.head.name) == NoSymbol case _ => false - } + }) case _ => false } |