Fixed a bug in type-checking for comprises-of. Refactored Match
type-checking as well.