Skip to content
Playground(another site)

bynk.parse.lambda_pattern_annotation

Error A lambda parameter with a record pattern carries a type annotation; the pattern's type name already gives the parameter's type.

A lambda parameter written as a record pattern already names its type, in Item { … }, and its names take their types from that record, so a : Type after the pattern is refused. Remove the annotation; the fix is machine-applicable, so bynk check --fix applies it.

Example

items.map((Item { qty, .. }: Item) => qty) // ✗ the pattern names the type
items.map((Item { qty, .. }) => qty) // ✓

In the Book

See also

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