bynk.resolve.opaque_record_construction
Error An opaque type was constructed with record syntax.
An opaque type hides its representation so that nothing outside its own checks can produce a value of it, and a record literal T { value: … } would go round them. Build one with T.of(value), which validates and returns a Result, or, inside the commons that defines the type, with T.unsafe(value).
Example
type Timestamp = opaque Int
fn Timestamp.fromMillis(n: Int) -> Timestamp { Timestamp { value: n } // ✗ record syntax on an opaque type}
fn Timestamp.fromMillis(n: Int) -> Timestamp { Timestamp.unsafe(n) // ✓ inside the defining commons}In the Book
See also
- The grammar rule it governs:
record_construction. - Every code in its category, Resolution, on the diagnostic index.
bynk explain bynk.resolve.opaque_record_constructionshows the same from the installed toolchain, without a network.