aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeComparer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-06-29 19:01:12 +0200
committerMartin Odersky <odersky@gmail.com>2016-07-11 13:34:58 +0200
commitd30f441ae986c144e739223be97b906b3bbd43dc (patch)
treeb7ba96597290a345dd9a92e3e0275f8a340fe766 /src/dotty/tools/dotc/core/TypeComparer.scala
parent5866d0d16c79ca5c62507bdcb7d87669426e86d6 (diff)
downloaddotty-d30f441ae986c144e739223be97b906b3bbd43dc.tar.gz
dotty-d30f441ae986c144e739223be97b906b3bbd43dc.tar.bz2
dotty-d30f441ae986c144e739223be97b906b3bbd43dc.zip
Allow general recursion in refined types.
Treat parent like refinedInfo. Introduce isBinding convenience method in TypeBounds.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeComparer.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeComparer.scala5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala
index 2523c6b9a..d1dc4069d 100644
--- a/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -465,7 +465,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
case _ =>
def isNullable(tp: Type): Boolean = tp.dealias match {
case tp: TypeRef => tp.symbol.isNullableClass
- case RefinedType(parent, _) => isNullable(parent)
+ case tp: RefinedType => isNullable(tp.parent)
case AndType(tp1, tp2) => isNullable(tp1) && isNullable(tp2)
case OrType(tp1, tp2) => isNullable(tp1) || isNullable(tp2)
case _ => false
@@ -738,9 +738,8 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
* @return The parent type of `tp2` after skipping the matching refinements.
*/
private def skipMatching(tp1: Type, tp2: RefinedType): Type = tp1 match {
- case tp1 @ RefinedType(parent1, name1)
+ case tp1 @ RefinedType(parent1, name1, rinfo1: TypeAlias)
if name1 == tp2.refinedName &&
- tp1.refinedInfo.isInstanceOf[TypeAlias] &&
!tp2.refinementRefersToThis &&
!tp1.refinementRefersToThis =>
tp2.parent match {