aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeApplications.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-12-22 16:11:43 +0100
committerMartin Odersky <odersky@gmail.com>2013-12-22 16:12:47 +0100
commit8216688420003002449313c8a4f419b09282bf84 (patch)
treeee3ba0a2e0215bf20c4369a27e9133dc65f7fa3e /src/dotty/tools/dotc/core/TypeApplications.scala
parent115e13b323e9ca845302a2c0ee0367e03cb8379b (diff)
downloaddotty-8216688420003002449313c8a4f419b09282bf84.tar.gz
dotty-8216688420003002449313c8a4f419b09282bf84.tar.bz2
dotty-8216688420003002449313c8a4f419b09282bf84.zip
Desugaring changes
1) Desugar type bounds containing empty trees 2) Include a productN parent for a case class, only if the case class has 2 or more parameters in its parameter section. Also, handle type bounds appearing in AppliedTypeTrees (these represent wildcard types).
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeApplications.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeApplications.scala13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/core/TypeApplications.scala b/src/dotty/tools/dotc/core/TypeApplications.scala
index 599e4b0f0..98249d8c9 100644
--- a/src/dotty/tools/dotc/core/TypeApplications.scala
+++ b/src/dotty/tools/dotc/core/TypeApplications.scala
@@ -127,11 +127,14 @@ class TypeApplications(val self: Type) extends AnyVal {
/** Turn this type, which is used as an argument for
* type parameter `tparam`, into a TypeBounds RHS
*/
- final def toBounds(tparam: Symbol)(implicit ctx: Context): TypeBounds = {
- val v = tparam.variance
- if (v > 0 && !(tparam is Local) && !(tparam is ExpandedTypeParam)) TypeBounds.upper(self)
- else if (v < 0 && !(tparam is Local) && !(tparam is ExpandedTypeParam)) TypeBounds.lower(self)
- else TypeAlias(self, v)
+ final def toBounds(tparam: Symbol)(implicit ctx: Context): TypeBounds = self match {
+ case self: TypeBounds => // this can happen for wildcard args
+ self
+ case _ =>
+ val v = tparam.variance
+ if (v > 0 && !(tparam is Local) && !(tparam is ExpandedTypeParam)) TypeBounds.upper(self)
+ else if (v < 0 && !(tparam is Local) && !(tparam is ExpandedTypeParam)) TypeBounds.lower(self)
+ else TypeAlias(self, v)
}
/** The type arguments of the base type instance wrt `base` of this type */