bynk.types.not_codable
Error A type is instantiated at a Codable-bounded parameter (of a generic function, or of a capability operation) but is outside the domain Json.decode accepts: top-level (), a function, Effect, Query, a Stream or a type that carries one, a connection, the HTTP and queue result types, Asset, request headers, token claims, or an actor (constrained-generics slice 3).
A type parameter declared T: Codable, on a generic fn or a capability operation, accepts only the types Json.decode can read. A call that makes T a function, an Effect, a Stream or a type carrying one, a bynk.crypto key or () is refused, because such a value has no wire form. Pass a plain value, or use a function whose parameter is not Codable. Calling Json.encode or Json.decode on such a type directly is bynk.types.json_uncodable.
Example
fn keep[T: Codable](x: T) -> T { x }
fn run(f: Int -> Int) -> Int { let _ = keep(f) // ✗ a function has no wire form 1}
fn run(n: Int) -> Int { keep(n) // ✓ an `Int` does}In the Book
See also
- Every code in its category, Type checking, on the diagnostic index.
bynk explain bynk.types.not_codableshows the same from the installed toolchain, without a network.