aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-12-17 18:32:11 +0100
committerMartin Odersky <odersky@gmail.com>2013-12-17 18:32:37 +0100
commitc1c933d6f936a7975ca316c69d7639145eed36e7 (patch)
tree5ea46185fa361532d0914336c7eda1fddb7c8b5b /src/dotty/tools/dotc/core/Types.scala
parentd0b09e431ad6974c7ebc0a7734d46050ec712fa1 (diff)
downloaddotty-c1c933d6f936a7975ca316c69d7639145eed36e7.tar.gz
dotty-c1c933d6f936a7975ca316c69d7639145eed36e7.tar.bz2
dotty-c1c933d6f936a7975ca316c69d7639145eed36e7.zip
Fixes for by-name arguments
Previously, we did not strip off the => when comparing against expected type.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index a617f86d2..5976cf93b 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -550,6 +550,10 @@ object Types {
case _ => this
}
+ /** Widen from => T to T */
+ final def widenByName(implicit ctx: Context): Type =
+ if (this isRef defn.ByNameParamClass) this.typeArgs.head else this
+
/** Widen type if it is unstable (i.e. an EpxprType, or Termref to unstable symbol */
final def widenIfUnstable(implicit ctx: Context): Type = this match {
case tp: ExprType => tp.resultType.widenIfUnstable