diff options
author | Martin Odersky <odersky@gmail.com> | 2007-05-01 14:01:18 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2007-05-01 14:01:18 +0000 |
commit | 1cc06bb6976e2d211b6219cfa7cdfbaab193791e (patch) | |
tree | e9ea3c4a2eafd5f6cd57d69c4fde3684d8f54dbc /test | |
parent | 28a1d779aa8e720c051890efeb711bef72528573 (diff) | |
download | scala-1cc06bb6976e2d211b6219cfa7cdfbaab193791e.tar.gz scala-1cc06bb6976e2d211b6219cfa7cdfbaab193791e.tar.bz2 scala-1cc06bb6976e2d211b6219cfa7cdfbaab193791e.zip |
more additions to checknull.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/bug997.check | 13 | ||||
-rwxr-xr-x | test/files/neg/bug997.scala | 15 |
2 files changed, 28 insertions, 0 deletions
diff --git a/test/files/neg/bug997.check b/test/files/neg/bug997.check new file mode 100644 index 0000000000..ba6dfd94bb --- /dev/null +++ b/test/files/neg/bug997.check @@ -0,0 +1,13 @@ +bug997.scala:7: error: wrong number of arguments for object Foo of type Foo.type +"x" match { case Foo(a) => Console.println(a) }
+ ^ +bug997.scala:7: error: not found: value a +"x" match { case Foo(a) => Console.println(a) }
+ ^ +bug997.scala:13: error: wrong number of arguments for object Foo of type Foo.type +"x" match { case Foo(a, b, c) => Console.println((a,b,c)) }
+ ^ +bug997.scala:13: error: not found: value a +"x" match { case Foo(a, b, c) => Console.println((a,b,c)) }
+ ^ +four errors found diff --git a/test/files/neg/bug997.scala b/test/files/neg/bug997.scala new file mode 100755 index 0000000000..b6897e62df --- /dev/null +++ b/test/files/neg/bug997.scala @@ -0,0 +1,15 @@ +// An extractor with 2 results +object Foo { def unapply(x : String) = Some(Pair(x, x)) } + +object Test extends Application { + +// Prints 'x'; ought not to compile (or maybe a should be the Pair?). +"x" match { case Foo(a) => Console.println(a) } + +// Prints '(x,x)' as expected. +"x" match { case Foo(a, b) => Console.println((a,b)) } + +// Gives confusing error 'not found: value c'. +"x" match { case Foo(a, b, c) => Console.println((a,b,c)) } + +} |