bynk.types.opaque_raw_outside
Error .raw on an opaque type was used outside its defining commons.
An opaque type hides its base representation from everything but the unit that declares it, so no other code can take a Token apart or forge one. .raw reads the base value and is allowed only there. Elsewhere, use what the defining unit offers: a method or accessor on the type. To make a value, use Token.of(value).
Example
type Token = opaque String
fn Token.value(self) -> String { self.raw}
// app.bynkfn show(t: Token) -> String { t.raw // ✗ `Token` is opaque outside `token`}
fn show(t: Token) -> String { t.value() // ✓ use the accessor `token` provides}In the Book
See also
- The grammar rule it governs:
field_access. - Every code in its category, Type checking, on the diagnostic index.
bynk explain bynk.types.opaque_raw_outsideshows the same from the installed toolchain, without a network.