Skip to content
Playground(another site)

bynk.parse.record_pattern_in_is_unparenthesised

Error A record pattern after is is not parenthesised — write x is (T { f, .. }).

After is, a record pattern is written in parentheses. Bare, the { that opens its fields could equally open the block of the if, and the reader could not tell which. Write x is (Type { field, .. }). The fix is machine-applicable, so bynk check --fix applies it. A match arm needs no parentheses.

Example

fn isPaid(o: Order) -> Bool {
if o is Order { status: Paid, .. } { true } else { false } // ✗ `{` is ambiguous
}
fn isPaid(o: Order) -> Bool {
if o is (Order { status: Paid, .. }) { true } else { false } // ✓
}

In the Book

See also

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