Skip to content
Playground(another site)

bynk.types.method_on_non_named_type

Error A method was called on a built-in type that has no methods.

A method call needs a type that has methods. A user-declared type does, and so do the built-ins that document them, such as String and List, but a function value, a Bool or () has none, so f.apply(n) has nothing to look up. A function is called directly, as f(n). For a type that does have methods, a name it lacks is bynk.types.method_not_found.

Example

fn twice(f: (Int) -> Int, n: Int) -> Int {
f.apply(f.apply(n)) // ✗ a function value has no methods
}
fn twice(f: (Int) -> Int, n: Int) -> Int {
f(f(n)) // ✓ call it directly
}

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_on_non_named_type shows the same from the installed toolchain, without a network.