Review the merge code.

- Fix a Not_found exception with a default case.
- Add tests. Two of them, fail, as should be. The third one, however, reveals a
soundness bug in the type-checker.