Use context for error reporting.

unit.error is both deprecated and wrong during type checking, since it goes straight to the reporter, without considering silent mode

review by @retronym