Alpha: fix Michelson interpreter diagnostics field names to have underscores

This commit is contained in:
dbornside 2018-07-14 19:09:05 -04:00 committed by Grégoire Henry
parent 41b98dac63
commit 289cc7ba96
3 changed files with 42 additions and 42 deletions

View File

@ -559,7 +559,7 @@ let () =
~description: ~description:
"In a script or data expression, a primitive was unknown." "In a script or data expression, a primitive was unknown."
~pp:(fun ppf n -> Format.fprintf ppf "Unknown primitive %s." n) ~pp:(fun ppf n -> Format.fprintf ppf "Unknown primitive %s." n)
Data_encoding.(obj1 (req "wrongPrimitiveName" string)) Data_encoding.(obj1 (req "wrong_primitive_name" string))
(function (function
| Unknown_primitive_name got -> Some got | Unknown_primitive_name got -> Some got
| _ -> None) | _ -> None)
@ -573,7 +573,7 @@ let () =
"In a script or data expression, a primitive name is \ "In a script or data expression, a primitive name is \
neither uppercase, lowercase or capitalized." neither uppercase, lowercase or capitalized."
~pp:(fun ppf n -> Format.fprintf ppf "Primitive %s has invalid case." n) ~pp:(fun ppf n -> Format.fprintf ppf "Primitive %s has invalid case." n)
Data_encoding.(obj1 (req "wrongPrimitiveName" string)) Data_encoding.(obj1 (req "wrong_primitive_name" string))
(function (function
| Invalid_case name -> Some name | Invalid_case name -> Some name
| _ -> None) | _ -> None)

View File

@ -82,8 +82,8 @@ let () =
~title: "Script runtime error" ~title: "Script runtime error"
~description: "Toplevel error for all runtime script errors" ~description: "Toplevel error for all runtime script errors"
(obj2 (obj2
(req "contractHandle" Contract.encoding) (req "contract_handle" Contract.encoding)
(req "contractCode" Script.expr_encoding)) (req "contract_code" Script.expr_encoding))
(function (function
| Runtime_contract_error (contract, expr) -> | Runtime_contract_error (contract, expr) ->
Some (contract, expr) Some (contract, expr)

View File

@ -86,9 +86,9 @@ let () =
"In a script or data expression, a primitive was applied \ "In a script or data expression, a primitive was applied \
to an unsupported number of arguments." to an unsupported number of arguments."
(located (obj3 (located (obj3
(req "primitiveName" Script.prim_encoding) (req "primitive_name" Script.prim_encoding)
(req "expectedArity" arity_enc) (req "expected_arity" arity_enc)
(req "wrongArity" arity_enc))) (req "wrong_arity" arity_enc)))
(function (function
| Invalid_arity (loc, name, exp, got) -> | Invalid_arity (loc, name, exp, got) ->
Some (loc, (name, exp, got)) Some (loc, (name, exp, got))
@ -113,8 +113,8 @@ let () =
~description: ~description:
"In a script or data expression, a primitive was unknown." "In a script or data expression, a primitive was unknown."
(located (obj2 (located (obj2
(dft "expectedPrimitiveNames" (list prim_encoding) []) (dft "expected_primitive_names" (list prim_encoding) [])
(req "wrongPrimitiveName" prim_encoding))) (req "wrong_primitive_name" prim_encoding)))
(function (function
| Invalid_primitive (loc, exp, got) -> Some (loc, (exp, got)) | Invalid_primitive (loc, exp, got) -> Some (loc, (exp, got))
| _ -> None) | _ -> None)
@ -129,8 +129,8 @@ let () =
"In a script or data expression, an expression was of the wrong kind \ "In a script or data expression, an expression was of the wrong kind \
(for instance a string where only a primitive applications can appear)." (for instance a string where only a primitive applications can appear)."
(located (obj2 (located (obj2
(req "expectedKinds" (list kind_enc)) (req "expected_kinds" (list kind_enc))
(req "wrongKind" kind_enc))) (req "wrong_kind" kind_enc)))
(function (function
| Invalid_kind (loc, exp, got) -> Some (loc, (exp, got)) | Invalid_kind (loc, exp, got) -> Some (loc, (exp, got))
| _ -> None) | _ -> None)
@ -144,9 +144,9 @@ let () =
~description: ~description:
"In a script or data expression, a primitive was of the wrong namespace." "In a script or data expression, a primitive was of the wrong namespace."
(located (obj3 (located (obj3
(req "primitiveName" prim_encoding) (req "primitive_name" prim_encoding)
(req "expectedNamespace" namespace_enc) (req "expected_namespace" namespace_enc)
(req "wrongNamespace" namespace_enc))) (req "wrong_namespace" namespace_enc)))
(function (function
| Invalid_namespace (loc, name, exp, got) -> Some (loc, (name, exp, got)) | Invalid_namespace (loc, name, exp, got) -> Some (loc, (name, exp, got))
| _ -> None) | _ -> None)
@ -265,9 +265,9 @@ let () =
"A binary operation is called on operands of types \ "A binary operation is called on operands of types \
over which it is not defined." over which it is not defined."
(located (obj3 (located (obj3
(req "operatorName" prim_encoding) (req "operator_name" prim_encoding)
(req "wrongLeftOperandType" Script.expr_encoding) (req "wrong_left_operand_type" Script.expr_encoding)
(req "wrongRightOperandType" Script.expr_encoding))) (req "wrong_right_operand_type" Script.expr_encoding)))
(function (function
| Undefined_binop (loc, n, tyl, tyr) -> | Undefined_binop (loc, n, tyl, tyr) ->
Some (loc, (n, tyl, tyr)) Some (loc, (n, tyl, tyr))
@ -283,8 +283,8 @@ let () =
"A unary operation is called on an operand of type \ "A unary operation is called on an operand of type \
over which it is not defined." over which it is not defined."
(located (obj2 (located (obj2
(req "operatorName" prim_encoding) (req "operator_name" prim_encoding)
(req "wrongOperandType" Script.expr_encoding))) (req "wrong_operand_type" Script.expr_encoding)))
(function (function
| Undefined_unop (loc, n, ty) -> | Undefined_unop (loc, n, ty) ->
Some (loc, (n, ty)) Some (loc, (n, ty))
@ -299,8 +299,8 @@ let () =
~description: ~description:
"Unexpected stack at the end of a lambda or script." "Unexpected stack at the end of a lambda or script."
(located (obj2 (located (obj2
(req "expectedReturnType" Script.expr_encoding) (req "expected_return_type" Script.expr_encoding)
(req "wrongStackType" stack_ty_enc))) (req "wrong_stack_type" stack_ty_enc)))
(function (function
| Bad_return (loc, sty, ty) -> Some (loc, (ty, sty)) | Bad_return (loc, sty, ty) -> Some (loc, (ty, sty))
| _ -> None) | _ -> None)
@ -314,9 +314,9 @@ let () =
~description: ~description:
"The stack has an unexpected length or contents." "The stack has an unexpected length or contents."
(located (obj3 (located (obj3
(req "primitiveName" prim_encoding) (req "primitive_name" prim_encoding)
(req "relevantStackPortion" int16) (req "relevant_stack_portion" int16)
(req "wrongStackType" stack_ty_enc))) (req "wrong_stack_type" stack_ty_enc)))
(function (function
| Bad_stack (loc, name, s, sty) -> Some (loc, (name, s, sty)) | Bad_stack (loc, name, s, sty) -> Some (loc, (name, s, sty))
| _ -> None) | _ -> None)
@ -388,8 +388,8 @@ let () =
"At the join point at the end of two code branches \ "At the join point at the end of two code branches \
the stacks have inconsistent lengths or contents." the stacks have inconsistent lengths or contents."
(located (obj2 (located (obj2
(req "firstStackType" stack_ty_enc) (req "first_stack_type" stack_ty_enc)
(req "otherStackType" stack_ty_enc))) (req "other_stack_type" stack_ty_enc)))
(function (function
| Unmatched_branches (loc, stya, styb) -> | Unmatched_branches (loc, stya, styb) ->
Some (loc, (stya, styb)) Some (loc, (stya, styb))
@ -404,7 +404,7 @@ let () =
~description: ~description:
"The type of a stack item is unexpected \ "The type of a stack item is unexpected \
(this error is always accompanied by a more precise one)." (this error is always accompanied by a more precise one)."
(obj1 (req "itemLevel" int16)) (obj1 (req "item_level" int16))
(function (function
| Bad_stack_item n -> Some n | Bad_stack_item n -> Some n
| _ -> None) | _ -> None)
@ -446,8 +446,8 @@ let () =
~description: ~description:
"A data expression was invalid for its expected type." "A data expression was invalid for its expected type."
(located (obj2 (located (obj2
(req "expectedType" Script.expr_encoding) (req "expected_type" Script.expr_encoding)
(req "wrongExpression" Script.expr_encoding))) (req "wrong_expression" Script.expr_encoding)))
(function (function
| Invalid_constant (loc, expr, ty) -> | Invalid_constant (loc, expr, ty) ->
Some (loc, (ty, expr)) Some (loc, (ty, expr))
@ -477,7 +477,7 @@ let () =
~description: ~description:
"A non comparable type was used in a place where \ "A non comparable type was used in a place where \
only comparable types are accepted." only comparable types are accepted."
(located (obj1 (req "wrongType" Script.expr_encoding))) (located (obj1 (req "wrong_type" Script.expr_encoding)))
(function (function
| Comparable_type_expected (loc, ty) -> Some (loc, ty) | Comparable_type_expected (loc, ty) -> Some (loc, ty)
| _ -> None) | _ -> None)
@ -494,8 +494,8 @@ let () =
two types have to be proven, it is always accompanied \ two types have to be proven, it is always accompanied \
with another error that provides more context." with another error that provides more context."
(obj2 (obj2
(req "firstType" Script.expr_encoding) (req "first_type" Script.expr_encoding)
(req "otherType" Script.expr_encoding)) (req "other_type" Script.expr_encoding))
(function (function
| Inconsistent_types (tya, tyb) -> Some (tya, tyb) | Inconsistent_types (tya, tyb) -> Some (tya, tyb)
| _ -> None) | _ -> None)
@ -510,7 +510,7 @@ let () =
"The body of a map block did not match the expected type" "The body of a map block did not match the expected type"
(obj2 (obj2
(req "loc" Script.location_encoding) (req "loc" Script.location_encoding)
(req "bodyType" stack_ty_enc)) (req "body_type" stack_ty_enc))
(function (function
| Invalid_map_body (loc, stack) -> Some (loc, stack) | Invalid_map_body (loc, stack) -> Some (loc, stack)
| _ -> None) | _ -> None)
@ -537,8 +537,8 @@ let () =
the ITER." the ITER."
(obj3 (obj3
(req "loc" Script.location_encoding) (req "loc" Script.location_encoding)
(req "befStack" stack_ty_enc) (req "bef_stack" stack_ty_enc)
(req "aftStack" stack_ty_enc)) (req "aft_stack" stack_ty_enc))
(function (function
| Invalid_iter_body (loc, bef, aft) -> Some (loc, bef, aft) | Invalid_iter_body (loc, bef, aft) -> Some (loc, bef, aft)
| _ -> None) | _ -> None)
@ -551,8 +551,8 @@ let () =
~description:"An instruction generated a type larger than the limit." ~description:"An instruction generated a type larger than the limit."
(obj3 (obj3
(req "loc" Script.location_encoding) (req "loc" Script.location_encoding)
(req "typeSize" uint16) (req "type_size" uint16)
(req "maximumTypeSize" uint16)) (req "maximum_type_size" uint16))
(function (function
| Type_too_large (loc, ts, maxts) -> Some (loc, ts, maxts) | Type_too_large (loc, ts, maxts) -> Some (loc, ts, maxts)
| _ -> None) | _ -> None)
@ -569,8 +569,8 @@ let () =
(always followed by more precise errors)." (always followed by more precise errors)."
(obj3 (obj3
(opt "identifier" string) (opt "identifier" string)
(req "expectedType" Script.expr_encoding) (req "expected_type" Script.expr_encoding)
(req "illTypedExpression" Script.expr_encoding)) (req "ill_typed_expression" Script.expr_encoding))
(function (function
| Ill_typed_data (name, expr, ty) -> Some (name, ty, expr) | Ill_typed_data (name, expr, ty) -> Some (name, ty, expr)
| _ -> None) | _ -> None)
@ -585,7 +585,7 @@ let () =
(always followed by more precise errors)." (always followed by more precise errors)."
(obj3 (obj3
(opt "identifier" string) (opt "identifier" string)
(req "illFormedExpression" Script.expr_encoding) (req "ill_formed_expression" Script.expr_encoding)
(req "location" Script.location_encoding)) (req "location" Script.location_encoding))
(function (function
| Ill_formed_type (name, expr, loc) -> Some (name, expr, loc) | Ill_formed_type (name, expr, loc) -> Some (name, expr, loc)
@ -602,8 +602,8 @@ let () =
a contract code against given input, output and storage types \ a contract code against given input, output and storage types \
(always followed by more precise errors)." (always followed by more precise errors)."
(obj2 (obj2
(req "illTypedCode" Script.expr_encoding) (req "ill_typed_code" Script.expr_encoding)
(req "typeMap" type_map_enc)) (req "type_map" type_map_enc))
(function (function
| Ill_typed_contract (expr, type_map) -> | Ill_typed_contract (expr, type_map) ->
Some (expr, type_map) Some (expr, type_map)