Proto: improvements on merge type error flag

Merged Mehdi Bouaziz requested to merge nomadic-labs/tezos:mehdi@better_merge_type_error into master

Context

Following !3695 (merged),

  • Invasively use the flag for all error-returning functions called by merge_types
  • Consequently have faster fast errors (fixes a few cases where we still produced expensive errors where we shouldn't have)
  • GADTify the flag to have static guarantees that fast errors are always caught
  • reduce usage of catch-all for non-fast errors

Manually testing the MR

CI

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, the Development Version section of CHANGES.md for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR
Edited by Mehdi Bouaziz