aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-07-25 10:35:59 +0200
committerMartin Odersky <odersky@gmail.com>2016-07-25 10:36:07 +0200
commit226c7cb390d53acc2c18918d5a8f4b7133d4a4ac (patch)
tree9b2c729a0afb051adb95a1237a4291d075747778 /src
parent11f06fe8435c118a8476b2c197c1973ea4c647aa (diff)
downloaddotty-226c7cb390d53acc2c18918d5a8f4b7133d4a4ac.tar.gz
dotty-226c7cb390d53acc2c18918d5a8f4b7133d4a4ac.tar.bz2
dotty-226c7cb390d53acc2c18918d5a8f4b7133d4a4ac.zip
Fix #1385: Temporarily lift 22 limit for functions
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/core/Definitions.scala10
-rw-r--r--src/scala/Function23.scala21
-rw-r--r--src/scala/Function24.scala21
3 files changed, 50 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/Definitions.scala b/src/dotty/tools/dotc/core/Definitions.scala
index 6d183fe40..34b2d0562 100644
--- a/src/dotty/tools/dotc/core/Definitions.scala
+++ b/src/dotty/tools/dotc/core/Definitions.scala
@@ -12,7 +12,13 @@ import collection.mutable
import scala.reflect.api.{ Universe => ApiUniverse }
object Definitions {
- val MaxFunctionArity, MaxTupleArity = 22
+ val MaxTupleArity, MaxAbstractFunctionArity = 22
+ val MaxFunctionArity = 24
+ // Awaiting a definite solution that drops the limit altogether, 44 gives a safety
+ // margin over the previous 22, so that treecopiers in miniphases are allowed to
+ // temporarily create larger closures. This is needed in lambda lift where large closures
+ // are first formed by treecopiers before they are split apart into parameters and
+ // environment in the lambdalift transform itself.
}
/** A class defining symbols and types of standard definitions
@@ -587,7 +593,7 @@ class Definitions {
// ----- Symbol sets ---------------------------------------------------
- lazy val AbstractFunctionType = mkArityArray("scala.runtime.AbstractFunction", MaxFunctionArity, 0)
+ lazy val AbstractFunctionType = mkArityArray("scala.runtime.AbstractFunction", MaxAbstractFunctionArity, 0)
val AbstractFunctionClassPerRun = new PerRun[Array[Symbol]](implicit ctx => AbstractFunctionType.map(_.symbol.asClass))
def AbstractFunctionClass(n: Int)(implicit ctx: Context) = AbstractFunctionClassPerRun()(ctx)(n)
lazy val FunctionType = mkArityArray("scala.Function", MaxFunctionArity, 0)
diff --git a/src/scala/Function23.scala b/src/scala/Function23.scala
new file mode 100644
index 000000000..254772d53
--- /dev/null
+++ b/src/scala/Function23.scala
@@ -0,0 +1,21 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+package scala
+
+
+/** A function of 23 parameters. Used as a temporary fix until arity limit is dropped.
+ *
+ */
+trait Function23[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, -T19, -T20, -T21, -T22, -T23, +R] extends AnyRef { self =>
+ /** Apply the body of this function to the arguments.
+ * @return the result of function application.
+ */
+ def apply(v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7, v8: T8, v9: T9, v10: T10, v11: T11, v12: T12, v13: T13, v14: T14, v15: T15, v16: T16, v17: T17, v18: T18, v19: T19, v20: T20, v21: T21, v22: T22, v23: T23): R
+
+ override def toString() = "<function23>"
+}
diff --git a/src/scala/Function24.scala b/src/scala/Function24.scala
new file mode 100644
index 000000000..8af8ed995
--- /dev/null
+++ b/src/scala/Function24.scala
@@ -0,0 +1,21 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+package scala
+
+
+/** A function of 24 parameters. Used as a temporary fix until arity limit is dropped.
+ *
+ */
+trait Function24[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, -T13, -T14, -T15, -T16, -T17, -T18, -T19, -T20, -T21, -T22, -T23, -T24, +R] extends AnyRef { self =>
+ /** Apply the body of this function to the arguments.
+ * @return the result of function application.
+ */
+ def apply(v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7, v8: T8, v9: T9, v10: T10, v11: T11, v12: T12, v13: T13, v14: T14, v15: T15, v16: T16, v17: T17, v18: T18, v19: T19, v20: T20, v21: T21, v22: T22, v23: T23, v24: T24): R
+
+ override def toString() = "<function24>"
+}