aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-09-18 19:52:07 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2014-10-11 08:24:35 +0200
commit67e0313c046f0cfea7dab8ef6e6c6136d12e61f1 (patch)
treebad77ed35d74330a8a8b7cfe06adbf9de2cfe135 /src/dotty/tools/dotc/core/Types.scala
parent8f18250f4fe494e0b6314fc2cb8e501753e79064 (diff)
downloaddotty-67e0313c046f0cfea7dab8ef6e6c6136d12e61f1.tar.gz
dotty-67e0313c046f0cfea7dab8ef6e6c6136d12e61f1.tar.bz2
dotty-67e0313c046f0cfea7dab8ef6e6c6136d12e61f1.zip
Take environment into account when typing a closure.
Environment parameters do not count in th eresult type.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 529452c73..6145bdffb 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -906,10 +906,14 @@ object Types {
/** Turn type into a function type.
* @pre this is a non-dependent method type.
+ * @param drop The number of trailing parameters that should be dropped
+ * when forming the function type.
*/
- def toFunctionType(implicit ctx: Context): Type = this match {
+ def toFunctionType(dropLast: Int = 0)(implicit ctx: Context): Type = this match {
case mt @ MethodType(_, formals) if !mt.isDependent =>
- defn.FunctionType(formals mapConserve (_.underlyingIfRepeated(mt.isJava)), mt.resultType)
+ val formals1 = if (dropLast == 0) formals else formals dropRight dropLast
+ defn.FunctionType(
+ formals1 mapConserve (_.underlyingIfRepeated(mt.isJava)), mt.resultType)
}
/** The signature of this type. This is by default NotAMethod,