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.

A stdlib function, not a method

Builtin types keep a small method table; everything else is a stdlib function you call qualified. When a method is missing but the stdlib has it, the error names the call and the import.

broken.pt
let scores = [3, 4, 5]
print("{scores.sum()}")
The compiler answers
error: no method 'sum' on List[Int] — it is a stdlib function: lists.sum(xs) (import lists) (line 2, column 16)

ptc fix repairs this by itself: Call 'lists.sum'