repl: treat "Assignment to constant variable" as a syntax error

Fixes #6132.