clean up synthesizePartialFunction

implement the following review comments by @retronym:
- [x] Please clothe this naked assert.
- [x] Use match to dissect targs and check isFullyDefined.
- [x] Instead of `targs.head`/`targs.last`, use `val argTp :: resTp :: Nil = targs`.
- [x] Add a quasi-quote-style comment for `apply`.
- [x] Factor out mkCastPreservingAnnotations.