From 702c4fc89f3ff2abbc7457fd72ab19b5bbdbb782 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 19 Jul 2013 17:05:16 +0200 Subject: Handling bounded wildcard types. --- src/dotty/tools/dotc/core/Types.scala | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/dotty/tools/dotc/core/Types.scala') diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index e66d86a40..f2b86242d 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -1796,6 +1796,8 @@ object Types { /** Wildcard type, possibly with bounds */ abstract case class WildcardType(optBounds: Type) extends CachedGroundType { + def derivedWildcardType(optBounds: Type)(implicit ctx: Context) = + if (optBounds eq this.optBounds) this else WildcardType(optBounds.asInstanceOf[TypeBounds]) override def computeHash = doHash(optBounds) } @@ -1891,6 +1893,9 @@ object Types { case tp @ TypeVar(_) => apply(tp.thisInstance) + case tp @ WildcardType => + tp.derivedWildcardType(mapOver(tp.optBounds)) + case _ => tp } @@ -1989,6 +1994,9 @@ object Types { case tp: TypeVar => foldOver(x, tp.thisInstance) + case tp: WildcardType => + foldOver(x, tp.optBounds) + case _ => x } } -- cgit v1.2.3