diff options
author | Martin Odersky <odersky@gmail.com> | 2017-01-31 18:04:21 +1100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-01-31 18:04:28 +1100 |
commit | 4b961f8d2f62a83988da68f293c66dec8e44f369 (patch) | |
tree | f95ab714575fa81a62be9b1b5c0967a185291b68 | |
parent | d087448fdffff8f64a23d9db39445455cddc2fc6 (diff) | |
download | dotty-4b961f8d2f62a83988da68f293c66dec8e44f369.tar.gz dotty-4b961f8d2f62a83988da68f293c66dec8e44f369.tar.bz2 dotty-4b961f8d2f62a83988da68f293c66dec8e44f369.zip |
Fix #1916 - fix erasure of xxl closures
xxl closures need to get the SAM type FunctionXXL as their explicit
type field after ersure.
-rw-r--r-- | compiler/src/dotty/tools/dotc/transform/Erasure.scala | 4 | ||||
-rw-r--r-- | tests/run/functionXXL.scala (renamed from tests/pos/functionXXL.scala) | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/compiler/src/dotty/tools/dotc/transform/Erasure.scala b/compiler/src/dotty/tools/dotc/transform/Erasure.scala index 71ecb5c65..00abddd91 100644 --- a/compiler/src/dotty/tools/dotc/transform/Erasure.scala +++ b/compiler/src/dotty/tools/dotc/transform/Erasure.scala @@ -542,7 +542,9 @@ object Erasure extends TypeTestsCasts{ * to deal with boxing and unboxing of value classes ourselves. */ override def typedClosure(tree: untpd.Closure, pt: Type)(implicit ctx: Context) = { - val implClosure @ Closure(_, meth, _) = super.typedClosure(tree, pt) + val xxl = defn.isUnimplementedFunctionClass(tree.typeOpt.typeSymbol) + var implClosure @ Closure(_, meth, _) = super.typedClosure(tree, pt) + if (xxl) implClosure = cpy.Closure(implClosure)(tpt = TypeTree(defn.FunctionXXLType)) implClosure.tpe match { case SAMType(sam) => val implType = meth.tpe.widen diff --git a/tests/pos/functionXXL.scala b/tests/run/functionXXL.scala index 1063e4170..de8c8e3fa 100644 --- a/tests/pos/functionXXL.scala +++ b/tests/run/functionXXL.scala @@ -59,12 +59,12 @@ object Test { - println(f(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + assert(42 == f(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26)) - println(g(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + assert(42 == g(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26)) } |