Error codes · Types

PW0622

invariant_not_shown

The program must hold to this: a value is built of an opaque type only where the build shows it holds the type's invariant.

A program the compiler refuses with it

Refused: PW0622
module shop.handles

import String

opaque type Handle = String where String.length(value) >= 1 & String.length(value) <= 15

fn handle(draft: String) -> Handle !{} {
    Handle(draft)
}

From Opaque types and invariants, in The language. A test holds the guide's examples to the compiler.

The decisions behind it

0179

Reading the diagnostic

pw check prints the code in brackets, [PW0622], with the sentence above and the place in your program. Errors and diagnostics explains how to read one, and every code is listed with its rule.