Error Lab
Every diagnostic below is the real output of ptc, not a mock-up. Pick a mistake, read how the compiler teaches the canonical form, then flip to the fix.
Exhaustive matches
The compiler knows which variants exist — so it can tell you exactly which case is missing, spelled ready to paste.
enum Status:
Active
Banned(reason: Text)
let s: Status = Status.Active
match s:
case Status.Active:
print("ok")The compiler answers
error: this match on Status is not exhaustive — cover 'case Status.Banned(...):' or finish with a 'case _:' arm (line 5, column 1)enum Status:
Active
Banned(reason: Text)
let s: Status = Status.Active
match s:
case Status.Active:
print("ok")
case Status.Banned(reason: r):
print(r)Fixed — and it runs
ok