V2032 constraint_not_satisfied
A type does not satisfy a constraint the operation requires: Eq, Ord, Hash or Schema (Show is V2031).
An error from the type phase. sakura explain V2032 prints this explanation offline.
A type does not satisfy a constraint the operation requires: Eq, Ord, Hash or Schema
(Show is V2031). Functions, handlers, resources and secrets have none of them (design §4.4).
Wrong:
let same = handler_a == handler_bFixed:
compare the data the handlers were built from insteadWrong program
compiler/tests/ui/V2032_constraint_not_satisfied.sakura, which the compiler's ui suite runs through sakura check:
fn same() -> Bool {
let f = fn() { 1 }
f == f
}sakura check --json reports this record (pretty-printed; $DIR is the fixture's directory):
{
"schema_version": "1.0",
"kind": "diagnostic",
"id": "d:2da2d755ba794ebb",
"code": "V2032",
"severity": "error",
"phase": "type",
"message": "`fn() -> Int` does not satisfy `Eq` (design §4.4)",
"snapshot": "sha256:$SNAPSHOT",
"symbol_id": "main::V2032_constraint_not_satisfied::same",
"spans": [
{
"uri": "file://$DIR/V2032_constraint_not_satisfied.sakura",
"content_hash": "sha256:ae6e16cc8193b90d276e40d7b7778b00256657d9160b737dfa95ce724166d94f",
"start_byte": 77,
"end_byte": 83,
"role": "primary"
}
],
"related_ids": [],
"expected": {
"render": "Eq"
},
"actual": {
"render": "fn() -> Int"
},
"obligation": null,
"counterexample": null,
"explanation_uri": "sakura://explain/V2032",
"fixes": []
}Fixed program
compiler/tests/ui/V2032_constraint_not_satisfied.fixed.sakura, which sakura check accepts with no diagnostics:
fn same() -> Bool {
let f = fn() { 1 }
f() == f()
}V2031 not_show
A value whose type is not Show was interpolated or printed.
V2033 opaque_not_schema
A Schema bound (Json.decode, Sql.query rows, Llm.generate, Cli.parse, Tool.of arguments, a property parameter) reaches an opaque type outside its declaring module, directly or through a field (design §17.130).