bynk.val.generic_type
Error A Val[…] fabricates a value of a generic type; per-instantiation value fabrication is not yet wired (ADR 0197). The type itself may cross a boundary through its monomorphised codec (v0.174). Named bynk.generics.generic_record_at_boundary before #3379.
Val[T] fabricates a value for a test from the declaration of T. That is not yet done for each instantiation of a generic type, so Val refuses one whether it is written bare, Val[Box], or applied, Val[Box[Int]]. The type itself is fine, and may cross a boundary through its codec; only fabrication is missing. Build the value yourself instead: a record literal for a generic record, one of its variants for a generic sum.
Example
type Box[T] = { v: T }
let b = Val[Box[Int]] // ✗ a generic type cannot be fabricated
let b = Box { v: 1 } // ✓ build itIn the Book
See also
- The grammar rule it governs:
val_expr. - Every code in its category, Value fabrication, on the diagnostic index.
bynk explain bynk.val.generic_typeshows the same from the installed toolchain, without a network.