Skip to content
Playground(another site)

bynk.parse.refined_pattern_inner

Error A refined pattern's inner form is something other than _.

A where guard on a match arm is written on the wildcard, as _ where InRange(0, 100). In this version no other pattern can carry one, a name included, so binding the matched value together with a guard is not yet supported. Write _ where …, and refer to the value by the name it already has.

Example

match n {
n where InRange(0, 100) => 1 // ✗ only `_` can take a `where`
_ => 0
}
match n {
_ where InRange(0, 100) => 1 // ✓
_ => 0
}

In the Book

See also

  • The grammar rule it governs: refined_pattern.
  • Every code in its category, Parser, on the diagnostic index.
  • bynk explain bynk.parse.refined_pattern_inner shows the same from the installed toolchain, without a network.