Detect error changes as model changes

Declarations with errors are now seen as having structural changes.

This required updating most test cases so that they don’t have errors (there were many `formal` toplevel functions).

Also fixes #1152.