Skip to content

Commit 3dec6ef

Browse files
committed
Add more pos and neg tests
Tests suggested by @retronym's comments on issue #897.
1 parent 975739a commit 3dec6ef

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

test/dotc/tests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class tests extends CompilerTest {
109109
@Test def neg_abstractOverride() = compileFile(negDir, "abstract-override", xerrors = 2)
110110
@Test def neg_blockescapes() = compileFile(negDir, "blockescapesNeg", xerrors = 1)
111111
@Test def neg_bounds() = compileFile(negDir, "bounds", xerrors = 2)
112-
@Test def neg_functionArity() = compileFile(negDir, "function-arity", xerrors = 5)
112+
@Test def neg_functionArity() = compileFile(negDir, "function-arity", xerrors = 6)
113113
@Test def neg_typedapply() = compileFile(negDir, "typedapply", xerrors = 4)
114114
@Test def neg_typedIdents() = compileDir(negDir, "typedIdents", xerrors = 2)
115115
@Test def neg_assignments() = compileFile(negDir, "assignments", xerrors = 3)

tests/neg/function-arity.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@ object Test {
1818

1919
unary[(Int, Int)]((x: String, y) => ()) // error
2020

21-
21+
def foo(a: Tuple2[Int, Int] => String): String = ""
22+
def foo(a: Any => String) = ()
23+
foo((a: Int, b: String) => a + b) // error: none of the overloaded alternatives of method foo match arguments (Int, Int)
2224
}

tests/pos/function-arity.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ object Test {
1414
unary(1, 2, (x: Int, y: Float) => x)
1515

1616
val xs = List(1, 2, 3)
17+
def f(x: Int, y: Int) = x * y
1718
xs.zipWithIndex.map(_ + _)
19+
xs.zipWithIndex.map(f)
1820
}

0 commit comments

Comments
 (0)