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.

No compound assignment

x += 1 hides a read and a write in one operator, and its family differs between languages (++, +=, ||=). POLYTONE has one assignment form; the error says how to write it out.

broken.pt
mut count = 0
for x in [3, 4]:
    count += x
print("{count}")
The compiler answers
error: there is no compound assignment — write it out: 'x = x + 1' (line 3, column 12)

ptc fix repairs this by itself: Write out as 'count = count + …'