aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeApplications.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-03-25 19:58:49 +0100
committerMartin Odersky <odersky@gmail.com>2016-03-30 09:51:04 +0200
commit78d2c9a00e1fcf20491a3f24423b6df40d6f14c1 (patch)
treeb3990e782b321629530f2f735b1e03143feb2eea /src/dotty/tools/dotc/core/TypeApplications.scala
parentde870e26da30e6d2b8f5dcab08a4f3db3334c41c (diff)
downloaddotty-78d2c9a00e1fcf20491a3f24423b6df40d6f14c1.tar.gz
dotty-78d2c9a00e1fcf20491a3f24423b6df40d6f14c1.tar.bz2
dotty-78d2c9a00e1fcf20491a3f24423b6df40d6f14c1.zip
Simplify widenToParents
No need to form the glb.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeApplications.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeApplications.scala9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/TypeApplications.scala b/src/dotty/tools/dotc/core/TypeApplications.scala
index 817aaee15..17573466f 100644
--- a/src/dotty/tools/dotc/core/TypeApplications.scala
+++ b/src/dotty/tools/dotc/core/TypeApplications.scala
@@ -295,7 +295,7 @@ class TypeApplications(val self: Type) extends AnyVal {
* no type field named `p` in this type, or `p` is a named type parameter of this type.
* The first case is important for the recursive case of AndTypes, because some of their operands might
* be missing the named parameter altogether, but the AndType as a whole can still
- * contain it.
+ * contain it.
*/
final def widenToNamedTypeParams(params: Set[TypeSymbol])(implicit ctx: Context): Type = {
@@ -311,10 +311,11 @@ class TypeApplications(val self: Type) extends AnyVal {
/** Widen type by forming the intersection of its widened parents */
def widenToParents(tp: Type) = {
- val parents = tp.parents.map(p => tp.baseTypeWithArgs(p.symbol))
- ctx.typeComparer.glb(parents.map(_.widenToNamedTypeParams(params)))
+ val parents = tp.parents.map(p =>
+ tp.baseTypeWithArgs(p.symbol).widenToNamedTypeParams(params))
+ parents.reduceLeft(ctx.typeComparer.andType(_, _))
}
-
+
if (isOK(self)) self
else self match {
case self @ AppliedType(tycon, args) if !isOK(tycon) =>