Fix #1017: Fast MethodDef comparison through hashes

By hashing the method defs the compiler emits, we can calculate more
accurate diffs in the incremental optimizer. This allows us to truly
only re-optimize methods that have changed (and their dependees).

Pseudo-benchmarks have shown that the speed-loss is minor:
~2s on 72s compile time for the whole scalajs library (~2.7%).

The changes to MethodDef made the pattern matcher (or typer) choke,
hence the seemingly unrelated changes to the patterns.
Not completely. Because the lub of two `Type`s does not always have the same result. It depends on global type information.