diff options
author | Den Shabalin <den.shabalin@gmail.com> | 2013-09-05 20:41:48 +0200 |
---|---|---|
committer | Den Shabalin <den.shabalin@gmail.com> | 2013-09-05 20:42:10 +0200 |
commit | 546e94099d667c6395582fcba321ef95578121a5 (patch) | |
tree | 6c250294e163c0aa008d117b5e994003174857fe /test/files | |
parent | 1352fea1c4ecfa0fd66ff1d5ad6e0ee437b1a59f (diff) | |
download | scala-546e94099d667c6395582fcba321ef95578121a5.tar.gz scala-546e94099d667c6395582fcba321ef95578121a5.tar.bz2 scala-546e94099d667c6395582fcba321ef95578121a5.zip |
SI-7803 support for matching of anonymous function literals
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/scalacheck/quasiquotes/TermConstructionProps.scala | 10 | ||||
-rw-r--r-- | test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala | 9 |
2 files changed, 18 insertions, 1 deletions
diff --git a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala index 599dfd442a..c6cca85c81 100644 --- a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala @@ -157,4 +157,14 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") { val empty = List[Tree]() assert(q"(..$empty)" ≈ q"()") } + + property("function param flags are the same") = test { + val xy = q"val x: A" :: q"val y: B" :: Nil + assertEqAst(q"(..$xy) => x + y", "(x: A, y: B) => x + y") + } + + property("anonymous functions don't support default values") = test { + val x = q"val x: Int = 1" + assertThrows[IllegalArgumentException] { q"($x) => x" } + } } diff --git a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala index 6087bbdb74..762625a46a 100644 --- a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala @@ -67,4 +67,11 @@ object TermDeconstructionProps extends QuasiquoteProperties("term deconstruction val q"{ ..$xs }" = q"{ x1; x2; x3 }" assert(xs ≈ List(q"x1", q"x2", q"x3")) } -}
\ No newline at end of file + + property("exhaustive function matcher") = test { + def matches(line: String) { val q"(..$args) => $body" = parse(line) } + matches("() => bippy") + matches("(y: Y) => y oh y") + matches("(x: X, y: Y) => x and y") + } +} |