POLYTONE — the AI-native programming language

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.

One canonical constructor

Named fields in declaration order mean every construction of a record looks identical everywhere — and the error prints the exact form to use.

broken.pt
record User:
    name: Text
    age: Int
let u = User(age: 36, name: "Ada")
The compiler answers
error: record fields are written in declaration order — expected 'name' here, found 'age'; the canonical form is User(name: ..., age: ...) (line 4, column 19)