diff options
author | Martin Odersky <odersky@gmail.com> | 2016-02-16 15:49:00 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-02-16 15:49:13 +0100 |
commit | 06bfbd379fe350a93e3de38940fda0e359a07e1d (patch) | |
tree | b6624c554c7234825e4e3963d8c49be8109ef357 | |
parent | e5f8697cf54be6cfa82884eb2f4c4e4d79af2700 (diff) | |
download | dotty-06bfbd379fe350a93e3de38940fda0e359a07e1d.tar.gz dotty-06bfbd379fe350a93e3de38940fda0e359a07e1d.tar.bz2 dotty-06bfbd379fe350a93e3de38940fda0e359a07e1d.zip |
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.
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 2 | ||||
-rw-r--r-- | test/dotc/tests.scala | 2 | ||||
-rw-r--r-- | tests/neg/function-arity.scala | 4 |
3 files changed, 6 insertions, 2 deletions
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 +} |