123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)openAlpha_contextopenScript(* ---- Error definitions ---------------------------------------------------*)(* Auxiliary types for error documentation *)typenamespace=|Type_namespace|Constant_namespace|Instr_namespace|Keyword_namespacetypekind=Int_kind|String_kind|Bytes_kind|Prim_kind|Seq_kindtypeunparsed_stack_ty=(Script.expr*Script.annot)listtypetype_map=(int*(unparsed_stack_ty*unparsed_stack_ty))list(* Structure errors *)typeerror+=Invalid_arityofScript.location*prim*int*inttypeerror+=|Invalid_namespaceofScript.location*prim*namespace*namespacetypeerror+=Invalid_primitiveofScript.location*primlist*primtypeerror+=Invalid_kindofScript.location*kindlist*kindtypeerror+=Missing_fieldofprimtypeerror+=Duplicate_fieldofScript.location*primtypeerror+=Unexpected_big_mapofScript.locationtypeerror+=Unexpected_operationofScript.locationtypeerror+=Unexpected_contractofScript.locationtypeerror+=No_such_entrypointofstringtypeerror+=Duplicate_entrypointofstringtypeerror+=Unreachable_entrypointofprimlisttypeerror+=Entrypoint_name_too_longofstring(* Instruction typing errors *)typeerror+=Fail_not_in_tail_positionofScript.locationtypeerror+=|Undefined_binop:Script.location*prim*Script.expr*Script.expr->errortypeerror+=Undefined_unop:Script.location*prim*Script.expr->errortypeerror+=|Bad_return:Script.location*unparsed_stack_ty*Script.expr->errortypeerror+=|Bad_stack:Script.location*prim*int*unparsed_stack_ty->errortypeerror+=|Unmatched_branches:Script.location*unparsed_stack_ty*unparsed_stack_ty->errortypeerror+=Self_in_lambdaofScript.locationtypeerror+=Bad_stack_lengthtypeerror+=Bad_stack_itemofinttypeerror+=Inconsistent_annotationsofstring*stringtypeerror+=|Inconsistent_type_annotations:Script.location*Script.expr*Script.expr->errortypeerror+=Inconsistent_field_annotationsofstring*stringtypeerror+=Unexpected_annotationofScript.locationtypeerror+=Ungrouped_annotationsofScript.locationtypeerror+=Invalid_map_body:Script.location*unparsed_stack_ty->errortypeerror+=Invalid_map_block_failofScript.locationtypeerror+=|Invalid_iter_body:Script.location*unparsed_stack_ty*unparsed_stack_ty->errortypeerror+=Type_too_large:Script.location*int*int->error(* Value typing errors *)typeerror+=|Invalid_constant:Script.location*Script.expr*Script.expr->errortypeerror+=|Invalid_syntactic_constant:Script.location*Script.expr*string->errortypeerror+=Invalid_contractofScript.location*Contract.ttypeerror+=Invalid_big_mapofScript.location*Big_map.idtypeerror+=|Comparable_type_expected:Script.location*Script.expr->errortypeerror+=Inconsistent_types:Script.expr*Script.expr->errortypeerror+=Unordered_map_keysofScript.location*Script.exprtypeerror+=Unordered_set_valuesofScript.location*Script.exprtypeerror+=Duplicate_map_keysofScript.location*Script.exprtypeerror+=Duplicate_set_valuesofScript.location*Script.expr(* Toplevel errors *)typeerror+=|Ill_typed_data:stringoption*Script.expr*Script.expr->errortypeerror+=|Ill_formed_typeofstringoption*Script.expr*Script.locationtypeerror+=Ill_typed_contract:Script.expr*type_map->error(* Gas related errors *)typeerror+=Cannot_serialize_error(* Deprecation errors *)typeerror+=Deprecated_instructionofprim