Make the type checker stricter about type annotations.

It was accepting type annotations where the explicitly given type was
incompatible with the type inferred for the patterns. In particular, the
explicitly given type was a datatype, whereas the inferred type was of
the form x.y.