From 695b23bd92a2be856e2fbd94dc860c123ff1e359 Mon Sep 17 00:00:00 2001 From: Milo Davis Date: Fri, 26 Jan 2018 23:55:09 -0500 Subject: [PATCH] Michelson: export and printing for Type_too_large error --- src/proto_alpha/lib_client/michelson_v1_error_reporter.ml | 6 ++++++ src/proto_alpha/lib_protocol/src/script_ir_translator.mli | 1 + 2 files changed, 7 insertions(+) diff --git a/src/proto_alpha/lib_client/michelson_v1_error_reporter.ml b/src/proto_alpha/lib_client/michelson_v1_error_reporter.ml index 6b64f4d6e..3868f7276 100644 --- a/src/proto_alpha/lib_client/michelson_v1_error_reporter.ml +++ b/src/proto_alpha/lib_client/michelson_v1_error_reporter.ml @@ -60,6 +60,7 @@ let collect_error_locations errs = | (Invalid_arity (loc, _, _, _) | Inconsistent_type_annotations (loc, _, _) | Unexpected_annotation loc + | Type_too_large (loc, _, _) | Invalid_namespace (loc, _, _, _) | Invalid_primitive (loc, _, _) | Invalid_kind (loc, _, _) @@ -307,6 +308,11 @@ let report_errors ~details ~show_source ?parsed ppf errs = Format.fprintf ppf "@[%aunexpected annotation." print_loc loc + | Type_too_large (loc, size, maximum_size) -> + Format.fprintf ppf + "@[%atype size (%d) exceeded maximum type size (%d)." + print_loc loc + size maximum_size | Transfer_in_lambda loc -> Format.fprintf ppf "%aThe TRANSFER_TOKENS instruction cannot appear in a lambda." diff --git a/src/proto_alpha/lib_protocol/src/script_ir_translator.mli b/src/proto_alpha/lib_protocol/src/script_ir_translator.mli index e726201d8..a0d6f0e34 100644 --- a/src/proto_alpha/lib_protocol/src/script_ir_translator.mli +++ b/src/proto_alpha/lib_protocol/src/script_ir_translator.mli @@ -29,6 +29,7 @@ type error += Invalid_namespace of Script.location * Script.prim * namespace * n type error += Invalid_primitive of Script.location * Script.prim list * Script.prim type error += Invalid_kind of Script.location * kind list * kind type error += Missing_field of Script.prim +type error += Type_too_large : Script.location * int * int -> error (* Instruction typing errors *) type error += Fail_not_in_tail_position of Script.location