Skip to content
Playground(another site)

bynk.actor.binder_shadows_param

Error A by actor binder collides with a handler parameter of the same name.

A by clause with a binder, by who: Visitor, adds a name to the handler body beside its parameters. If the binder is spelt like a parameter it would hide it, so a body that read body would silently get the actor instead of the request body. The compiler refuses the clash rather than choose one. Rename the binder or the parameter. A by with no binder, by Visitor, adds no name and cannot clash.

Example

on POST("/echo") (body: String) -> Effect[HttpResult[String]] by body: Visitor { // ✗ `body` is already a parameter
on POST("/echo") (body: String) -> Effect[HttpResult[String]] by who: Visitor { // ✓ a name of its own

In the Book

See also

  • Every code in its category, Actors, on the diagnostic index.
  • bynk explain bynk.actor.binder_shadows_param shows the same from the installed toolchain, without a network.