diff options
author | Martin Odersky <odersky@gmail.com> | 2013-07-19 17:05:16 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-07-19 17:05:16 +0200 |
commit | 702c4fc89f3ff2abbc7457fd72ab19b5bbdbb782 (patch) | |
tree | 9e36761227f5290b742e30072a728950f68e2aa4 /src/dotty/tools/dotc/core/Types.scala | |
parent | ea640a32264cb78efbf267d5c2be89e3e99dcccf (diff) | |
download | dotty-702c4fc89f3ff2abbc7457fd72ab19b5bbdbb782.tar.gz dotty-702c4fc89f3ff2abbc7457fd72ab19b5bbdbb782.tar.bz2 dotty-702c4fc89f3ff2abbc7457fd72ab19b5bbdbb782.zip |
Handling bounded wildcard types.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 8 |
1 files changed, 8 insertions, 0 deletions
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 } } |