From 29104c9755a9d6393959a416650422b84f0957f2 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sat, 31 Oct 2015 12:58:01 +0100 Subject: Auto-uncurry n-ary functions. Implements SIP #897. --- test/dotc/tests.scala | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala index 12b830738..0f6d134a5 100644 --- a/test/dotc/tests.scala +++ b/test/dotc/tests.scala @@ -111,6 +111,7 @@ class tests extends CompilerTest { @Test def neg_abstractOverride() = compileFile(negDir, "abstract-override", xerrors = 2) @Test def neg_blockescapes() = compileFile(negDir, "blockescapesNeg", xerrors = 1) @Test def neg_bounds() = compileFile(negDir, "bounds", xerrors = 2) + @Test def neg_functionArity() = compileFile(negDir, "function-arity", xerrors = 5) @Test def neg_typedapply() = compileFile(negDir, "typedapply", xerrors = 3) @Test def neg_typedIdents() = compileDir(negDir, "typedIdents", xerrors = 2) @Test def neg_assignments() = compileFile(negDir, "assignments", xerrors = 3) -- cgit v1.2.3 From 06bfbd379fe350a93e3de38940fda0e359a07e1d Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 16 Feb 2016 15:49:00 +0100 Subject: Strengthen requirement for auto-tupling Was: corresponding parameter types "are compatible". Now: corresponding parameter types "conform". This avoids the inconsistency mentioned by @retronym in #897. --- src/dotty/tools/dotc/typer/Typer.scala | 2 +- test/dotc/tests.scala | 2 +- tests/neg/function-arity.scala | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 952a1073c..f1e1d9286 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -618,7 +618,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit formal.derivesFrom(pclass) && formal.baseArgTypes(pclass).corresponds(params) { (argType, param) => - param.tpt.isEmpty || isCompatible(argType, typedAheadType(param.tpt).tpe) + param.tpt.isEmpty || argType <:< typedAheadType(param.tpt).tpe } } diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala index 0f6d134a5..60e9a4088 100644 --- a/test/dotc/tests.scala +++ b/test/dotc/tests.scala @@ -111,7 +111,7 @@ class tests extends CompilerTest { @Test def neg_abstractOverride() = compileFile(negDir, "abstract-override", xerrors = 2) @Test def neg_blockescapes() = compileFile(negDir, "blockescapesNeg", xerrors = 1) @Test def neg_bounds() = compileFile(negDir, "bounds", xerrors = 2) - @Test def neg_functionArity() = compileFile(negDir, "function-arity", xerrors = 5) + @Test def neg_functionArity() = compileFile(negDir, "function-arity", xerrors = 7) @Test def neg_typedapply() = compileFile(negDir, "typedapply", xerrors = 3) @Test def neg_typedIdents() = compileDir(negDir, "typedIdents", xerrors = 2) @Test def neg_assignments() = compileFile(negDir, "assignments", xerrors = 3) diff --git a/tests/neg/function-arity.scala b/tests/neg/function-arity.scala index 86fbab49f..5e0cb1058 100644 --- a/tests/neg/function-arity.scala +++ b/tests/neg/function-arity.scala @@ -22,3 +22,7 @@ object Test { def foo(a: Any => String) = () foo((a: Int, b: String) => a + b) // error: none of the overloaded alternatives of method foo match arguments (Int, Int) } +object jasonComment { + implicit def i2s(i: Int): String = i.toString + ((x: String, y: String) => 42) : (((Int, Int)) => String) // error +} -- cgit v1.2.3