Skip to content
Playground(another site)

bynk.types.method_not_found

Error Called a method the type does not have.

A method call names an instance method that the receiver's type does not have. An instance method is a function declared with self as its first parameter. A function declared on a type without self is static, and is called on the type, as Counter.zero(), never on a value. This also fires on a typo, and on a built-in type that has methods but not this one, since only the methods the type documents exist.

Example

type Counter = { count: Int }
fn Counter.zero() -> Counter {
Counter { count: 0 }
}
fn reset(c: Counter) -> Counter {
c.zero() // ✗ `zero` has no `self`: not an instance method
}
fn reset(c: Counter) -> Counter {
Counter.zero() // ✓ a static function is called on the type
}

In the Book

See also

  • The grammar rule it governs: method_call.
  • Every code in its category, Type checking, on the diagnostic index.
  • bynk explain bynk.types.method_not_found shows the same from the installed toolchain, without a network.