Add annotations to 2dmatch to help typecheck.

Also use `match*/derived` to get the right error message name.