Skip to content

Commit

Permalink
Add more pos and neg tests
Browse files Browse the repository at this point in the history
Tests suggested by @retronym's comments on issue scala#897.
  • Loading branch information
odersky committed Nov 1, 2015
1 parent f07fcd8 commit 0b87375
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/dotc/tests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,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_functionArity() = compileFile(negDir, "function-arity", xerrors = 5)
@Test def neg_functionArity() = compileFile(negDir, "function-arity", xerrors = 6)
@Test def neg_typedapply() = compileFile(negDir, "typedapply", xerrors = 4)
@Test def neg_typedidents() = compileFile(negDir, "typedIdents", xerrors = 2)
@Test def neg_assignments() = compileFile(negDir, "assignments", xerrors = 3)
Expand Down
4 changes: 3 additions & 1 deletion tests/neg/function-arity.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ object Test {

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


def foo(a: Tuple2[Int, Int] => String): String = ""
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)
}
2 changes: 2 additions & 0 deletions tests/pos/function-arity.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ object Test {
unary(1, 2, (x: Int, y: Float) => x)

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

0 comments on commit 0b87375

Please sign in to comment.