Skip to content

Commit 35c81ea

Browse files
committed
Eliminate the '[E030] Match case Unreachable Warning' from a code example
- Use the new vararg splices syntax -- the original code example use both the old and new vararg splices syntax - Add return values rather than keep returning `()` implicitly for both cases -- no real world code would be written in this way.
1 parent ee5bab9 commit 35c81ea

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/_docs/reference/changed-features/pattern-matching.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,14 @@ object CharList:
221221
the type of the remaining patterns are determined as in Seq Pattern.
222222

223223
```Scala
224-
class Foo(val name: String, val children: Int *)
224+
class Foo(val name: String, val children: Int*)
225225
object Foo:
226226
def unapplySeq(f: Foo): Option[(String, Seq[Int])] =
227227
Some((f.name, f.children))
228228

229229
def foo(f: Foo) = f match
230-
case Foo(name, ns : _*) =>
231-
case Foo(name, x, y, ns : _*) =>
230+
case Foo(name, x, y, ns*) => ">= two children."
231+
case Foo(name, ns*) => => "< two children."
232232
```
233233

234234
There are plans for further simplification, in particular to factor out *product

0 commit comments

Comments
 (0)