Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Jun 26, 2023
1 parent 1faade5 commit d7ec913
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions tests/neg/t5702-neg-bad-and-wild.check
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
| pattern expected
|
| longer explanation available when compiling with `-explain`
-- Error: tests/neg/t5702-neg-bad-and-wild.scala:16:16 -----------------------------------------------------------------
16 | case (1, x*) => // error: bad use of *
| ^
| bad use of `*` - sequence pattern not allowed here
-- [E031] Syntax Error: tests/neg/t5702-neg-bad-and-wild.scala:17:18 ---------------------------------------------------
17 | case (1, x: _*) => // error: bad use of _* (sequence pattern not allowed)
| ^
Expand All @@ -32,6 +36,10 @@
| pattern expected
|
| longer explanation available when compiling with `-explain`
-- Error: tests/neg/t5702-neg-bad-and-wild.scala:25:14 -----------------------------------------------------------------
25 | val (b, _ * ) = (5,6) // error: bad use of `*`
| ^
| bad use of `*` - sequence pattern not allowed here
-- [E161] Naming Error: tests/neg/t5702-neg-bad-and-wild.scala:24:10 ---------------------------------------------------
24 | val K(x) = k // error: x is already defined as value x
| ^^^^^^^^^^^^
Expand Down Expand Up @@ -71,11 +79,3 @@
| If the narrowing is intentional, this can be communicated by adding `: @unchecked` after the expression,
| which may result in a MatchError at runtime.
| This patch can be rewritten automatically under -rewrite -source 3.2-migration.
-- Warning: tests/neg/t5702-neg-bad-and-wild.scala:25:20 ---------------------------------------------------------------
25 | val (b, _ * ) = (5,6) // ok
| ^^^^^
| pattern's type Int* does not match the right hand side expression's type Int
|
| If the narrowing is intentional, this can be communicated by adding `: @unchecked` after the expression,
| which may result in a MatchError at runtime.
| This patch can be rewritten automatically under -rewrite -source 3.2-migration.
4 changes: 2 additions & 2 deletions tests/neg/t5702-neg-bad-and-wild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ object Test {
case List(1, _*3:) => // error // error
case List(1, x*) => // ok
case List(x*, 1) => // error: pattern expected
case (1, x*) => //ok
case (1, x*) => // error: bad use of *
case (1, x: _*) => // error: bad use of _* (sequence pattern not allowed)
}

Expand All @@ -22,7 +22,7 @@ object Test {
val K(x @ _*) = k
val K(ns @ _*, xx) = k // error: pattern expected // error
val K(x) = k // error: x is already defined as value x
val (b, _ * ) = (5,6) // ok
val (b, _ * ) = (5,6) // error: bad use of `*`
// no longer complains
//bad-and-wild.scala:15: error: ')' expected but '}' found.
}
Expand Down

0 comments on commit d7ec913

Please sign in to comment.