bynk.val.pin_not_literal
Error A Val[T] pin argument is not a compile-time literal.
A pin on Val[T] is checked against the refinement of T when the program compiles, so it must be a literal of T's base type. A name or a call has no value at that point. Write the literal in place. For a computed value, build it with Age.of(…) and ?, which fails the case if the value is not valid.
Example
type Age = Int where InRange(0, 150)
// tests/ages.test.bynklet n = 20let a = Val[Age](n) // ✗ a name, not a literallet a = Val[Age](20) // ✓ a literalIn the Book
- Testing › Val[T] — value fabrication
- Testing › @example — a value for a pattern
- Testing
- Write tests, stub collaborators, and pin a `Val[T]`
See also
- The grammar rule it governs:
val_expr. - Every code in its category, Value fabrication, on the diagnostic index.
bynk explain bynk.val.pin_not_literalshows the same from the installed toolchain, without a network.