From de08893bfc4e1634e90ad3e9227387886c9a3e74 Mon Sep 17 00:00:00 2001 From: Nicolas Phan Date: Mon, 24 Apr 2023 06:26:22 +0000 Subject: [PATCH] Underline red snippet output in no-color mode --- changelog/2547 | 7 + .../annotated_michelson_record.ml | 48 +++++++ .../annotated_michelson_variant.ml | 132 ++++++++++++++++++ src/bin/expect_tests/build_module_test.ml | 2 + src/bin/expect_tests/code_insertion.ml | 2 + src/bin/expect_tests/colour.ml | 3 + src/bin/expect_tests/contract_tests.ml | 92 ++++++++++++ src/bin/expect_tests/deep_pattern_matching.ml | 47 +++++++ src/bin/expect_tests/failwith_tests.ml | 1 + src/bin/expect_tests/get_scope.ml | 9 ++ .../expect_tests/get_scope_errors_warns.ml | 7 + src/bin/expect_tests/get_scope_regressions.ml | 4 + .../expect_tests/jsligo_unreachable_code.ml | 6 + src/bin/expect_tests/layout.ml | 8 ++ src/bin/expect_tests/let_destructuring.ml | 1 + src/bin/expect_tests/lexer_tests.ml | 23 +++ .../expect_tests/ligo_interpreter_tests.ml | 27 ++++ .../expect_tests/linear_pattern_matching.ml | 1 + src/bin/expect_tests/linearity_tests.ml | 5 + src/bin/expect_tests/michelson_or_tests.ml | 3 + src/bin/expect_tests/michelson_pair_test.ml | 8 ++ src/bin/expect_tests/module_restrict.ml | 4 + src/bin/expect_tests/no_color_underline.ml | 63 +++++++++ src/bin/expect_tests/package_management.ml | 3 + src/bin/expect_tests/parametric_types.ml | 5 + .../pattern_matching_anomalies.ml | 122 ++++++++++++++++ .../expect_tests/pattern_matching_jsligo.ml | 14 ++ src/bin/expect_tests/polymorphism.ml | 15 ++ src/bin/expect_tests/protocol_specific.ml | 3 + src/bin/expect_tests/regressions.ml | 2 + src/bin/expect_tests/reverse_app_operator.ml | 2 + .../switch_jsligo_syntax_error.ml | 7 + src/bin/expect_tests/syntax_error_tests.ml | 1 + src/bin/expect_tests/tail_rec_warning.ml | 69 +++++++++ .../top_level_binding_pattern_cameligo.ml | 26 ++++ .../top_level_binding_pattern_jsligo.ml | 6 + src/bin/expect_tests/transpilation.ml | 1 + src/bin/expect_tests/typer_error_tests.ml | 36 +++++ src/bin/expect_tests/vars_consts.ml | 6 + src/bin/expect_tests/view.ml | 5 + src/bin/expect_tests/warnings.ml | 17 +++ .../no_color_underline/one_line_error.mligo | 2 + .../several_lines_error.mligo | 5 + .../no_color_underline/two_lines_error.mligo | 3 + .../ligo-utils/simple-utils/snippet.ml | 21 ++- 45 files changed, 870 insertions(+), 4 deletions(-) create mode 100644 changelog/2547 create mode 100644 src/bin/expect_tests/no_color_underline.ml create mode 100644 src/test/contracts/no_color_underline/one_line_error.mligo create mode 100644 src/test/contracts/no_color_underline/several_lines_error.mligo create mode 100644 src/test/contracts/no_color_underline/two_lines_error.mligo diff --git a/changelog/2547 b/changelog/2547 new file mode 100644 index 0000000000..0964140d36 --- /dev/null +++ b/changelog/2547 @@ -0,0 +1,7 @@ + +author: nicolas.van.phan +description: "\\n\\nFor the following piece of code, with a string that has nothing to do here :\\n\\n\\n```\\nlet main {| I should be underlined in\\n error message with no-color and\\n I am a long message spreading\\n on 4 lines |} blah-blah\\n\\n```\\n\\n#### Before\\n\\n\\n```\\n> ligo compile contract --no-color contract.mligo\\nFile \"contract.mligo\", line 2, character 9 to line 5, character 15:\\n 1 | \\n 2 | let main {| I should be underlined in\\n 3 | error message with no-color and\\n 4 | I am a long message spreading\\n 5 | on 4 lines |} blah-blah\\nIll-formed value declaration.\\nAt this point, one of the following is expected:\\n * parameters as irrefutable patterns, e.g. variables, if defining a\\n function;\\n * the assignment symbol '=' followed by an expression;\\n * a type annotation starting with a colon ':';\\n * a comma ',' followed by another tuple component, if defining a\\n tuple.\\n\\n```\\n\\n#### After\\n\\n\\n```\\n> ligo compile contract --no-color contract.mligo\\nFile \"contract.mligo\", line 2, character 9 to line 5, character 15:\\n 1 | \\n 2 | let main {| I should be underlined in\\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\n 3 | error message with no-color and\\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\n 4 | I am a long message spreading\\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\n 5 | on 4 lines |} blah-blah\\n ^^^^^^^^^^^^^^^\\nIll-formed value declaration.\\nAt this point, one of the following is expected:\\n * parameters as irrefutable patterns, e.g. variables, if defining a\\n function;\\n * the assignment symbol '=' followed by an expression;\\n * a type annotation starting with a colon ':';\\n * a comma ',' followed by another tuple component, if defining a\\n tuple.\\n\\n```\\n\\n" +merge_request: '2547' +title: "Underline red snippet output in no-color mode" +type: added + \ No newline at end of file diff --git a/src/bin/expect_tests/annotated_michelson_record.ml b/src/bin/expect_tests/annotated_michelson_record.ml index 121a91e144..3818ff8b69 100644 --- a/src/bin/expect_tests/annotated_michelson_record.ml +++ b/src/bin/expect_tests/annotated_michelson_record.ml @@ -16,6 +16,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 33, characters 19-25: 32 | 33 | let main_comb_two (action : parameter) (store : comb_two ) : op_list * comb_two = + ^^^^^^ 34 | let o = store.foo in : Warning: unused variable "action". @@ -24,6 +25,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 38, characters 42-47: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three ) : op_list * comb_three = + ^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "store". @@ -32,6 +34,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 38, characters 21-27: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three ) : op_list * comb_three = + ^^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "action". @@ -40,6 +43,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 41, characters 20-26: 40 | 41 | let main_comb_five (action : parameter) (store : comb_five) : op_list * comb_five = + ^^^^^^ 42 | ([] : operation list), store : Warning: unused variable "action". @@ -60,6 +64,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 33, characters 19-25: 32 | 33 | let main_comb_two (action : parameter) (store : comb_two ) : op_list * comb_two = + ^^^^^^ 34 | let o = store.foo in : Warning: unused variable "action". @@ -68,6 +73,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 38, characters 42-47: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three ) : op_list * comb_three = + ^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "store". @@ -76,6 +82,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 38, characters 21-27: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three ) : op_list * comb_three = + ^^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "action". @@ -84,6 +91,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 41, characters 20-26: 40 | 41 | let main_comb_five (action : parameter) (store : comb_five) : op_list * comb_five = + ^^^^^^ 42 | ([] : operation list), store : Warning: unused variable "action". @@ -110,6 +118,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 33, characters 19-25: 32 | 33 | let main_comb_two (action : parameter) (store : comb_two ) : op_list * comb_two = + ^^^^^^ 34 | let o = store.foo in : Warning: unused variable "action". @@ -118,6 +127,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 38, characters 42-47: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three ) : op_list * comb_three = + ^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "store". @@ -126,6 +136,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 38, characters 21-27: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three ) : op_list * comb_three = + ^^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "action". @@ -134,6 +145,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 41, characters 20-26: 40 | 41 | let main_comb_five (action : parameter) (store : comb_five) : op_list * comb_five = + ^^^^^^ 42 | ([] : operation list), store : Warning: unused variable "action". @@ -159,6 +171,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 33, characters 19-25: 32 | 33 | let main_comb_two (action : parameter) (store : comb_two ) : op_list * comb_two = + ^^^^^^ 34 | let o = store.foo in : Warning: unused variable "action". @@ -167,6 +180,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 38, characters 42-47: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three ) : op_list * comb_three = + ^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "store". @@ -175,6 +189,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 38, characters 21-27: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three ) : op_list * comb_three = + ^^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "action". @@ -183,6 +198,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 41, characters 20-26: 40 | 41 | let main_comb_five (action : parameter) (store : comb_five) : op_list * comb_five = + ^^^^^^ 42 | ([] : operation list), store : Warning: unused variable "action". @@ -203,6 +219,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 33, characters 19-25: 32 | 33 | let main_comb_two (action : parameter) (store : comb_two ) : op_list * comb_two = + ^^^^^^ 34 | let o = store.foo in : Warning: unused variable "action". @@ -211,6 +228,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 38, characters 42-47: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three ) : op_list * comb_three = + ^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "store". @@ -219,6 +237,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 38, characters 21-27: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three ) : op_list * comb_three = + ^^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "action". @@ -227,6 +246,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 41, characters 20-26: 40 | 41 | let main_comb_five (action : parameter) (store : comb_five) : op_list * comb_five = + ^^^^^^ 42 | ([] : operation list), store : Warning: unused variable "action". @@ -247,6 +267,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 33, characters 19-25: 32 | 33 | let main_comb_two (action : parameter) (store : comb_two ) : op_list * comb_two = + ^^^^^^ 34 | let o = store.foo in : Warning: unused variable "action". @@ -255,6 +276,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 38, characters 42-47: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three ) : op_list * comb_three = + ^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "store". @@ -263,6 +285,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 38, characters 21-27: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three ) : op_list * comb_three = + ^^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "action". @@ -271,6 +294,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_comb.mligo", line 41, characters 20-26: 40 | 41 | let main_comb_five (action : parameter) (store : comb_five) : op_list * comb_five = + ^^^^^^ 42 | ([] : operation list), store : Warning: unused variable "action". @@ -293,6 +317,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 33, characters 19-25: 32 | 33 | let main_comb_two (action : parameter) (store : comb_two) : op_list * comb_two = + ^^^^^^ 34 | let o = store.foo in : Warning: unused variable "action". @@ -301,6 +326,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 38, characters 42-47: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "store". @@ -309,6 +335,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 38, characters 21-27: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "action". @@ -317,6 +344,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 41, characters 20-26: 40 | 41 | let main_comb_five (action : parameter) (store : comb_five) : op_list * comb_five = + ^^^^^^ 42 | ([] : operation list), store : Warning: unused variable "action". @@ -337,6 +365,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 33, characters 19-25: 32 | 33 | let main_comb_two (action : parameter) (store : comb_two) : op_list * comb_two = + ^^^^^^ 34 | let o = store.foo in : Warning: unused variable "action". @@ -345,6 +374,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 38, characters 42-47: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "store". @@ -353,6 +383,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 38, characters 21-27: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "action". @@ -361,6 +392,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 41, characters 20-26: 40 | 41 | let main_comb_five (action : parameter) (store : comb_five) : op_list * comb_five = + ^^^^^^ 42 | ([] : operation list), store : Warning: unused variable "action". @@ -388,6 +420,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 33, characters 19-25: 32 | 33 | let main_comb_two (action : parameter) (store : comb_two) : op_list * comb_two = + ^^^^^^ 34 | let o = store.foo in : Warning: unused variable "action". @@ -396,6 +429,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 38, characters 42-47: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "store". @@ -404,6 +438,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 38, characters 21-27: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "action". @@ -412,6 +447,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 41, characters 20-26: 40 | 41 | let main_comb_five (action : parameter) (store : comb_five) : op_list * comb_five = + ^^^^^^ 42 | ([] : operation list), store : Warning: unused variable "action". @@ -438,6 +474,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 33, characters 19-25: 32 | 33 | let main_comb_two (action : parameter) (store : comb_two) : op_list * comb_two = + ^^^^^^ 34 | let o = store.foo in : Warning: unused variable "action". @@ -446,6 +483,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 38, characters 42-47: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "store". @@ -454,6 +492,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 38, characters 21-27: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "action". @@ -462,6 +501,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 41, characters 20-26: 40 | 41 | let main_comb_five (action : parameter) (store : comb_five) : op_list * comb_five = + ^^^^^^ 42 | ([] : operation list), store : Warning: unused variable "action". @@ -482,6 +522,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 33, characters 19-25: 32 | 33 | let main_comb_two (action : parameter) (store : comb_two) : op_list * comb_two = + ^^^^^^ 34 | let o = store.foo in : Warning: unused variable "action". @@ -490,6 +531,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 38, characters 42-47: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "store". @@ -498,6 +540,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 38, characters 21-27: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "action". @@ -506,6 +549,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 41, characters 20-26: 40 | 41 | let main_comb_five (action : parameter) (store : comb_five) : op_list * comb_five = + ^^^^^^ 42 | ([] : operation list), store : Warning: unused variable "action". @@ -526,6 +570,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 33, characters 19-25: 32 | 33 | let main_comb_two (action : parameter) (store : comb_two) : op_list * comb_two = + ^^^^^^ 34 | let o = store.foo in : Warning: unused variable "action". @@ -534,6 +579,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 38, characters 42-47: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "store". @@ -542,6 +588,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 38, characters 21-27: 37 | 38 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^^ 39 | ([] : operation list), { a = 1 ; b = "" ; c = 1n } : Warning: unused variable "action". @@ -550,6 +597,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_record_tree.mligo", line 41, characters 20-26: 40 | 41 | let main_comb_five (action : parameter) (store : comb_five) : op_list * comb_five = + ^^^^^^ 42 | ([] : operation list), store : Warning: unused variable "action". diff --git a/src/bin/expect_tests/annotated_michelson_variant.ml b/src/bin/expect_tests/annotated_michelson_variant.ml index 712f5dba00..57372cdbb2 100644 --- a/src/bin/expect_tests/annotated_michelson_variant.ml +++ b/src/bin/expect_tests/annotated_michelson_variant.ml @@ -24,6 +24,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 24, characters 10-11: 23 | | Foo i -> Bar "foo" 24 | | Bar j -> Foo 1 + ^ 25 | in : Warning: unused variable "j". @@ -32,6 +33,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 23, characters 10-11: 22 | let o = match store with 23 | | Foo i -> Bar "foo" + ^ 24 | | Bar j -> Foo 1 : Warning: unused variable "i". @@ -40,6 +42,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 21, characters 19-25: 20 | 21 | let main_comb_two (action, store : parameter * comb_two ) : op_list * comb_two = + ^^^^^^ 22 | let o = match store with : Warning: unused variable "action". @@ -48,6 +51,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 28, characters 21-27: 27 | 28 | let main_comb_three (action, store : parameter * comb_three ) : op_list * comb_three = + ^^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "action". @@ -56,6 +60,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 28, characters 29-34: 27 | 28 | let main_comb_three (action, store : parameter * comb_three ) : op_list * comb_three = + ^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "store". @@ -64,6 +69,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 38, characters 11-12: 37 | | Four a -> Two ("lol") 38 | | Five a -> One 1 + ^ 39 | in : Warning: unused variable "a". @@ -72,6 +78,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 37, characters 11-12: 36 | | Three a -> Three (true) 37 | | Four a -> Two ("lol") + ^ 38 | | Five a -> One 1 : Warning: unused variable "a". @@ -80,6 +87,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 36, characters 12-13: 35 | | Two a -> Four (2n) 36 | | Three a -> Three (true) + ^ 37 | | Four a -> Two ("lol") : Warning: unused variable "a". @@ -88,6 +96,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 35, characters 10-11: 34 | | One a -> Five (1) 35 | | Two a -> Four (2n) + ^ 36 | | Three a -> Three (true) : Warning: unused variable "a". @@ -96,6 +105,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 34, characters 10-11: 33 | let o = match store with 34 | | One a -> Five (1) + ^ 35 | | Two a -> Four (2n) : Warning: unused variable "a". @@ -104,6 +114,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 32, characters 20-26: 31 | 32 | let main_comb_five (action, store : parameter * comb_five ) : op_list * comb_five = + ^^^^^^ 33 | let o = match store with : Warning: unused variable "action". @@ -129,6 +140,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 24, characters 10-11: 23 | | Foo i -> Bar "foo" 24 | | Bar j -> Foo 1 + ^ 25 | in : Warning: unused variable "j". @@ -137,6 +149,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 23, characters 10-11: 22 | let o = match store with 23 | | Foo i -> Bar "foo" + ^ 24 | | Bar j -> Foo 1 : Warning: unused variable "i". @@ -145,6 +158,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 21, characters 19-25: 20 | 21 | let main_comb_two (action, store : parameter * comb_two ) : op_list * comb_two = + ^^^^^^ 22 | let o = match store with : Warning: unused variable "action". @@ -153,6 +167,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 28, characters 21-27: 27 | 28 | let main_comb_three (action, store : parameter * comb_three ) : op_list * comb_three = + ^^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "action". @@ -161,6 +176,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 28, characters 29-34: 27 | 28 | let main_comb_three (action, store : parameter * comb_three ) : op_list * comb_three = + ^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "store". @@ -169,6 +185,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 38, characters 11-12: 37 | | Four a -> Two ("lol") 38 | | Five a -> One 1 + ^ 39 | in : Warning: unused variable "a". @@ -177,6 +194,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 37, characters 11-12: 36 | | Three a -> Three (true) 37 | | Four a -> Two ("lol") + ^ 38 | | Five a -> One 1 : Warning: unused variable "a". @@ -185,6 +203,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 36, characters 12-13: 35 | | Two a -> Four (2n) 36 | | Three a -> Three (true) + ^ 37 | | Four a -> Two ("lol") : Warning: unused variable "a". @@ -193,6 +212,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 35, characters 10-11: 34 | | One a -> Five (1) 35 | | Two a -> Four (2n) + ^ 36 | | Three a -> Three (true) : Warning: unused variable "a". @@ -201,6 +221,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 34, characters 10-11: 33 | let o = match store with 34 | | One a -> Five (1) + ^ 35 | | Two a -> Four (2n) : Warning: unused variable "a". @@ -209,6 +230,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 32, characters 20-26: 31 | 32 | let main_comb_five (action, store : parameter * comb_five ) : op_list * comb_five = + ^^^^^^ 33 | let o = match store with : Warning: unused variable "action". @@ -229,6 +251,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 24, characters 10-11: 23 | | Foo i -> Bar "foo" 24 | | Bar j -> Foo 1 + ^ 25 | in : Warning: unused variable "j". @@ -237,6 +260,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 23, characters 10-11: 22 | let o = match store with 23 | | Foo i -> Bar "foo" + ^ 24 | | Bar j -> Foo 1 : Warning: unused variable "i". @@ -245,6 +269,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 21, characters 19-25: 20 | 21 | let main_comb_two (action, store : parameter * comb_two ) : op_list * comb_two = + ^^^^^^ 22 | let o = match store with : Warning: unused variable "action". @@ -253,6 +278,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 28, characters 21-27: 27 | 28 | let main_comb_three (action, store : parameter * comb_three ) : op_list * comb_three = + ^^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "action". @@ -261,6 +287,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 28, characters 29-34: 27 | 28 | let main_comb_three (action, store : parameter * comb_three ) : op_list * comb_three = + ^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "store". @@ -269,6 +296,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 38, characters 11-12: 37 | | Four a -> Two ("lol") 38 | | Five a -> One 1 + ^ 39 | in : Warning: unused variable "a". @@ -277,6 +305,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 37, characters 11-12: 36 | | Three a -> Three (true) 37 | | Four a -> Two ("lol") + ^ 38 | | Five a -> One 1 : Warning: unused variable "a". @@ -285,6 +314,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 36, characters 12-13: 35 | | Two a -> Four (2n) 36 | | Three a -> Three (true) + ^ 37 | | Four a -> Two ("lol") : Warning: unused variable "a". @@ -293,6 +323,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 35, characters 10-11: 34 | | One a -> Five (1) 35 | | Two a -> Four (2n) + ^ 36 | | Three a -> Three (true) : Warning: unused variable "a". @@ -301,6 +332,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 34, characters 10-11: 33 | let o = match store with 34 | | One a -> Five (1) + ^ 35 | | Two a -> Four (2n) : Warning: unused variable "a". @@ -309,6 +341,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 32, characters 20-26: 31 | 32 | let main_comb_five (action, store : parameter * comb_five ) : op_list * comb_five = + ^^^^^^ 33 | let o = match store with : Warning: unused variable "action". @@ -346,6 +379,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 24, characters 10-11: 23 | | Foo i -> Bar "foo" 24 | | Bar j -> Foo 1 + ^ 25 | in : Warning: unused variable "j". @@ -354,6 +388,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 23, characters 10-11: 22 | let o = match store with 23 | | Foo i -> Bar "foo" + ^ 24 | | Bar j -> Foo 1 : Warning: unused variable "i". @@ -362,6 +397,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 21, characters 19-25: 20 | 21 | let main_comb_two (action, store : parameter * comb_two ) : op_list * comb_two = + ^^^^^^ 22 | let o = match store with : Warning: unused variable "action". @@ -370,6 +406,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 28, characters 21-27: 27 | 28 | let main_comb_three (action, store : parameter * comb_three ) : op_list * comb_three = + ^^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "action". @@ -378,6 +415,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 28, characters 29-34: 27 | 28 | let main_comb_three (action, store : parameter * comb_three ) : op_list * comb_three = + ^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "store". @@ -386,6 +424,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 38, characters 11-12: 37 | | Four a -> Two ("lol") 38 | | Five a -> One 1 + ^ 39 | in : Warning: unused variable "a". @@ -394,6 +433,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 37, characters 11-12: 36 | | Three a -> Three (true) 37 | | Four a -> Two ("lol") + ^ 38 | | Five a -> One 1 : Warning: unused variable "a". @@ -402,6 +442,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 36, characters 12-13: 35 | | Two a -> Four (2n) 36 | | Three a -> Three (true) + ^ 37 | | Four a -> Two ("lol") : Warning: unused variable "a". @@ -410,6 +451,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 35, characters 10-11: 34 | | One a -> Five (1) 35 | | Two a -> Four (2n) + ^ 36 | | Three a -> Three (true) : Warning: unused variable "a". @@ -418,6 +460,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 34, characters 10-11: 33 | let o = match store with 34 | | One a -> Five (1) + ^ 35 | | Two a -> Four (2n) : Warning: unused variable "a". @@ -426,6 +469,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 32, characters 20-26: 31 | 32 | let main_comb_five (action, store : parameter * comb_five ) : op_list * comb_five = + ^^^^^^ 33 | let o = match store with : Warning: unused variable "action". @@ -446,6 +490,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 24, characters 10-11: 23 | | Foo i -> Bar "foo" 24 | | Bar j -> Foo 1 + ^ 25 | in : Warning: unused variable "j". @@ -454,6 +499,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 23, characters 10-11: 22 | let o = match store with 23 | | Foo i -> Bar "foo" + ^ 24 | | Bar j -> Foo 1 : Warning: unused variable "i". @@ -462,6 +508,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 21, characters 19-25: 20 | 21 | let main_comb_two (action, store : parameter * comb_two ) : op_list * comb_two = + ^^^^^^ 22 | let o = match store with : Warning: unused variable "action". @@ -470,6 +517,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 28, characters 21-27: 27 | 28 | let main_comb_three (action, store : parameter * comb_three ) : op_list * comb_three = + ^^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "action". @@ -478,6 +526,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 28, characters 29-34: 27 | 28 | let main_comb_three (action, store : parameter * comb_three ) : op_list * comb_three = + ^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "store". @@ -486,6 +535,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 38, characters 11-12: 37 | | Four a -> Two ("lol") 38 | | Five a -> One 1 + ^ 39 | in : Warning: unused variable "a". @@ -494,6 +544,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 37, characters 11-12: 36 | | Three a -> Three (true) 37 | | Four a -> Two ("lol") + ^ 38 | | Five a -> One 1 : Warning: unused variable "a". @@ -502,6 +553,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 36, characters 12-13: 35 | | Two a -> Four (2n) 36 | | Three a -> Three (true) + ^ 37 | | Four a -> Two ("lol") : Warning: unused variable "a". @@ -510,6 +562,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 35, characters 10-11: 34 | | One a -> Five (1) 35 | | Two a -> Four (2n) + ^ 36 | | Three a -> Three (true) : Warning: unused variable "a". @@ -518,6 +571,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 34, characters 10-11: 33 | let o = match store with 34 | | One a -> Five (1) + ^ 35 | | Two a -> Four (2n) : Warning: unused variable "a". @@ -526,6 +580,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 32, characters 20-26: 31 | 32 | let main_comb_five (action, store : parameter * comb_five ) : op_list * comb_five = + ^^^^^^ 33 | let o = match store with : Warning: unused variable "action". @@ -546,6 +601,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 24, characters 10-11: 23 | | Foo i -> Bar "foo" 24 | | Bar j -> Foo 1 + ^ 25 | in : Warning: unused variable "j". @@ -554,6 +610,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 23, characters 10-11: 22 | let o = match store with 23 | | Foo i -> Bar "foo" + ^ 24 | | Bar j -> Foo 1 : Warning: unused variable "i". @@ -562,6 +619,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 21, characters 19-25: 20 | 21 | let main_comb_two (action, store : parameter * comb_two ) : op_list * comb_two = + ^^^^^^ 22 | let o = match store with : Warning: unused variable "action". @@ -570,6 +628,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 28, characters 21-27: 27 | 28 | let main_comb_three (action, store : parameter * comb_three ) : op_list * comb_three = + ^^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "action". @@ -578,6 +637,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 28, characters 29-34: 27 | 28 | let main_comb_three (action, store : parameter * comb_three ) : op_list * comb_three = + ^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "store". @@ -586,6 +646,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 38, characters 11-12: 37 | | Four a -> Two ("lol") 38 | | Five a -> One 1 + ^ 39 | in : Warning: unused variable "a". @@ -594,6 +655,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 37, characters 11-12: 36 | | Three a -> Three (true) 37 | | Four a -> Two ("lol") + ^ 38 | | Five a -> One 1 : Warning: unused variable "a". @@ -602,6 +664,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 36, characters 12-13: 35 | | Two a -> Four (2n) 36 | | Three a -> Three (true) + ^ 37 | | Four a -> Two ("lol") : Warning: unused variable "a". @@ -610,6 +673,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 35, characters 10-11: 34 | | One a -> Five (1) 35 | | Two a -> Four (2n) + ^ 36 | | Three a -> Three (true) : Warning: unused variable "a". @@ -618,6 +682,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 34, characters 10-11: 33 | let o = match store with 34 | | One a -> Five (1) + ^ 35 | | Two a -> Four (2n) : Warning: unused variable "a". @@ -626,6 +691,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_comb.mligo", line 32, characters 20-26: 31 | 32 | let main_comb_five (action, store : parameter * comb_five ) : op_list * comb_five = + ^^^^^^ 33 | let o = match store with : Warning: unused variable "action". @@ -647,6 +713,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 24, characters 10-11: 23 | | Foo i -> Bar "foo" 24 | | Bar j -> Foo 1 + ^ 25 | in : Warning: unused variable "j". @@ -655,6 +722,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 23, characters 10-11: 22 | let o = match store with 23 | | Foo i -> Bar "foo" + ^ 24 | | Bar j -> Foo 1 : Warning: unused variable "i". @@ -663,6 +731,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 21, characters 19-25: 20 | 21 | let main_comb_two (action : parameter) (store : comb_two) : op_list * comb_two = + ^^^^^^ 22 | let o = match store with : Warning: unused variable "action". @@ -671,6 +740,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 28, characters 42-47: 27 | 28 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "store". @@ -679,6 +749,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 28, characters 21-27: 27 | 28 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "action". @@ -687,6 +758,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 38, characters 11-12: 37 | | Four a -> Two ("lol") 38 | | Five a -> One 1 + ^ 39 | in : Warning: unused variable "a". @@ -695,6 +767,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 37, characters 11-12: 36 | | Three a -> Three (true) 37 | | Four a -> Two ("lol") + ^ 38 | | Five a -> One 1 : Warning: unused variable "a". @@ -703,6 +776,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 36, characters 12-13: 35 | | Two a -> Four (2n) 36 | | Three a -> Three (true) + ^ 37 | | Four a -> Two ("lol") : Warning: unused variable "a". @@ -711,6 +785,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 35, characters 10-11: 34 | | One a -> Five (1) 35 | | Two a -> Four (2n) + ^ 36 | | Three a -> Three (true) : Warning: unused variable "a". @@ -719,6 +794,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 34, characters 10-11: 33 | let o = match store with 34 | | One a -> Five (1) + ^ 35 | | Two a -> Four (2n) : Warning: unused variable "a". @@ -727,6 +803,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 32, characters 20-26: 31 | 32 | let main_comb_five (action : parameter) (store : comb_five) : op_list * comb_five = + ^^^^^^ 33 | let o = match store with : Warning: unused variable "action". @@ -752,6 +829,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 24, characters 10-11: 23 | | Foo i -> Bar "foo" 24 | | Bar j -> Foo 1 + ^ 25 | in : Warning: unused variable "j". @@ -760,6 +838,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 23, characters 10-11: 22 | let o = match store with 23 | | Foo i -> Bar "foo" + ^ 24 | | Bar j -> Foo 1 : Warning: unused variable "i". @@ -768,6 +847,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 21, characters 19-25: 20 | 21 | let main_comb_two (action : parameter) (store : comb_two) : op_list * comb_two = + ^^^^^^ 22 | let o = match store with : Warning: unused variable "action". @@ -776,6 +856,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 28, characters 42-47: 27 | 28 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "store". @@ -784,6 +865,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 28, characters 21-27: 27 | 28 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "action". @@ -792,6 +874,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 38, characters 11-12: 37 | | Four a -> Two ("lol") 38 | | Five a -> One 1 + ^ 39 | in : Warning: unused variable "a". @@ -800,6 +883,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 37, characters 11-12: 36 | | Three a -> Three (true) 37 | | Four a -> Two ("lol") + ^ 38 | | Five a -> One 1 : Warning: unused variable "a". @@ -808,6 +892,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 36, characters 12-13: 35 | | Two a -> Four (2n) 36 | | Three a -> Three (true) + ^ 37 | | Four a -> Two ("lol") : Warning: unused variable "a". @@ -816,6 +901,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 35, characters 10-11: 34 | | One a -> Five (1) 35 | | Two a -> Four (2n) + ^ 36 | | Three a -> Three (true) : Warning: unused variable "a". @@ -824,6 +910,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 34, characters 10-11: 33 | let o = match store with 34 | | One a -> Five (1) + ^ 35 | | Two a -> Four (2n) : Warning: unused variable "a". @@ -832,6 +919,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 32, characters 20-26: 31 | 32 | let main_comb_five (action : parameter) (store : comb_five) : op_list * comb_five = + ^^^^^^ 33 | let o = match store with : Warning: unused variable "action". @@ -852,6 +940,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 24, characters 10-11: 23 | | Foo i -> Bar "foo" 24 | | Bar j -> Foo 1 + ^ 25 | in : Warning: unused variable "j". @@ -860,6 +949,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 23, characters 10-11: 22 | let o = match store with 23 | | Foo i -> Bar "foo" + ^ 24 | | Bar j -> Foo 1 : Warning: unused variable "i". @@ -868,6 +958,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 21, characters 19-25: 20 | 21 | let main_comb_two (action : parameter) (store : comb_two) : op_list * comb_two = + ^^^^^^ 22 | let o = match store with : Warning: unused variable "action". @@ -876,6 +967,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 28, characters 42-47: 27 | 28 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "store". @@ -884,6 +976,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 28, characters 21-27: 27 | 28 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "action". @@ -892,6 +985,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 38, characters 11-12: 37 | | Four a -> Two ("lol") 38 | | Five a -> One 1 + ^ 39 | in : Warning: unused variable "a". @@ -900,6 +994,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 37, characters 11-12: 36 | | Three a -> Three (true) 37 | | Four a -> Two ("lol") + ^ 38 | | Five a -> One 1 : Warning: unused variable "a". @@ -908,6 +1003,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 36, characters 12-13: 35 | | Two a -> Four (2n) 36 | | Three a -> Three (true) + ^ 37 | | Four a -> Two ("lol") : Warning: unused variable "a". @@ -916,6 +1012,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 35, characters 10-11: 34 | | One a -> Five (1) 35 | | Two a -> Four (2n) + ^ 36 | | Three a -> Three (true) : Warning: unused variable "a". @@ -924,6 +1021,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 34, characters 10-11: 33 | let o = match store with 34 | | One a -> Five (1) + ^ 35 | | Two a -> Four (2n) : Warning: unused variable "a". @@ -932,6 +1030,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 32, characters 20-26: 31 | 32 | let main_comb_five (action : parameter) (store : comb_five) : op_list * comb_five = + ^^^^^^ 33 | let o = match store with : Warning: unused variable "action". @@ -970,6 +1069,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 24, characters 10-11: 23 | | Foo i -> Bar "foo" 24 | | Bar j -> Foo 1 + ^ 25 | in : Warning: unused variable "j". @@ -978,6 +1078,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 23, characters 10-11: 22 | let o = match store with 23 | | Foo i -> Bar "foo" + ^ 24 | | Bar j -> Foo 1 : Warning: unused variable "i". @@ -986,6 +1087,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 21, characters 19-25: 20 | 21 | let main_comb_two (action : parameter) (store : comb_two) : op_list * comb_two = + ^^^^^^ 22 | let o = match store with : Warning: unused variable "action". @@ -994,6 +1096,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 28, characters 42-47: 27 | 28 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "store". @@ -1002,6 +1105,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 28, characters 21-27: 27 | 28 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "action". @@ -1010,6 +1114,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 38, characters 11-12: 37 | | Four a -> Two ("lol") 38 | | Five a -> One 1 + ^ 39 | in : Warning: unused variable "a". @@ -1018,6 +1123,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 37, characters 11-12: 36 | | Three a -> Three (true) 37 | | Four a -> Two ("lol") + ^ 38 | | Five a -> One 1 : Warning: unused variable "a". @@ -1026,6 +1132,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 36, characters 12-13: 35 | | Two a -> Four (2n) 36 | | Three a -> Three (true) + ^ 37 | | Four a -> Two ("lol") : Warning: unused variable "a". @@ -1034,6 +1141,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 35, characters 10-11: 34 | | One a -> Five (1) 35 | | Two a -> Four (2n) + ^ 36 | | Three a -> Three (true) : Warning: unused variable "a". @@ -1042,6 +1150,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 34, characters 10-11: 33 | let o = match store with 34 | | One a -> Five (1) + ^ 35 | | Two a -> Four (2n) : Warning: unused variable "a". @@ -1050,6 +1159,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 32, characters 20-26: 31 | 32 | let main_comb_five (action : parameter) (store : comb_five) : op_list * comb_five = + ^^^^^^ 33 | let o = match store with : Warning: unused variable "action". @@ -1070,6 +1180,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 24, characters 10-11: 23 | | Foo i -> Bar "foo" 24 | | Bar j -> Foo 1 + ^ 25 | in : Warning: unused variable "j". @@ -1078,6 +1189,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 23, characters 10-11: 22 | let o = match store with 23 | | Foo i -> Bar "foo" + ^ 24 | | Bar j -> Foo 1 : Warning: unused variable "i". @@ -1086,6 +1198,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 21, characters 19-25: 20 | 21 | let main_comb_two (action : parameter) (store : comb_two) : op_list * comb_two = + ^^^^^^ 22 | let o = match store with : Warning: unused variable "action". @@ -1094,6 +1207,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 28, characters 42-47: 27 | 28 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "store". @@ -1102,6 +1216,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 28, characters 21-27: 27 | 28 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "action". @@ -1110,6 +1225,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 38, characters 11-12: 37 | | Four a -> Two ("lol") 38 | | Five a -> One 1 + ^ 39 | in : Warning: unused variable "a". @@ -1118,6 +1234,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 37, characters 11-12: 36 | | Three a -> Three (true) 37 | | Four a -> Two ("lol") + ^ 38 | | Five a -> One 1 : Warning: unused variable "a". @@ -1126,6 +1243,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 36, characters 12-13: 35 | | Two a -> Four (2n) 36 | | Three a -> Three (true) + ^ 37 | | Four a -> Two ("lol") : Warning: unused variable "a". @@ -1134,6 +1252,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 35, characters 10-11: 34 | | One a -> Five (1) 35 | | Two a -> Four (2n) + ^ 36 | | Three a -> Three (true) : Warning: unused variable "a". @@ -1142,6 +1261,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 34, characters 10-11: 33 | let o = match store with 34 | | One a -> Five (1) + ^ 35 | | Two a -> Four (2n) : Warning: unused variable "a". @@ -1150,6 +1270,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 32, characters 20-26: 31 | 32 | let main_comb_five (action : parameter) (store : comb_five) : op_list * comb_five = + ^^^^^^ 33 | let o = match store with : Warning: unused variable "action". @@ -1170,6 +1291,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 24, characters 10-11: 23 | | Foo i -> Bar "foo" 24 | | Bar j -> Foo 1 + ^ 25 | in : Warning: unused variable "j". @@ -1178,6 +1300,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 23, characters 10-11: 22 | let o = match store with 23 | | Foo i -> Bar "foo" + ^ 24 | | Bar j -> Foo 1 : Warning: unused variable "i". @@ -1186,6 +1309,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 21, characters 19-25: 20 | 21 | let main_comb_two (action : parameter) (store : comb_two) : op_list * comb_two = + ^^^^^^ 22 | let o = match store with : Warning: unused variable "action". @@ -1194,6 +1318,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 28, characters 42-47: 27 | 28 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "store". @@ -1202,6 +1327,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 28, characters 21-27: 27 | 28 | let main_comb_three (action : parameter) (store : comb_three) : op_list * comb_three = + ^^^^^^ 29 | let o = (C 1n) in : Warning: unused variable "action". @@ -1210,6 +1336,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 38, characters 11-12: 37 | | Four a -> Two ("lol") 38 | | Five a -> One 1 + ^ 39 | in : Warning: unused variable "a". @@ -1218,6 +1345,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 37, characters 11-12: 36 | | Three a -> Three (true) 37 | | Four a -> Two ("lol") + ^ 38 | | Five a -> One 1 : Warning: unused variable "a". @@ -1226,6 +1354,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 36, characters 12-13: 35 | | Two a -> Four (2n) 36 | | Three a -> Three (true) + ^ 37 | | Four a -> Two ("lol") : Warning: unused variable "a". @@ -1234,6 +1363,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 35, characters 10-11: 34 | | One a -> Five (1) 35 | | Two a -> Four (2n) + ^ 36 | | Three a -> Three (true) : Warning: unused variable "a". @@ -1242,6 +1372,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 34, characters 10-11: 33 | let o = match store with 34 | | One a -> Five (1) + ^ 35 | | Two a -> Four (2n) : Warning: unused variable "a". @@ -1250,6 +1381,7 @@ let%expect_test _ = File "../../test/contracts/annotated_michelson_variant_tree.mligo", line 32, characters 20-26: 31 | 32 | let main_comb_five (action : parameter) (store : comb_five) : op_list * comb_five = + ^^^^^^ 33 | let o = match store with : Warning: unused variable "action". diff --git a/src/bin/expect_tests/build_module_test.ml b/src/bin/expect_tests/build_module_test.ml index 70fa5fdc59..53b5009a73 100644 --- a/src/bin/expect_tests/build_module_test.ml +++ b/src/bin/expect_tests/build_module_test.ml @@ -149,6 +149,7 @@ let%expect_test _ = File "../../test/contracts/build/type_B.mligo", line 5, characters 5-6: 4 | \tlet s = s + 1 in 5 | \tlet p = p ^ "titi" in + ^ 6 | \t([] : operation list), s : Warning: unused variable "p". @@ -201,5 +202,6 @@ let%expect_test _ = File "../../test/contracts/build/module_scoping_bug.mligo", line 24, characters 8-13: 23 | 24 | let x = B.A.a + ^^^^^ Module "B.A" not found. |}] diff --git a/src/bin/expect_tests/code_insertion.ml b/src/bin/expect_tests/code_insertion.ml index 43cf1ad47b..80cd7f45c0 100644 --- a/src/bin/expect_tests/code_insertion.ml +++ b/src/bin/expect_tests/code_insertion.ml @@ -13,6 +13,7 @@ let%expect_test _ = File "../../test/contracts/negative/bad_michelson_insertion_1.mligo", line 4, characters 29-72: 3 | let main (p : nat) (s : nat) : operation list * nat = 4 | let f : nat * nat -> nat = [%Michelson ({| ADD |} : nat * nat -> nat)] + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 5 | in [], f (p, s) Raw Michelson must be seq (with curly braces {}), got: ADD. |test}] @@ -24,6 +25,7 @@ let%expect_test _ = File "../../test/contracts/negative/bad_michelson_insertion_2.mligo", line 5, characters 12-16: 4 | let f : nat -> nat -> nat = [%Michelson ({| ADD |} : nat -> nat -> nat)] 5 | in [], f (p, s) + ^^^^ Invalid type(s) Cannot unify "( nat * nat )" with "nat". |test}] diff --git a/src/bin/expect_tests/colour.ml b/src/bin/expect_tests/colour.ml index 9ad7b27a4a..1ded3c3f65 100644 --- a/src/bin/expect_tests/colour.ml +++ b/src/bin/expect_tests/colour.ml @@ -46,6 +46,7 @@ let%expect_test _ = File "../../test/contracts/negative/colour.mligo", line 6, characters 16-25: 5 | let main (p : unit) (s : storage) : return = 6 | let x : nat = 1 + 2 + 3 (* int *) in + ^^^^^^^^^ 7 | [],s Invalid type(s) @@ -85,6 +86,7 @@ let%expect_test _ = File "../../test/contracts/negative/colour_test.mligo", line 3, characters 12-31: 2 | let test1 = Test.assert (1 = 1) 3 | let test2 = Test.assert (1 = 2) + ^^^^^^^^^^^^^^^^^^^ Test failed with "failed assertion" Trace: @@ -124,6 +126,7 @@ let%expect_test _ = File "../../test/contracts/negative/colour.mligo", line 6, characters 16-25: 5 | let main (p : unit) (s : storage) : return = 6 | let x : nat = 1 + 2 + 3 (* int *) in + ^^^^^^^^^ 7 | [],s Invalid type(s) diff --git a/src/bin/expect_tests/contract_tests.ml b/src/bin/expect_tests/contract_tests.ml index 2d4c03bd82..256a0333ea 100644 --- a/src/bin/expect_tests/contract_tests.ml +++ b/src/bin/expect_tests/contract_tests.ml @@ -31,6 +31,7 @@ let%expect_test _ = {| File "../../test/contracts/const.mligo", line 1, characters 31-32: 1 | let const = fun (type a b) (a, b : a * b) : a -> a + ^ 2 | : Warning: unused variable "b". @@ -227,6 +228,7 @@ let%expect_test _ = File "../../test/contracts/ticket_builder.mligo", line 28, characters 28-34: 27 | begin 28 | let ((ticketer, _), ticket) = (Tezos.read_ticket ticket : (address * (unit * nat)) * unit ticket) in + ^^^^^^ 29 | assert (ticketer = Tezos.get_self_address ()); : Warning: unused variable "ticket". @@ -281,6 +283,7 @@ let%expect_test _ = File "../../test/contracts/implicit.mligo", line 2, characters 6-7: 1 | let main2 (p : key_hash) (s : unit) = 2 | let c : unit contract = Tezos.implicit_account p + ^ 3 | in ([] : operation list), unit : Warning: unused variable "c". @@ -288,6 +291,7 @@ let%expect_test _ = File "../../test/contracts/implicit.mligo", line 1, characters 26-27: 1 | let main2 (p : key_hash) (s : unit) = + ^ 2 | let c : unit contract = Tezos.implicit_account p : Warning: unused variable "s". @@ -304,7 +308,9 @@ let%expect_test _ = File "../../test/contracts/negative/capture_big_map.mligo", line 12, character 2 to line 13, character 17: 11 | 12 | let supply (ledger:l) (_:nat) = + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 13 | ledger.supply + ^^^^^^^^^^^^^^^^^ 14 | Invalid capturing, term captures the type big_map (address , @@ -357,6 +363,7 @@ let%expect_test _ = File "../../test/contracts/amount_lambda.mligo", line 4, characters 7-8: 3 | let amt : tez = Tezos.get_amount () in 4 | fun (x : unit) -> amt + ^ 5 | : Warning: unused variable "x". @@ -365,6 +372,7 @@ let%expect_test _ = File "../../test/contracts/amount_lambda.mligo", line 2, characters 8-9: 1 | (* should return a constant function *) 2 | let f1 (x : unit) : unit -> tez = + ^ 3 | let amt : tez = Tezos.get_amount () in : Warning: unused variable "x". @@ -373,6 +381,7 @@ let%expect_test _ = File "../../test/contracts/amount_lambda.mligo", line 8, characters 7-8: 7 | let f2 (x : unit) : unit -> tez = 8 | fun (x : unit) -> Tezos.get_amount () + ^ 9 | : Warning: unused variable "x". @@ -381,6 +390,7 @@ let%expect_test _ = File "../../test/contracts/amount_lambda.mligo", line 7, characters 8-9: 6 | (* should return an impure function *) 7 | let f2 (x : unit) : unit -> tez = + ^ 8 | fun (x : unit) -> Tezos.get_amount () : Warning: unused variable "x". @@ -389,6 +399,7 @@ let%expect_test _ = File "../../test/contracts/amount_lambda.mligo", line 10, characters 21-22: 9 | 10 | let main (b : bool) (s : (unit -> tez)) : operation list * (unit -> tez) = + ^ 11 | (([] : operation list), (if b then f1 () else f2 ())) : Warning: unused variable "s". @@ -413,6 +424,7 @@ let%expect_test _ = {| File "../../test/contracts/subtle_nontail_fail.mligo", line 1, characters 10-12: 1 | let main (ps : unit * unit) : operation list * unit = + ^^ 2 | if true : Warning: unused variable "ps". @@ -432,6 +444,7 @@ let%expect_test _ = {| File "../../test/contracts/subtle_nontail_fail.mligo", line 1, characters 10-12: 1 | let main (ps : unit * unit) : operation list * unit = + ^^ 2 | if true : Warning: unused variable "ps". @@ -455,11 +468,13 @@ let%expect_test _ = {| File "../../test/contracts/negative/not_comparable.mligo", line 1, characters 16-23: 1 | let main (_u : (int set) set) (s : unit) : operation list * unit = ([] : operation list), s + ^^^^^^^ 2 | This type is used inside: File "../../test/contracts/negative/not_comparable.mligo", line 1, characters 15-28: 1 | let main (_u : (int set) set) (s : unit) : operation list * unit = ([] : operation list), s + ^^^^^^^^^^^^^ 2 | The set constructor needs a comparable type argument, but it was given a non-comparable one. |}] @@ -472,11 +487,13 @@ let%expect_test _ = File "../../test/contracts/negative/not_comparable.mligo", line 3, characters 17-24: 2 | 3 | let main2 (_u : (int set) ticket) (s : unit) : operation list * unit = ([] : operation list), s + ^^^^^^^ This type is used inside: File "../../test/contracts/negative/not_comparable.mligo", line 3, characters 16-32: 2 | 3 | let main2 (_u : (int set) ticket) (s : unit) : operation list * unit = ([] : operation list), s + ^^^^^^^^^^^^^^^^ The ticket constructor needs a comparable type argument, but it was given a non-comparable one. |}] @@ -515,10 +532,15 @@ let%expect_test _ = File "../../test/contracts/negative/create_contract_toplevel.mligo", line 4, character 35 to line 8, character 8: 3 | let main (_ : string) (store : string) : return = 4 | let toto : operation * address = Tezos.create_contract + ^^^^^^^^^^^^^^^^^^^^^ 5 | (fun (_p : nat) (_s : string) -> (([] : operation list), store)) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 6 | (None: key_hash option) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 7 | 300tz + ^^^^^^^^^^ 8 | "un" + ^^^^^^^^ 9 | in Not all free variables could be inlined in Tezos.create_contract usage: gen#34. |}]; @@ -528,6 +550,7 @@ Not all free variables could be inlined in Tezos.create_contract usage: gen#34. File "../../test/contracts/create_contract_var.mligo", line 7, characters 20-21: 6 | let toto : operation * address = Tezos.create_contract 7 | (fun (p : nat) (s : int) -> (([] : operation list), a)) + ^ 8 | (None: key_hash option) : Warning: unused variable "s". @@ -536,6 +559,7 @@ Not all free variables could be inlined in Tezos.create_contract usage: gen#34. File "../../test/contracts/create_contract_var.mligo", line 7, characters 10-11: 6 | let toto : operation * address = Tezos.create_contract 7 | (fun (p : nat) (s : int) -> (([] : operation list), a)) + ^ 8 | (None: key_hash option) : Warning: unused variable "p". @@ -544,6 +568,7 @@ Not all free variables could be inlined in Tezos.create_contract usage: gen#34. File "../../test/contracts/create_contract_var.mligo", line 5, characters 10-16: 4 | 5 | let main (action : string) (store : string) : return = + ^^^^^^ 6 | let toto : operation * address = Tezos.create_contract : Warning: unused variable "action". @@ -572,6 +597,7 @@ Not all free variables could be inlined in Tezos.create_contract usage: gen#34. File "../../test/contracts/negative/create_contract_modfv.mligo", line 8, characters 20-21: 7 | let toto : operation * address = Tezos.create_contract 8 | (fun (p : nat) (s : string) -> (([] : operation list), Foo.store)) + ^ 9 | (None: key_hash option) : Warning: unused variable "s". @@ -580,6 +606,7 @@ Not all free variables could be inlined in Tezos.create_contract usage: gen#34. File "../../test/contracts/negative/create_contract_modfv.mligo", line 8, characters 10-11: 7 | let toto : operation * address = Tezos.create_contract 8 | (fun (p : nat) (s : string) -> (([] : operation list), Foo.store)) + ^ 9 | (None: key_hash option) : Warning: unused variable "p". @@ -588,6 +615,7 @@ Not all free variables could be inlined in Tezos.create_contract usage: gen#34. File "../../test/contracts/negative/create_contract_modfv.mligo", line 3, characters 10-16: 2 | 3 | let main (action : string) (store : string) : return = + ^^^^^^ 4 | module Foo = struct : Warning: unused variable "action". @@ -596,10 +624,15 @@ Not all free variables could be inlined in Tezos.create_contract usage: gen#34. File "../../test/contracts/negative/create_contract_modfv.mligo", line 7, character 35 to line 11, character 8: 6 | end in 7 | let toto : operation * address = Tezos.create_contract + ^^^^^^^^^^^^^^^^^^^^^ 8 | (fun (p : nat) (s : string) -> (([] : operation list), Foo.store)) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | (None: key_hash option) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | 300tz + ^^^^^^^^^^ 11 | "un" + ^^^^^^^^ 12 | in Not all free variables could be inlined in Tezos.create_contract usage: gen#35. |}]; @@ -609,6 +642,7 @@ Not all free variables could be inlined in Tezos.create_contract usage: gen#34. File "../../test/contracts/negative/create_contract_no_inline.mligo", line 5, characters 30-31: 4 | 5 | let dummy_contract (p : nat) (s : int) : return = + ^ 6 | (([] : operation list), foo) : Warning: unused variable "s". @@ -617,6 +651,7 @@ Not all free variables could be inlined in Tezos.create_contract usage: gen#34. File "../../test/contracts/negative/create_contract_no_inline.mligo", line 5, characters 20-21: 4 | 5 | let dummy_contract (p : nat) (s : int) : return = + ^ 6 | (([] : operation list), foo) : Warning: unused variable "p". @@ -625,6 +660,7 @@ Not all free variables could be inlined in Tezos.create_contract usage: gen#34. File "../../test/contracts/negative/create_contract_no_inline.mligo", line 9, characters 11-15: 8 | let main (action : int) (store : int) : return = 9 | let (op, addr) = Tezos.create_contract dummy_contract ((None: key_hash option)) 300tz 1 in + ^^^^ 10 | let toto : operation list = [ op ] in : Warning: unused variable "addr". @@ -633,6 +669,7 @@ Not all free variables could be inlined in Tezos.create_contract usage: gen#34. File "../../test/contracts/negative/create_contract_no_inline.mligo", line 8, characters 25-30: 7 | 8 | let main (action : int) (store : int) : return = + ^^^^^ 9 | let (op, addr) = Tezos.create_contract dummy_contract ((None: key_hash option)) 300tz 1 in : Warning: unused variable "store". @@ -641,6 +678,7 @@ Not all free variables could be inlined in Tezos.create_contract usage: gen#34. File "../../test/contracts/negative/create_contract_no_inline.mligo", line 8, characters 10-16: 7 | 8 | let main (action : int) (store : int) : return = + ^^^^^^ 9 | let (op, addr) = Tezos.create_contract dummy_contract ((None: key_hash option)) 300tz 1 in : Warning: unused variable "action". @@ -649,6 +687,7 @@ Not all free variables could be inlined in Tezos.create_contract usage: gen#34. File "../../test/contracts/negative/create_contract_no_inline.mligo", line 9, characters 19-89: 8 | let main (action : int) (store : int) : return = 9 | let (op, addr) = Tezos.create_contract dummy_contract ((None: key_hash option)) 300tz 1 in + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | let toto : operation list = [ op ] in Not all free variables could be inlined in Tezos.create_contract usage: foo#46. |}]; @@ -658,6 +697,7 @@ Not all free variables could be inlined in Tezos.create_contract usage: gen#34. File "../../test/contracts/create_contract.mligo", line 5, characters 20-21: 4 | let toto : operation * address = Tezos.create_contract 5 | (fun (p : nat) (s : string) -> (([] : operation list), "one")) + ^ 6 | (None: key_hash option) : Warning: unused variable "s". @@ -666,6 +706,7 @@ Not all free variables could be inlined in Tezos.create_contract usage: gen#34. File "../../test/contracts/create_contract.mligo", line 5, characters 10-11: 4 | let toto : operation * address = Tezos.create_contract 5 | (fun (p : nat) (s : string) -> (([] : operation list), "one")) + ^ 6 | (None: key_hash option) : Warning: unused variable "p". @@ -674,6 +715,7 @@ Not all free variables could be inlined in Tezos.create_contract usage: gen#34. File "../../test/contracts/create_contract.mligo", line 3, characters 10-16: 2 | 3 | let main (action : string) (store : string) : return = + ^^^^^^ 4 | let toto : operation * address = Tezos.create_contract : Warning: unused variable "action". @@ -704,6 +746,7 @@ let%expect_test _ = File "../../test/contracts/negative/bad_contract.mligo", line 4, characters 10-16: 3 | 4 | let main (action : parameter) (store : storage) : storage = + ^^^^^^ 5 | store + 1 : Warning: unused variable "action". @@ -712,6 +755,7 @@ Hint: replace it by "_action" to prevent this warning. File "../../test/contracts/negative/bad_contract.mligo", line 4, characters 4-8: 3 | 4 | let main (action : parameter) (store : storage) : storage = + ^^^^ 5 | store + 1 Invalid type for entrypoint "main". @@ -722,6 +766,7 @@ An entrypoint must of type "parameter * storage -> operation list * storage". |} File "../../test/contracts/negative/bad_contract2.mligo", line 5, characters 10-16: 4 | 5 | let main (action : parameter) (store : storage) : return = + ^^^^^^ 6 | ("bad",store + 1) : Warning: unused variable "action". @@ -730,7 +775,9 @@ Hint: replace it by "_action" to prevent this warning. File "../../test/contracts/negative/bad_contract2.mligo", line 5, character 0 to line 6, character 19: 4 | 5 | let main (action : parameter) (store : storage) : return = + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 6 | ("bad",store + 1) + ^^^^^^^^^^^^^^^^^^^ Invalid type for entrypoint "main". An entrypoint must of type "parameter * storage -> operation list * storage". @@ -741,6 +788,7 @@ We expected a list of operations but we got string |}]; File "../../test/contracts/negative/bad_contract3.mligo", line 5, characters 10-16: 4 | 5 | let main (action, store : parameter * storage) : return = + ^^^^^^ 6 | (([]: operation list),"bad") : Warning: unused variable "action". @@ -749,6 +797,7 @@ Hint: replace it by "_action" to prevent this warning. File "../../test/contracts/negative/bad_contract3.mligo", line 5, characters 18-23: 4 | 5 | let main (action, store : parameter * storage) : return = + ^^^^^ 6 | (([]: operation list),"bad") : Warning: unused variable "store". @@ -757,7 +806,9 @@ Hint: replace it by "_store" to prevent this warning. File "../../test/contracts/negative/bad_contract3.mligo", line 5, character 0 to line 6, character 30: 4 | 5 | let main (action, store : parameter * storage) : return = + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 6 | (([]: operation list),"bad") + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid type for entrypoint "main". The storage type "int" of the function parameter must be the same as the storage type "string" of the return value. |}] @@ -768,6 +819,7 @@ let%expect_test _ = {| File "../../test/contracts/negative/duplicate_record_field.mligo", line 1, characters 9-34: 1 | type r = { foo : int ; foo : int } + ^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | Repeated type variable in type. @@ -837,6 +889,7 @@ let%expect_test _ = File "../../test/contracts/edo_combs.mligo", line 10, characters 22-23: 9 | 10 | let main (p : param) (s : int) : operation list * int = + ^ 11 | let { x = x; y = y; z = z; w = w } = p in : Warning: unused variable "s". @@ -892,13 +945,21 @@ let%expect_test _ = File "../../test/contracts/never.jsligo", line 8, character 0 to line 15, character 1: 7 | 8 | let main = (action : parameter, store : storage) : [list, storage] => { + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | return [ + ^^^^^^^^^^ 10 | (list([]) as list ), + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | (match (action, { + ^^^^^^^^^^^^^^^^^^^^ 12 | Increment: (n : int) => store + n, + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 13 | Extend: (k : never) => (Tezos.never(k) as storage)})) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 14 | ] + ^^^ 15 | }; + ^ Toplevel let declaration are silently change to const declaration. @@ -934,6 +995,7 @@ let%expect_test _ = File "../../test/contracts/negative/error_self_annotations.mligo", line 6, characters 10-44: 5 | let main (_ : param) (_ : unit) : operation list * unit = 6 | let c = (Tezos.self("%a") : unit contract) in + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 7 | let op = Tezos.transaction () 0mutez c in Invalid entrypoint value. @@ -947,8 +1009,11 @@ let%expect_test _ = File "../../test/contracts/negative/bad_get_entrypoint.mligo", line 2, character 10 to line 4, character 85: 1 | let main (_ : unit) (_ : unit) : operation list * unit = 2 | let v = (Tezos.get_entrypoint_opt + ^^^^^^^^^^^^^^^^^^^^^^^^^ 3 | "foo" + ^^^^^^^^^^^^^^^^ 4 | ("tz1fakefakefakefakefakefakefakcphLA5" : address) : unit contract option) in + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 5 | let u : unit = match v with Invalid entrypoint "foo". One of the following patterns is expected: @@ -964,11 +1029,17 @@ let%expect_test _ = File "../../test/contracts/negative/compile_test.mligo", line 12, character 0 to line 17, character 22: 11 | the smart contract parameter. *) 12 | let main (action : parameter) (store : storage) : return = + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 13 | ([] : operation list), // No operations + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 14 | (match action with + ^^^^^^^^^^^^^^^^^^^ 15 | Increment (n) -> let _ = Test.log "foo" in add store n + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 16 | | Decrement (n) -> sub store n + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 17 | | Reset -> 0) + ^^^^^^^^^^^^^^^^^^^^^^ 18 | let _test () = Invalid usage of a Test primitive: cannot be translated to Michelson. |}] @@ -1004,6 +1075,7 @@ let%expect_test _ = {| File "../../test/contracts/negative/bad_annotation_unpack.mligo", line 1, characters 9-42: 1 | let x = (Bytes.unpack (Bytes.pack "hello") : string) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid type(s) Cannot unify "option (^a)" with "string". @@ -1035,6 +1107,7 @@ let%expect_test _ = File "../../test/contracts/negative/reuse_variable_name_top.jsligo", line 2, characters 4-7: 1 | let dog = 1; 2 | let dog = true; + ^^^ Duplicate identifier. |}] @@ -1045,6 +1118,7 @@ let%expect_test _ = File "../../test/contracts/negative/reuse_variable_name_block.jsligo", line 3, characters 8-9: 2 | let x = 2; 3 | let x = 2; + ^ 4 | return x; Duplicate identifier. |}] @@ -1095,6 +1169,7 @@ let%expect_test _ = File "../../test/contracts/negative/modules_export_const.jsligo", line 2, characters 4-15: 1 | namespace Bar { 2 | let foo = 2 + ^^^^^^^^^^^ 3 | } Toplevel let declaration are silently change to const declaration. @@ -1102,6 +1177,7 @@ let%expect_test _ = File "../../test/contracts/negative/modules_export_const.jsligo", line 5, characters 0-15: 4 | 5 | let a = Bar.foo; + ^^^^^^^^^^^^^^^ Toplevel let declaration are silently change to const declaration. @@ -1112,6 +1188,7 @@ let%expect_test _ = File "../../test/contracts/negative/modules_export_namespace.jsligo", line 3, characters 8-17: 2 | namespace Foo { 3 | let a = 2; + ^^^^^^^^^ 4 | } Toplevel let declaration are silently change to const declaration. @@ -2543,6 +2620,7 @@ let%expect_test _ = File "../../test/contracts/extend_builtin.jsligo", line 2, characters 9-19: 1 | namespace Tezos { 2 | export let x = 42; + ^^^^^^^^^^ 3 | export let f = (x : int) : int => x + 2; Toplevel let declaration are silently change to const declaration. @@ -2550,6 +2628,7 @@ Toplevel let declaration are silently change to const declaration. File "../../test/contracts/extend_builtin.jsligo", line 3, characters 9-42: 2 | export let x = 42; 3 | export let f = (x : int) : int => x + 2; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | } Toplevel let declaration are silently change to const declaration. @@ -2557,6 +2636,7 @@ Toplevel let declaration are silently change to const declaration. File "../../test/contracts/extend_builtin.jsligo", line 6, characters 0-24: 5 | 6 | let y = Tezos.f(Tezos.x); + ^^^^^^^^^^^^^^^^^^^^^^^^ Toplevel let declaration are silently change to const declaration. @@ -2607,6 +2687,7 @@ let%expect_test _ = File "../../test/contracts/negative/call_view_not_litstr.mligo", line 2, characters 16-122: 1 | let main ((s, _) : string * unit) : operation list * unit = 2 | let u = match (Tezos.call_view s (Tezos.get_sender ()) ("tz1fakefakefakefakefakefakefakcphLA5" : address) : unit option) with + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 | | Some x -> x Invalid argument. @@ -2619,6 +2700,7 @@ let%expect_test _ = File "../../test/contracts/negative/shadowed_sum_type.mligo", line 13, characters 8-12: 12 | 13 | let x = A 42 + ^^^^ 14 | Constructor "A" not found. @@ -2631,6 +2713,7 @@ let%expect_test _ = File "../../test/contracts/negative/bad_contract_return_type.mligo", line 5, characters 14-23: 4 | 5 | let main (_ : parameter) (s : storage) : _return = + ^^^^^^^^^ 6 | [], s, 1tez Type "parameter" not found. @@ -2684,6 +2767,7 @@ let%expect_test _ = File "../../test/contracts/negative/bytes_literals.jsligo", line 2, characters 12-23: 1 | const shame = () => { 2 | const x = bytes `foo` as nat; + ^^^^^^^^^^^ 3 | return x Invalid type(s). @@ -2722,6 +2806,7 @@ let%expect_test _ = File "../../test/contracts/negative/emit_bad_tag.mligo", line 2, characters 3-31: 1 | let main (_ : unit) (_ : string) : operation list * string = 2 | [Tezos.emit "%hello world" 12], "bye" + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid entrypoint "%hello world". One of the following patterns is expected: * "%bar" is expected for entrypoint "Bar" @@ -2757,7 +2842,9 @@ let%expect_test _ = File "../../test/contracts/negative/annotated_storage_and_parameter.mligo", line 4, character 0 to line 5, character 8: 3 | 4 | let main (_p : parameter) (s : storage) : operation list * storage = + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 5 | ([], s) + ^^^^^^^^ Invalid type for entrypoint "main". The parameter type "funtype 'a : * . list ('a)" of the entrypoint function must not contain polymorphic variables. |}] @@ -2769,6 +2856,7 @@ let%expect_test _ = File "../../test/contracts/disc_union_vbar.jsligo", line 16, characters 11-21: 15 | let planetType = p.planetType; 16 | switch(planetType.kind) { + ^^^^^^^^^^ 17 | case "Tellurian": : Warning: unused variable "planetType". @@ -2777,6 +2865,7 @@ let%expect_test _ = File "../../test/contracts/disc_union_vbar.jsligo", line 16, characters 11-21: 15 | let planetType = p.planetType; 16 | switch(planetType.kind) { + ^^^^^^^^^^ 17 | case "Tellurian": : Warning: unused variable "planetType". @@ -2785,6 +2874,7 @@ let%expect_test _ = File "../../test/contracts/disc_union_vbar.jsligo", line 16, characters 11-21: 15 | let planetType = p.planetType; 16 | switch(planetType.kind) { + ^^^^^^^^^^ 17 | case "Tellurian": : Warning: unused variable "planetType". @@ -2873,6 +2963,7 @@ let%expect_test _ = File "../../test/contracts/entrypoint_in_module.mligo", line 20, characters 14-17: 19 | | Reset -> 0) 20 | [@view] let foo (i : int) (store : storage) : int = i + store + ^^^ 21 | let bar (i : int) (store : storage) : int = 1 + i + store Warning: This view will be ignored, command line option override [ @@ -2951,6 +3042,7 @@ let%expect_test _ = File "../../test/contracts/negative/entrypoint_no_type.jsligo", line 8, characters 6-12: 7 | // @entry 8 | const unique = (_ : organization, _ : storage) => { + ^^^^^^ 9 | return failwith("You need to be part of Tezos organization to activate an organization"); Invalid type for entrypoint "unique". diff --git a/src/bin/expect_tests/deep_pattern_matching.ml b/src/bin/expect_tests/deep_pattern_matching.ml index 40167adc26..8ed0015384 100644 --- a/src/bin/expect_tests/deep_pattern_matching.ml +++ b/src/bin/expect_tests/deep_pattern_matching.ml @@ -13,6 +13,7 @@ let%expect_test _ = File "../../test/contracts/negative//deep_pattern_matching/pm_fail17.mligo", line 15, characters 42-43: 14 | (* testing that subtitution is stoping on resursive definitions *) 15 | let rec a (b : int) : int =let x = fo a in b + 1 in + ^ 16 | (a 1) + (fo b) Invalid type(s) @@ -26,6 +27,7 @@ let%expect_test _ = File "../../test/contracts/negative//deep_pattern_matching/pm_fail16.mligo", line 6, characters 4-25: 5 | match action with 6 | | {one = _ ; three = _} -> 0 + ^^^^^^^^^^^^^^^^^^^^^ Pattern not of the expected type "parameter". |}] @@ -37,8 +39,11 @@ let%expect_test _ = File "../../test/contracts/negative//deep_pattern_matching/pm_fail15.mligo", line 7, character 2 to line 9, character 25: 6 | let main (action : parameter) : int = 7 | match action with + ^^^^^^^^^^^^^^^^^ 8 | | Increment (n, m) -> 0 + ^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | | Reset -> 0 + ^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid type(s) Cannot unify "( ^a * ^b )" with "( int * int * int )". @@ -58,6 +63,7 @@ let%expect_test _ = File "../../test/contracts/negative//deep_pattern_matching/pm_fail14.mligo", line 2, characters 11-14: 1 | let main (_ : unit) (_ : unit) : operation list * unit = 2 | let () = 42n in + ^^^ 3 | (([] : operation list), ()) Invalid type(s). @@ -71,6 +77,7 @@ let%expect_test _ = File "../../test/contracts/negative//deep_pattern_matching/pm_fail10.mligo", line 5, characters 8-9: 4 | match x with 5 | | One 1 -> 2 + ^ 6 | | Two -> 1 Invalid pattern matching. @@ -91,6 +98,7 @@ let%expect_test _ = File "../../test/contracts/negative//deep_pattern_matching/pm_fail9.mligo", line 6, characters 11-12: 5 | | One a -> 2 6 | | Two -> a + ^ Variable "a" not found. |}] @@ -102,9 +110,13 @@ let%expect_test _ = File "../../test/contracts/negative//deep_pattern_matching/pm_fail1.mligo", line 5, character 2 to line 8, character 44: 4 | let t = fun (x: myt * myt) -> 5 | match x with + ^^^^^^^^^^^^ 6 | | Nil , {a = a ; b = b ; c = c} -> 1 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 7 | | xs , Nil -> 2 + ^^^^^^^^^^^^^^^^^^ 8 | | Cons (a,b) , Cons (c,d) -> a + b + c + d + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid type(s) Cannot unify "record[a -> ^a , b -> ^b , c -> ^c]" with "myt". @@ -117,9 +129,13 @@ let%expect_test _ = File "../../test/contracts/negative//deep_pattern_matching/pm_fail2.mligo", line 4, character 2 to line 7, character 44: 3 | let t = fun (x: myt * myt) -> 4 | match x with + ^^^^^^^^^^^^ 5 | | Nil , (a,b,c) -> 1 + ^^^^^^^^^^^^^^^^^^^^^^ 6 | | xs , Nil -> 2 + ^^^^^^^^^^^^^^^^^^ 7 | | Cons (a,b) , Cons (c,d) -> a + b + c + d + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid type(s) Cannot unify "( ^a * ^b * ^c )" with "myt". @@ -132,6 +148,7 @@ let%expect_test _ = File "../../test/contracts/negative//deep_pattern_matching/pm_fail5.mligo", line 5, characters 4-15: 4 | match x with 5 | | Some_fake x -> x + ^^^^^^^^^^^ 6 | | None_fake -> 1 Pattern not of the expected type "option (int)". |}] @@ -145,6 +162,7 @@ let%expect_test _ = File "../../test/contracts/negative//deep_pattern_matching/pm_fail7.mligo", line 6, characters 9-10: 5 | | A -> "hey" 6 | | B -> 2 + ^ Invalid type(s) Cannot unify "int" with "string". |}] @@ -156,6 +174,7 @@ let%expect_test _ = File "../../test/contracts/negative//deep_pattern_matching/pm_fail8.mligo", line 19, characters 22-31: 18 | f (b+1) 19 | | Cons (a,b) -> "invalid" + ^^^^^^^^^ 20 | in Invalid type(s) @@ -169,8 +188,11 @@ let%expect_test _ = File "../../test/contracts/negative//deep_pattern_matching/pm_fail3.mligo", line 4, character 2 to line 6, character 21: 3 | let t = fun (x: myt * ( int * int * int)) -> 4 | match x with + ^^^^^^^^^^^^ 5 | | xs , (a,b,c) -> 1 + ^^^^^^^^^^^^^^^^^^^^^ 6 | | xs , (c,b,a) -> 2 + ^^^^^^^^^^^^^^^^^^^^^ Error : this match case is unused. |}] @@ -183,8 +205,11 @@ let%expect_test _ = File "../../test/contracts/negative//deep_pattern_matching/pm_fail11.mligo", line 2, character 2 to line 4, character 11: 1 | let t12 = fun (x : int list) -> 2 | match x with + ^^^^^^^^^^^^ 3 | | hd::(hd2::tl) -> hd + hd2 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | | [] -> 0 + ^^^^^^^^^^^ Error : this pattern-matching is not exhaustive. Here are examples of cases that are not matched: @@ -197,8 +222,11 @@ let%expect_test _ = File "../../test/contracts/negative//deep_pattern_matching/pm_fail12.mligo", line 4, character 2 to line 6, character 40: 3 | let t13 = fun (x:recordi) -> 4 | match x with + ^^^^^^^^^^^^ 5 | | { a = Some ([]) ; b = (hd::tl) } -> hd + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 6 | | { a = Some (hd::tl) ; b = [] } -> hd + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error : this pattern-matching is not exhaustive. Here are examples of cases that are not matched: @@ -211,6 +239,7 @@ let%expect_test _ = File "../../test/contracts/negative//deep_pattern_matching/pm_fail13.mligo", line 7, characters 5-14: 6 | | Increment n -> s +1 7 | | Decrement -> s -1 + ^^^^^^^^^ 8 | in ([] : operation list), stor Pattern not of the expected type "nat". |}] @@ -222,8 +251,11 @@ let%expect_test _ = File "../../test/contracts/negative//deep_pattern_matching/pm_fail4.mligo", line 4, character 2 to line 6, character 18: 3 | let t = fun (x: myt * myt) -> 4 | match x with + ^^^^^^^^^^^^ 5 | | Nil , ys -> 1 + ^^^^^^^^^^^^^^^^^^ 6 | | xs , Nil -> 2 + ^^^^^^^^^^^^^^^^^^ Error : this pattern-matching is not exhaustive. Here are examples of cases that are not matched: @@ -545,10 +577,15 @@ let%expect_test _ = File "../../test/contracts//deep_pattern_matching/edge_case_V.mligo", line 6, character 7 to line 10, character 20: 5 | let main (p : p) (_ : int) : operation list * int = 6 | [], (match p with + ^^^^^^^^^^^^^ 7 | A,A,A,_,_,_ -> 1 + ^^^^^^^^^^^^^^^^^^^^ 8 | | B,_,_,A,A,_ -> 2 + ^^^^^^^^^^^^^^^^^^^^ 9 | | _,B,_,B,_,A -> 3 + ^^^^^^^^^^^^^^^^^^^^ 10 | | _,_,B,_,B,B -> 4) + ^^^^^^^^^^^^^^^^^^^^ Error : this pattern-matching is not exhaustive. Here are examples of cases that are not matched: @@ -561,11 +598,17 @@ let%expect_test _ = File "../../test/contracts//deep_pattern_matching/edge_case_S.mligo", line 6, character 7 to line 11, character 31: 5 | let main (p : p) (_ : int) : operation list * int = 6 | [], (match p with + ^^^^^^^^^^^^ 7 | A, A, _, _, _, _, _, _ -> 1 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 8 | | _, _, A, A, _, _, _, _ -> 2 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | | _, _, _, _, A, A, _, _ -> 3 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | | _, _, _, _, _, _, A, A -> 4 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | | A, B, A, B, A, B, A, B -> 5) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error : this pattern-matching is not exhaustive. Here are examples of cases that are not matched: @@ -578,6 +621,7 @@ let%expect_test _ = File "../../test/contracts//deep_pattern_matching/pm_ticket.mligo", line 8, characters 28-33: 7 | | { myt = myt ; mynat = mynat } , None -> (([]: operation list), mynat) 8 | | { myt = myt ; mynat = mynat } , Some x -> (([]: operation list), x) + ^^^^^ : Warning: unused variable "mynat". Hint: replace it by "_mynat" to prevent this warning. @@ -585,6 +629,7 @@ let%expect_test _ = File "../../test/contracts//deep_pattern_matching/pm_ticket.mligo", line 8, characters 14-17: 7 | | { myt = myt ; mynat = mynat } , None -> (([]: operation list), mynat) 8 | | { myt = myt ; mynat = mynat } , Some x -> (([]: operation list), x) + ^^^ : Warning: unused variable "myt". Hint: replace it by "_myt" to prevent this warning. @@ -592,6 +637,7 @@ let%expect_test _ = File "../../test/contracts//deep_pattern_matching/pm_ticket.mligo", line 7, characters 14-17: 6 | match p with 7 | | { myt = myt ; mynat = mynat } , None -> (([]: operation list), mynat) + ^^^ 8 | | { myt = myt ; mynat = mynat } , Some x -> (([]: operation list), x) : Warning: unused variable "myt". @@ -600,6 +646,7 @@ let%expect_test _ = File "../../test/contracts//deep_pattern_matching/pm_ticket.mligo", line 5, characters 32-33: 4 | 5 | let main = fun (p : parameter) (s: storage) -> + ^ 6 | match p with : Warning: unused variable "s". diff --git a/src/bin/expect_tests/failwith_tests.ml b/src/bin/expect_tests/failwith_tests.ml index 1e22e4c5f0..fb249efd41 100644 --- a/src/bin/expect_tests/failwith_tests.ml +++ b/src/bin/expect_tests/failwith_tests.ml @@ -8,6 +8,7 @@ let%expect_test _ = {| File "../../test/contracts/subtle_nontail_fail.mligo", line 1, characters 10-12: 1 | let main (ps : unit * unit) : operation list * unit = + ^^ 2 | if true : Warning: unused variable "ps". diff --git a/src/bin/expect_tests/get_scope.ml b/src/bin/expect_tests/get_scope.ml index b958f7366a..cfb1534e5d 100644 --- a/src/bin/expect_tests/get_scope.ml +++ b/src/bin/expect_tests/get_scope.ml @@ -303,6 +303,7 @@ let%expect_test _ = File "../../test/contracts/get_scope_tests/match.mligo", line 8, characters 8-9: 7 | | Foo x -> x + a 8 | | Bar y -> 1 + a + ^ 9 | : Warning: unused variable "y". @@ -311,6 +312,7 @@ let%expect_test _ = File "../../test/contracts/get_scope_tests/match.mligo", line 15, characters 8-10: 14 | a 15 | | hd::tl -> 2 + ^^ 16 | : Warning: unused variable "tl". @@ -319,6 +321,7 @@ let%expect_test _ = File "../../test/contracts/get_scope_tests/match.mligo", line 15, characters 4-6: 14 | a 15 | | hd::tl -> 2 + ^^ 16 | : Warning: unused variable "hd". @@ -327,6 +330,7 @@ let%expect_test _ = File "../../test/contracts/get_scope_tests/match.mligo", line 13, characters 8-9: 12 | | [] -> 13 | let c = 2 in + ^ 14 | a : Warning: unused variable "c". @@ -696,6 +700,7 @@ let%expect_test _ = File "../../test/contracts/get_scope_tests/application.mligo", line 3, characters 7-8: 2 | let f : (int-> int -> int) = fun (i : int) (j : int) -> j + i in 3 | (let b = 1 in f 1) (let c = 2 in c) + ^ : Warning: unused variable "b". Hint: replace it by "_b" to prevent this warning. @@ -1774,6 +1779,7 @@ let%expect_test _ = File "../../test/contracts/get_scope_tests/types.mligo", line 14, characters 12-13: 13 | // Module parametric type in 14 | let h : string bar = { bar = "World" } in + ^ 15 | () : Warning: unused variable "h". @@ -1782,6 +1788,7 @@ let%expect_test _ = File "../../test/contracts/get_scope_tests/types.mligo", line 12, characters 12-13: 11 | // Module type in 12 | let g : foo = "Hello" in + ^ 13 | // Module parametric type in : Warning: unused variable "g". @@ -1790,6 +1797,7 @@ let%expect_test _ = File "../../test/contracts/get_scope_tests/types.mligo", line 46, characters 8-9: 45 | // paramertic type in 46 | let j : nat boo = Some 1n in + ^ 47 | () : Warning: unused variable "j". @@ -1798,6 +1806,7 @@ let%expect_test _ = File "../../test/contracts/get_scope_tests/types.mligo", line 43, characters 8-9: 42 | // type in 43 | let i : qux = false in + ^ 44 | type 'a boo = 'a option in : Warning: unused variable "i". diff --git a/src/bin/expect_tests/get_scope_errors_warns.ml b/src/bin/expect_tests/get_scope_errors_warns.ml index 3125f3bbad..0c3dd8f859 100644 --- a/src/bin/expect_tests/get_scope_errors_warns.ml +++ b/src/bin/expect_tests/get_scope_errors_warns.ml @@ -64,6 +64,7 @@ let%expect_test _ = File "../../test/contracts/get_scope_tests/bad_field_record.mligo", line 13, characters 10-15: 12 | let b = 13 | let j = c.boo in + ^^^^^ 14 | j Invalid record field "boo" in record. @@ -131,6 +132,7 @@ let%expect_test _ = File "../../test/contracts/get_scope_tests/local_type.mligo", line 5, characters 2-6: 4 | let foo (b : toto) : toto = b in 5 | titi + ^^^^ 6 | Variable "titi" not found. @@ -154,6 +156,7 @@ let%expect_test _ = Errors: File "../../test/contracts/get_scope_tests/errors/syntax_error.mligo", line 1, characters 0-4: 1 | letx : int = 0 + ^^^^ Ill-formed contract. At this point, if the declaration is complete, one of the following is expected: @@ -185,6 +188,7 @@ let%expect_test _ = Errors: File "../../test/contracts/get_scope_tests/errors/type_error.mligo", line 1, characters 14-21: 1 | let x : int = "Hello" + ^^^^^^^ Invalid type(s). Expected "int", but got: "string". |}]; @@ -282,6 +286,7 @@ let%expect_test _ = File "../../test/contracts/warning_unused.mligo", line 11, characters 6-7: 10 | let x = s.x + 3 in 11 | let x = foo x in + ^ 12 | let x = bar s.x in : Warning: unused variable "x". @@ -320,6 +325,7 @@ let%expect_test _ = Warnings: File "../../test/contracts/warning_duplicate2.mligo", line 1, characters 4-5: 1 | let x = Tezos.create_ticket 42n 42n + ^ 2 | let x = (x, x) : Warning: variable "x" cannot be used more than once. |}]; @@ -370,6 +376,7 @@ let%expect_test _ = File "../../test/contracts/warning_duplicate.mligo", line 2, characters 2-65: 1 | module Foo = struct 2 | let x : nat ticket = Option.unopt (Tezos.create_ticket 42n 42n) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 | end : Warning: variable "Foo.x" cannot be used more than once. |}] diff --git a/src/bin/expect_tests/get_scope_regressions.ml b/src/bin/expect_tests/get_scope_regressions.ml index 746660a16b..9148b3aefe 100644 --- a/src/bin/expect_tests/get_scope_regressions.ml +++ b/src/bin/expect_tests/get_scope_regressions.ml @@ -134,12 +134,14 @@ let%expect_test _ = File "../../test/contracts/get_scope_tests/regressions/buggy_file_with_core_types.jsligo", line 13, characters 25-32: 12 | 13 | let alice_admin : bool = alice.i + ^^^^^^^ Invalid record field "i" in record. Warnings: File "../../test/contracts/get_scope_tests/regressions/buggy_file_with_core_types.jsligo", line 13, characters 0-32: 12 | 13 | let alice_admin : bool = alice.i + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Toplevel let declaration are silently change to const declaration. |}] @@ -188,6 +190,7 @@ let%expect_test _ = File "../../test/contracts/get_scope_tests/regressions/wrong_reference1.mligo", line 2, characters 6-7: 1 | let x = 42 2 | let f x = 0 + ^ 3 | let g = x : Warning: unused variable "x". @@ -451,6 +454,7 @@ let%expect_test _ = File "../../test/contracts/get_scope_tests/regressions/duplicate_unused_warnings.mligo", line 2, characters 9-12: 1 | let m = match (Some 4) with 2 | | Some s_x -> 1 + ^^^ 3 | | None -> 0 : Warning: unused variable "s_x". diff --git a/src/bin/expect_tests/jsligo_unreachable_code.ml b/src/bin/expect_tests/jsligo_unreachable_code.ml index 02fb8c8420..7f0bd6adfc 100644 --- a/src/bin/expect_tests/jsligo_unreachable_code.ml +++ b/src/bin/expect_tests/jsligo_unreachable_code.ml @@ -7,36 +7,42 @@ let%expect_test _ = File "../../test/contracts/jsligo_unreachable_code.jsligo", line 9, characters 6-71: 8 | return "end"; 9 | let _x = "Unreachable post-return code that should trigger a warning"; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | } Warning: Unreachable code. File "../../test/contracts/jsligo_unreachable_code.jsligo", line 18, characters 8-73: 17 | return "b"; 18 | let _x = "Unreachable post-return code that should trigger a warning"; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 19 | } Warning: Unreachable code. File "../../test/contracts/jsligo_unreachable_code.jsligo", line 33, characters 6-76: 32 | return "end"; 33 | output = "Unreachable post-return code that should trigger a warnings"; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 34 | case 4: Warning: Unreachable code. File "../../test/contracts/jsligo_unreachable_code.jsligo", line 37, characters 6-73: 36 | break; 37 | return "Unreachable post-break code that should trigger a warnings"; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 38 | default: Warning: Unreachable code. File "../../test/contracts/jsligo_unreachable_code.jsligo", line 28, characters 6-75: 27 | break; 28 | output = "Unreachable post-break code that should trigger a warnings"; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 29 | case 2: Warning: Unreachable code. File "../../test/contracts/jsligo_unreachable_code.jsligo", line 46, characters 2-70: 45 | return "end"; 46 | return "Unreachable post-return code that should trigger a warnings"; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 47 | } Warning: Unreachable code. diff --git a/src/bin/expect_tests/layout.ml b/src/bin/expect_tests/layout.ml index 35d964db34..f886ade794 100644 --- a/src/bin/expect_tests/layout.ml +++ b/src/bin/expect_tests/layout.ml @@ -11,12 +11,19 @@ let%expect_test _ = File "../../test/contracts/negative/layout.mligo", line 17, character 2 to line 23, character 6: 16 | let main (p : unit) (s : storage) : return = 17 | let s : storage1 = { + ^^^^^^^^^^^^^^^^^^^^ 18 | tata = 0; + ^^^^^^^^^^^^^ 19 | toto = 1; + ^^^^^^^^^^^^^ 20 | titi = 2; + ^^^^^^^^^^^^^ 21 | tutu = 3; + ^^^^^^^^^^^^^ 22 | } in + ^^^^^^ 23 | [],s + ^^^^^^ 24 | Invalid type(s) @@ -29,6 +36,7 @@ let%expect_test _ = File "../../test/contracts/negative/layout1.mligo", line 5, characters 7-40: 4 | let main (_ : unit) (_ : r1) : operation list * r1 = 5 | ([], ({bar = "bar"; foo = "foo"} : r2)) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid type(s) Cannot unify "r2" with "r1" due to differing layouts "({ name: bar }, { name: foo })" and "({ name: foo }, { name: bar })". |}] diff --git a/src/bin/expect_tests/let_destructuring.ml b/src/bin/expect_tests/let_destructuring.ml index 6e86b79365..e84ec80d3b 100644 --- a/src/bin/expect_tests/let_destructuring.ml +++ b/src/bin/expect_tests/let_destructuring.ml @@ -35,6 +35,7 @@ let%expect_test _ = File "../../test/contracts/negative/let_destructuring.mligo", line 4, characters 6-23: 3 | let t1 = 4 | let { a = a ; f = b } = { a = 1 ; b = 1n } in + ^^^^^^^^^^^^^^^^^ 5 | (a,b) Pattern not of the expected type "foo". |}]; diff --git a/src/bin/expect_tests/lexer_tests.ml b/src/bin/expect_tests/lexer_tests.ml index 645b5627ab..86544bc2ec 100644 --- a/src/bin/expect_tests/lexer_tests.ml +++ b/src/bin/expect_tests/lexer_tests.ml @@ -14,6 +14,7 @@ let%expect_test _ = {test| File "../../test/lexer/LexerLib/unterminated_comment.mligo", line 1, characters 0-2: 1 | (* not closed + ^^ The comment starting here is not closed. Hint: Close it with "*)". |test}]; @@ -23,6 +24,7 @@ Hint: Close it with "*)". {test| File "../../test/lexer/LexerLib/unterminated_comment.jsligo", line 1, characters 0-2: 1 | /* not closed + ^^ The comment starting here is not closed. Hint: Close it with "*/". |test}]; @@ -33,6 +35,7 @@ Hint: Close it with "*/". {test| File "../../test/lexer/LexerLib/unterminated_string.mligo", line 1, characters 0-1: 1 | "open + ^ A string cannot be interrupted by a line break. Hint: Remove it or close the string before. |test}]; @@ -42,6 +45,7 @@ Hint: Remove it or close the string before. {test| File "../../test/lexer/LexerLib/unterminated_string.jsligo", line 1, characters 0-1: 1 | "open + ^ A string cannot be interrupted by a line break. Hint: Remove it or close the string before. |test}]; @@ -51,6 +55,7 @@ Hint: Remove it or close the string before. {test| File "../../test/lexer/LexerLib/broken_string.mligo", line 1, characters 8-9: 1 | let a = "broken + ^ 2 | over A string cannot be interrupted by a line break. Hint: Remove it or close the string before. @@ -60,6 +65,7 @@ Hint: Remove it or close the string before. {test| File "../../test/lexer/LexerLib/broken_string.jsligo", line 1, characters 19-20: 1 | const a : string = "broken + ^ 2 | over A string cannot be interrupted by a line break. Hint: Remove it or close the string before. @@ -74,6 +80,7 @@ Hint: Remove it or close the string before. {test| File "../../test/lexer/LexerLib/invalid_character_in_string.mligo", line 1, characters 9-10: 1 | let z = "\t"; + ^^ Invalid character "\\t" in string. Hint: Use non-control characters 7-bit ASCII. |test}]; @@ -86,6 +93,7 @@ Hint: Use non-control characters 7-bit ASCII. {test| File "../../test/lexer/LexerLib/invalid_character_in_string.jsligo", line 1, characters 11-12: 1 | const z = "\t"; + ^^ Invalid character "\\t" in string. Hint: Use non-control characters 7-bit ASCII. |test}]; @@ -96,6 +104,7 @@ Hint: Use non-control characters 7-bit ASCII. {test| File "../../test/lexer/LexerLib/undefined_escape_sequence.mligo", line 1, characters 1-3: 1 | "\\z" + ^^^ Undefined escape sequence. Hint: Remove or replace the sequence. |test}]; @@ -108,6 +117,7 @@ Hint: Remove or replace the sequence. {test| File "../../test/lexer/LexerLib/undefined_escape_sequence.jsligo", line 1, characters 1-3: 1 | "\\z" + ^^^ Undefined escape sequence. Hint: Remove or replace the sequence. |test}]; @@ -121,6 +131,7 @@ Hint: Remove or replace the sequence. {test| File "../../test/lexer/LexerLib/undefined_linemarker_argument.mligo", line 1, characters 42-43: 1 | # 1 "undefined_linemarker_argument.mligo" WRONG + ^ Invalid flag. Hint: 1 or 2 are allowed. |test}]; @@ -137,6 +148,7 @@ Hint: 1 or 2 are allowed. {test| File "../../test/lexer/Lexing/unexpected_character.mligo", line 1, characters 17-18: 1 | let x : string = \239\191\189\239\191\189\239\191\189; + ^^^^ Unexpected character '\239'. |test}]; (* Non-canonical zero *) @@ -146,6 +158,7 @@ Unexpected character '\239'. {test| File "../../test/lexer/Lexing/non_canonical_zero.mligo", line 1, characters 14-17: 1 | let n : nat = 000 + ^^^ Non-canonical zero. Hint: Use 0. |test}]; @@ -155,6 +168,7 @@ Hint: Use 0. {test| File "../../test/lexer/Lexing/invalid_symbol.mligo", line 1, characters 10-13: 1 | let b = 1 ... 10; + ^^^ 2 | Invalid symbol: "...". Hint: Check the LIGO syntax you use. @@ -164,6 +178,7 @@ Hint: Check the LIGO syntax you use. {test| File "../../test/lexer/Lexing/invalid_symbol.jsligo", line 1, characters 16-17: 1 | const b = 1 # 10; + ^ File name expected in a string literal. |test}]; (* Wrong nat syntax *) @@ -173,6 +188,7 @@ File name expected in a string literal. {test| File "../../test/lexer/Lexing/wrong_nat_syntax.jsligo", line 1, characters 14-16: 1 | let x : nat = 0n; + ^^ Wrong nat syntax. Example: "12334 as nat". |test}]; @@ -183,6 +199,7 @@ Example: "12334 as nat". {test| File "../../test/lexer/Lexing/wrong_mutez_syntax.jsligo", line 1, characters 14-20: 1 | let x : tez = 5mutez; + ^^^^^^ Wrong mutez syntax. Example: "1234 as mutez". |test}]; @@ -194,6 +211,7 @@ Example: "1234 as mutez". File "../../test/lexer/Lexing/wrong_lang_syntax.jsligo", line 2, characters 2-13: 1 | let michelson_add = (n : (nat, nat)) : nat => 2 | [%Michelson ({| { UNPAIR ; ADD } |} : ((nat, nat) => nat)) ](n); + ^^^^^^^^^^^ Wrong code injection syntax. Example: "(Michelson `{UNPAIR; ADD}` as ((n: [nat, nat]) => nat))". |test}]; @@ -204,6 +222,7 @@ Example: "(Michelson `{UNPAIR; ADD}` as ((n: [nat, nat]) => nat))". {test| File "../../test/lexer/Lexing/unterminated_verbatim.mligo", line 1, characters 17-19: 1 | let s : string = {| + ^^ Unterminated verbatim. Hint: Close with "|}". |test}]; @@ -213,6 +232,7 @@ Hint: Close with "|}". {test| File "../../test/lexer/Lexing/overflow_mutez.mligo", line 1, characters 14-38: 1 | let m : tez = 9223372036854775808mutez (* 2^63 *) + ^^^^^^^^^^^^^^^^^^^^^^^^ Mutez amount too large. Note: From 0 to 2^63-1=9_223_372_036_854_775_807. |test}]; @@ -222,6 +242,7 @@ Note: From 0 to 2^63-1=9_223_372_036_854_775_807. {test| File "../../test/lexer/Lexing/underflow_mutez.mligo", line 1, characters 14-32: 1 | let x : tez = 0.000_000_000_1tez + ^^^^^^^^^^^^^^^^^^ Mutez amount not an integer. |test}]; (* 3. Errors from Style.ml: They can be specific to a given @@ -234,6 +255,7 @@ Mutez amount not an integer. {test| File "../../test/lexer/Style/odd_lengthed_bytes.mligo", line 1, character 20: 1 | let x : bytes = 0xABC + ^ The length of the byte sequence is an odd number. Hint: Add or remove a digit. |test}]; @@ -243,6 +265,7 @@ Hint: Add or remove a digit. {test| File "../../test/lexer/Style/missing_break.mligo", line 1, character 17: 1 | let a : int = 300zennies + ^ Missing break. Hint: Insert some space. |test}] diff --git a/src/bin/expect_tests/ligo_interpreter_tests.ml b/src/bin/expect_tests/ligo_interpreter_tests.ml index b29c15357c..710bae7191 100644 --- a/src/bin/expect_tests/ligo_interpreter_tests.ml +++ b/src/bin/expect_tests/ligo_interpreter_tests.ml @@ -338,6 +338,7 @@ let%expect_test _ = - tester exited with value . - test exited with value [(() , Mutation at: File "adder.mligo", line 1, characters 58-63: 1 | let main (p : int) (k : int) : operation list * int = [], p + k + ^^^^^ Replacing by: p - k. )]. |}] @@ -349,6 +350,7 @@ let%expect_test _ = Everything at the top-level was executed. - test exited with value [(() , Mutation at: File "contract_under_test/module_adder.mligo", line 1, characters 66-71: 1 | [@entry] let add (p : int) (k : int) : operation list * int = [], p + k + ^^^^^ Replacing by: p - k. )]. |}] @@ -359,6 +361,7 @@ let%expect_test _ = {| [(() , Mutation at: File "contract_under_test/module_adder.mligo", line 1, characters 66-71: 1 | [@entry] let add (p : int) (k : int) : operation list * int = [], p + k + ^^^^^ Replacing by: p - k. )] @@ -1018,6 +1021,7 @@ let%expect_test _ = File "../../test/contracts/negative//interpreter_tests/test_capture_meta_type.mligo", line 12, characters 26-27: 11 | 12 | let f = fun (_ : unit) -> v.x + ^ 13 | Invalid usage of a Test type: typed_address (unit , @@ -1030,6 +1034,7 @@ let%expect_test _ = File "../../test/contracts/negative//interpreter_tests/test_random.mligo", line 6, characters 46-58: 5 | (* We generate the property *) 6 | let test = PBT.make_test (PBT.gen_small : ((int contract) list) pbt_gen) (fun (xs : (int contract) list) -> List.length xs = 42n) in + ^^^^^^^^^^^^ 7 | (* And run it *) Generator for type contract (int) is not implemented. For now, only unit, string, bytes, address, int, nat, tez, records, sums, lists, sets, maps and big_maps can be generated. |}] @@ -1041,6 +1046,7 @@ let%expect_test _ = File "../../test/contracts/negative//interpreter_tests/test_failure1.mligo", line 2, characters 2-25: 1 | let test : unit = 2 | failwith "I am failing" + ^^^^^^^^^^^^^^^^^^^^^^^ An uncaught error occured: Failwith: "I am failing" @@ -1054,6 +1060,7 @@ let%expect_test _ = File "../../test/contracts/negative//interpreter_tests/test_failure2.mligo", line 2, characters 4-16: 1 | let test = 2 | assert false + ^^^^^^^^^^^^ An uncaught error occured: Failwith: "failed assertion" @@ -1067,6 +1074,7 @@ let%expect_test _ = {| File "../../test/contracts/negative//interpreter_tests/bad_balances_reset.mligo", line 1, characters 11-48: 1 | let test = Test.reset_state 2n [4000tez;4000tez] + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ baker account initial balance must at least reach 6000 tez |}] @@ -1077,6 +1085,7 @@ let%expect_test _ = File "../../test/contracts/negative//interpreter_tests/test_failure3.mligo", line 3, characters 17-18: 2 | let f = (fun (_ : unit) (_ : unit) -> ()) in 3 | Test.originate f () 0tez + ^ Invalid type(s) Cannot unify "unit" with "( list (operation) * unit )". |}] @@ -1088,6 +1097,7 @@ let%expect_test _ = File "../../test/contracts/negative//interpreter_tests/test_trace.mligo", line 3, characters 4-31: 2 | if x < 0 then 3 | (failwith "negative" : int) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | else An uncaught error occured: @@ -1109,6 +1119,7 @@ let%expect_test _ = File "../../test/contracts/negative//interpreter_tests/test_trace2.mligo", line 6, characters 10-88: 5 | let make_call (contr : unit contract) = 6 | let _ = Test.get_storage_of_address ("KT1RYW6Zm24t3rSquhw1djfcgQeH9gBdsmiL" : address) in + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 7 | Test.transfer_to_contract_exn contr () 10tez An uncaught error occured: @@ -1124,6 +1135,7 @@ let%expect_test _ = File "../../test/contracts/negative//interpreter_tests/test_mutation_loop.mligo", line 18, characters 36-83: 17 | | Some (_, mutation) -> let () = Test.log(mutation) in 18 | failwith "Some mutation also passes the tests!" + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ An uncaught error occured: Failwith: "Some mutation also passes the tests!" @@ -1132,6 +1144,7 @@ let%expect_test _ = Mutation at: File "../../test/contracts/negative//interpreter_tests/test_mutation_loop.mligo", line 3, characters 29-30: 2 | if rounds > 0 then 3 | my_rec_fun (rounds - 1) + ^ 4 | else Replacing by: 2. |}] @@ -1143,6 +1156,7 @@ let%expect_test _ = File "../../test/contracts/negative//interpreter_tests/test_source1.mligo", line 10, characters 18-45: 9 | let () = Test.set_source addr in 10 | let (_, _, _) = Test.originate main () 0tez in + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | () The source address is not an implicit account @@ -1155,6 +1169,7 @@ let%expect_test _ = File "../../test/contracts/negative//interpreter_tests/test_source2.mligo", line 10, characters 10-52: 9 | let () = Test.set_source addr in 10 | let _ = Test.transfer_exn addr (Test.eval ()) 0tez in + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | () The source address is not an implicit account @@ -1167,6 +1182,7 @@ let%expect_test _ = File "../../test/contracts/negative//interpreter_tests/test_run_types.jsligo", line 2, characters 26-44: 1 | const foo = (x: {field: int}): {field: int} => {return x}; 2 | const bar = Test.run(foo, {property: "toto"}); + ^^^^^^^^^^^^^^^^^^ 3 | Mismatching record labels. Expected record of type "record[field -> int]". |}] @@ -1178,6 +1194,7 @@ let%expect_test _ = File "../../test/contracts/negative//interpreter_tests/test_run_types2.jsligo", line 2, characters 26-32: 1 | const foo = (x: {b:int}): {b:int} => {return x}; 2 | const bar = Test.run(foo, "toto"); + ^^^^^^ Invalid type(s) Cannot unify "string" with "record[b -> int]". |}] @@ -1189,6 +1206,7 @@ let%expect_test _ = File "../../test/contracts/negative//interpreter_tests/test_run_types3.jsligo", line 2, characters 26-41: 1 | const foo = (x: int): int => {return x}; 2 | const bar = Test.run(foo, {field: "toto"}); + ^^^^^^^^^^^^^^^ Invalid type(s) Cannot unify "record[field -> string]" with "int". |}] @@ -1200,6 +1218,7 @@ let%expect_test _ = File "../../test/contracts/negative//interpreter_tests/test_decompile.mligo", line 3, characters 2-29: 2 | let x = Test.eval 4n in 3 | (Test.decompile x : string) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ This Michelson value has assigned type 'nat', which does not coincide with expected type 'string'. |}] @@ -1210,6 +1229,7 @@ let%expect_test _ = File "../../test/contracts/negative//interpreter_tests/test_register_delegate.mligo", line 19, characters 19-46: 18 | let () = Test.set_baker a in 19 | let (ta, _, _) = Test.originate main 41 5tez in + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 20 | Baker cannot bake. Enough rolls? Enough cycles passed? @@ -1228,10 +1248,15 @@ let%expect_test _ = File "typed_addr_in_bytes_pack.mligo", line 14, character 17 to line 18, character 5: 13 | let r = originate_record () in 14 | let packed = Bytes.pack (fun() -> + ^^^^^^^^^^^^^^^^^^^^^ 15 | match (Tezos.get_entrypoint_opt "%transfer" r.addr : unit contract option) with + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 16 | Some(c) -> let op = Tezos.transaction () 0mutez c in [op] + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 17 | | None -> ([] : operation list) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 18 | ) in + ^^^^^ 19 | let () = Test.log(packed) in Cannot decompile value KT1KAUcMCQs7Q4mxLzoUZVH9yCCLETERrDtj of type typed_address (unit , @@ -1246,6 +1271,7 @@ let%expect_test _ = File "../../test/contracts/negative//interpreter_tests/test_michelson_non_func.mligo", line 2, characters 16-55: 1 | let test = 2 | let x : int = [%Michelson ({|{ PUSH int 1 }|} : int)] in + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 | begin Embedded raw code can only have a functional type |test}] @@ -1257,6 +1283,7 @@ let%expect_test _ = File "../../test/contracts/negative//interpreter_tests/get_contract.mligo", line 15, characters 10-66: 14 | let _ = (Tezos.get_contract a : (parameter contract)) in 15 | let _ = (Tezos.get_contract_with_error a "foo" : (int contract)) in + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 16 | () An uncaught error occured: diff --git a/src/bin/expect_tests/linear_pattern_matching.ml b/src/bin/expect_tests/linear_pattern_matching.ml index 3d4d8c2d42..a874788122 100644 --- a/src/bin/expect_tests/linear_pattern_matching.ml +++ b/src/bin/expect_tests/linear_pattern_matching.ml @@ -8,6 +8,7 @@ let%expect_test _ = File "../../test/contracts/negative/linear_pattern_matching.mligo", line 4, characters 34-35: 3 | let yy : string = match { a = 1 ; b = 2n ; c = "33" } with 4 | | { a = a ; b = b ; c = c } -> a + ^ Invalid type(s) Cannot unify "int" with "string". |}]; diff --git a/src/bin/expect_tests/linearity_tests.ml b/src/bin/expect_tests/linearity_tests.ml index 92bf6c0575..253ab0b74f 100644 --- a/src/bin/expect_tests/linearity_tests.ml +++ b/src/bin/expect_tests/linearity_tests.ml @@ -7,6 +7,7 @@ let%expect_test _ = {| File "../../test/contracts/negative/linearity.mligo", line 1, characters 14-39: 1 | type foofoo = {foo : string; foo : int} + ^^^^^^^^^^^^^^^^^^^^^^^^^ Repeated type variable in type. Hint: Change the name. |}]; @@ -48,6 +49,7 @@ let%expect_test _ = File "../../test/contracts/negative/linearity_pattern_matching.mligo", line 4, characters 4-30: 3 | let yy : string = match { a = 1 ; b = 2n ; c = "33" } with 4 | | { a = a ; b = b ; c = a } -> a + ^^^^^^^^^^^^^^^^^^^^^^^^^^ Repeated variable in pattern. Hint: Change the name. |}]; @@ -63,6 +65,7 @@ let%expect_test _ = File "../../test/contracts/negative/linearity_record_pattern_fun.mligo", line 3, characters 12-31: 2 | 3 | let y = fun { foo ; foo ; bar } -> foo + bar + ^^^^^^^^^^^^^^^^^^^ Repeated variable in pattern. Hint: Change the name. |}]; @@ -78,6 +81,7 @@ let%expect_test _ = File "../../test/contracts/negative/linearity_record_pattern_let_in.mligo", line 6, characters 8-27: 5 | let y = 6 | let { foo ; foo ; bar } = x in + ^^^^^^^^^^^^^^^^^^^ 7 | foo + bar Repeated variable in pattern. @@ -89,6 +93,7 @@ let%expect_test _ = File "../../test/contracts/negative/linearity_record_pattern.mligo", line 3, characters 32-51: 2 | 3 | let y (x:foofoo) = match x with { foo ; foo ; bar } -> foo + bar + ^^^^^^^^^^^^^^^^^^^ Repeated variable in pattern. Hint: Change the name. |}] diff --git a/src/bin/expect_tests/michelson_or_tests.ml b/src/bin/expect_tests/michelson_or_tests.ml index 5c72682288..d80392d891 100644 --- a/src/bin/expect_tests/michelson_or_tests.ml +++ b/src/bin/expect_tests/michelson_or_tests.ml @@ -18,6 +18,7 @@ let%expect_test _ = File "../../test/contracts/double_michelson_or.mligo", line 8, characters 6-9: 7 | let foo = (M_right ("one") : storage) in 8 | let bar = (M_right 1 : foobar) in + ^^^ 9 | (([] : operation list), (foo: storage)) : Warning: unused variable "bar". @@ -26,6 +27,7 @@ let%expect_test _ = File "../../test/contracts/double_michelson_or.mligo", line 6, characters 26-31: 5 | 6 | let main (action : unit) (store : storage) : return = + ^^^^^ 7 | let foo = (M_right ("one") : storage) in : Warning: unused variable "store". @@ -34,6 +36,7 @@ let%expect_test _ = File "../../test/contracts/double_michelson_or.mligo", line 6, characters 10-16: 5 | 6 | let main (action : unit) (store : storage) : return = + ^^^^^^ 7 | let foo = (M_right ("one") : storage) in : Warning: unused variable "action". diff --git a/src/bin/expect_tests/michelson_pair_test.ml b/src/bin/expect_tests/michelson_pair_test.ml index 081bf0000f..52b87b01a1 100644 --- a/src/bin/expect_tests/michelson_pair_test.ml +++ b/src/bin/expect_tests/michelson_pair_test.ml @@ -9,6 +9,7 @@ let%expect_test _ = File "../../test/contracts/michelson_pair_tree.mligo", line 6, characters 26-31: 5 | 6 | let main (action : unit) (store : storage) : return = + ^^^^^ 7 | let foo = (3,(1,2n)) in : Warning: unused variable "store". @@ -17,6 +18,7 @@ let%expect_test _ = File "../../test/contracts/michelson_pair_tree.mligo", line 6, characters 10-16: 5 | 6 | let main (action : unit) (store : storage) : return = + ^^^^^^ 7 | let foo = (3,(1,2n)) in : Warning: unused variable "action". @@ -40,15 +42,20 @@ let%expect_test _ = File "../../test/contracts/michelson_pair_tree.jsligo", line 8, character 0 to line 11, character 1: 7 | 8 | let main = (action : unit, store : storage) : return_ => { + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | let foo = [3, [1, 2 as nat]]; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | return [list([]) as list, foo as storage] + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | }; + ^ Toplevel let declaration are silently change to const declaration. File "../../test/contracts/michelson_pair_tree.jsligo", line 8, characters 27-32: 7 | 8 | let main = (action : unit, store : storage) : return_ => { + ^^^^^ 9 | let foo = [3, [1, 2 as nat]]; : Warning: unused variable "store". @@ -57,6 +64,7 @@ let%expect_test _ = File "../../test/contracts/michelson_pair_tree.jsligo", line 8, characters 12-18: 7 | 8 | let main = (action : unit, store : storage) : return_ => { + ^^^^^^ 9 | let foo = [3, [1, 2 as nat]]; : Warning: unused variable "action". diff --git a/src/bin/expect_tests/module_restrict.ml b/src/bin/expect_tests/module_restrict.ml index f811e62a64..36841eb729 100644 --- a/src/bin/expect_tests/module_restrict.ml +++ b/src/bin/expect_tests/module_restrict.ml @@ -7,6 +7,7 @@ let%expect_test _ = {| File "../../test/contracts/negative/modules_access_not_open1.mligo", line 1, characters 12-13: 1 | let y = A.B.(x.z) + ^ Ill-formed selection of a value from a module. At this point, the qualified name of a value is expected. |}]; run_ligo_bad [ "print"; "ast-core"; bad_test "modules_access_not_open2.mligo" ]; @@ -14,6 +15,7 @@ let%expect_test _ = {| File "../../test/contracts/negative/modules_access_not_open2.mligo", line 1, characters 12-13: 1 | let x = A.B.(x + y) + ^ Ill-formed selection of a value from a module. At this point, the qualified name of a value is expected. |}]; run_ligo_bad [ "print"; "ast-core"; bad_test "modules_access_not_open1.jsligo" ]; @@ -21,6 +23,7 @@ let%expect_test _ = {| File "../../test/contracts/negative/modules_access_not_open1.jsligo", line 1, characters 12-13: 1 | let y = A.B.(x.z) + ^ Ill-formed selection of a value in a module. At this point, the qualified name of a value is expected. |}]; run_ligo_bad [ "print"; "ast-core"; bad_test "modules_access_not_open2.jsligo" ]; @@ -28,6 +31,7 @@ let%expect_test _ = {| File "../../test/contracts/negative/modules_access_not_open2.jsligo", line 1, characters 12-13: 1 | let x = A.B.(x + y) + ^ Ill-formed selection of a value in a module. At this point, the qualified name of a value is expected. |}] diff --git a/src/bin/expect_tests/no_color_underline.ml b/src/bin/expect_tests/no_color_underline.ml new file mode 100644 index 0000000000..14abbd1a57 --- /dev/null +++ b/src/bin/expect_tests/no_color_underline.ml @@ -0,0 +1,63 @@ + +open Cli_expect + +let gs s = "../../test/contracts/no_color_underline/" ^ s + +let%expect_test _ = + run_ligo_bad + [ "compile"; "contract"; gs "one_line_error.mligo"; "--no-color" ]; + [%expect{xxx| + File "../../test/contracts/no_color_underline/one_line_error.mligo", line 2, characters 9-68: + 1 | + 2 | let main {| I should be underlined in error message with no-color |} blah-blah + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Ill-formed value declaration. + At this point, one of the following is expected: + * parameters as irrefutable patterns, e.g. variables, if defining a + function; + * the assignment symbol '=' followed by an expression; + * a type annotation starting with a colon ':'; + * a comma ',' followed by another tuple component, if defining a + tuple. |xxx}] + +let%expect_test _ = + run_ligo_bad + [ "compile"; "contract"; gs "two_lines_error.mligo"; "--no-color" ]; + [%expect{xxx| + File "../../test/contracts/no_color_underline/two_lines_error.mligo", line 2, character 9 to line 3, character 32: + 1 | + 2 | let main {| I should be underlined in + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 | error message with no-color |} blah-blah + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Ill-formed value declaration. + At this point, one of the following is expected: + * parameters as irrefutable patterns, e.g. variables, if defining a + function; + * the assignment symbol '=' followed by an expression; + * a type annotation starting with a colon ':'; + * a comma ',' followed by another tuple component, if defining a + tuple. |xxx}] + +let%expect_test _ = + run_ligo_bad + [ "compile"; "contract"; gs "several_lines_error.mligo"; "--no-color" ]; + [%expect{xxx| + File "../../test/contracts/no_color_underline/several_lines_error.mligo", line 2, character 9 to line 5, character 15: + 1 | + 2 | let main {| I should be underlined in + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 3 | error message with no-color and + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 4 | I am a long message spreading + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 5 | on 4 lines |} blah-blah + ^^^^^^^^^^^^^^^ + Ill-formed value declaration. + At this point, one of the following is expected: + * parameters as irrefutable patterns, e.g. variables, if defining a + function; + * the assignment symbol '=' followed by an expression; + * a type annotation starting with a colon ':'; + * a comma ',' followed by another tuple component, if defining a + tuple. |xxx}] diff --git a/src/bin/expect_tests/package_management.ml b/src/bin/expect_tests/package_management.ml index b11c45dc90..d4af6082f6 100644 --- a/src/bin/expect_tests/package_management.ml +++ b/src/bin/expect_tests/package_management.ml @@ -40,6 +40,7 @@ let%expect_test _ = {| File "originate_contract/main.mligo", line 1, characters 0-30: 1 | #import "tezos-ligo-fa2" "FA2" + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | File "tezos-ligo-fa2" not found. |}] @@ -420,6 +421,7 @@ let%expect_test _ = {| File "main.mligo", line 1, characters 0-36: 1 | #import "ligo-breathalyzer" "Breath" + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | File "ligo-breathalyzer" not found. |}]; Caml.Sys.chdir pwd; @@ -436,6 +438,7 @@ let%expect_test _ = {| File "main.mligo", line 1, characters 0-29: 1 | #import "@ligo/bigarray" "BA" + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | File "@ligo/bigarray" not found. |}] diff --git a/src/bin/expect_tests/parametric_types.ml b/src/bin/expect_tests/parametric_types.ml index ae50e27089..64453ce294 100644 --- a/src/bin/expect_tests/parametric_types.ml +++ b/src/bin/expect_tests/parametric_types.ml @@ -65,6 +65,7 @@ let%expect_test _ = {| File "../../test/contracts/negative/parametric_types1.mligo", line 1, characters 20-28: 1 | type fail_big_map = bool map + ^^^^^^^^ Type map is applied to a wrong number of arguments, expected: 2 got: 1 |}] @@ -75,6 +76,7 @@ let%expect_test _ = File "../../test/contracts/negative/parametric_types2.mligo", line 2, characters 11-27: 1 | type 'a foo = 'a * 'a 2 | type bar = (int,string) foo + ^^^^^^^^^^^^^^^^ Type foo is applied to a wrong number of arguments, expected: 1 got: 2 |}] @@ -85,6 +87,7 @@ let%expect_test _ = File "../../test/contracts/negative/parametric_types3.mligo", line 2, characters 11-18: 1 | type ('a,'b,'c) foo = 'a * 'b * 'c 2 | type bar = int foo + ^^^^^^^ Type foo is applied to a wrong number of arguments, expected: 3 got: 1 |}] @@ -94,6 +97,7 @@ let%expect_test _ = {| File "../../test/contracts/negative/parametric_types4.mligo", line 1, characters 9-20: 1 | type x = option list + ^^^^^^^^^^^ Invalid type Ill formed type "option".Hint: you might be missing some type arguments. |}] @@ -104,6 +108,7 @@ let%expect_test _ = {| File "../../test/contracts/negative/parametric_types5.mligo", line 1, characters 0-26: 1 | type ('a,'a) foo = 'a * 'a + ^^^^^^^^^^^^^^^^^^^^^^^^^^ Repeated type variable in type. Hint: Change the name. |}] diff --git a/src/bin/expect_tests/pattern_matching_anomalies.ml b/src/bin/expect_tests/pattern_matching_anomalies.ml index 1a71fd2f56..6dc4b47a0e 100644 --- a/src/bin/expect_tests/pattern_matching_anomalies.ml +++ b/src/bin/expect_tests/pattern_matching_anomalies.ml @@ -12,7 +12,9 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/missing_cases/c.mligo", line 4, character 2 to line 5, character 15: 3 | let s (x : t) = 4 | match x with + ^^^^^^^^^^^^ 5 | One _ -> () + ^^^^^^^^^^^^^^^ Error : this pattern-matching is not exhaustive. Here are examples of cases that are not matched: @@ -26,9 +28,13 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/missing_cases/c_c.mligo", line 6, character 2 to line 9, character 18: 5 | let s (x : t) = 6 | match x with + ^^^^^^^^^^^^ 7 | Two _ -> () + ^^^^^^^^^^^^^^^^^^ 8 | | Three -> () + ^^^^^^^^^^^^^^^^^^ 9 | | One Five -> () + ^^^^^^^^^^^^^^^^^^ Error : this pattern-matching is not exhaustive. Here are examples of cases that are not matched: @@ -42,9 +48,13 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/missing_cases/t_c.mligo", line 7, character 2 to line 10, character 25: 6 | let s (x : t) = 7 | match x with + ^^^^^^^^^^^^ 8 | (n, One, Six) -> () + ^^^^^^^^^^^^^^^^^^^^^^^ 9 | | (n, Two, Six) -> () + ^^^^^^^^^^^^^^^^^^^^^^^ 10 | | (n, Three, Six) -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^ Error : this pattern-matching is not exhaustive. Here are examples of cases that are not matched: @@ -58,9 +68,13 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/missing_cases/r_c.mligo", line 7, character 2 to line 10, character 36: 6 | let s (x : t) = 7 | match x with + ^^^^^^^^^^^^ 8 | { a ; b = One; c = Six } -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | | { a ; b = Two; c = Six } -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | | { a ; b = Three; c = Six } -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error : this pattern-matching is not exhaustive. Here are examples of cases that are not matched: @@ -74,9 +88,13 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/missing_cases/c_t_c.mligo", line 5, character 2 to line 8, character 22: 4 | let s (x : t) = 5 | match x with + ^^^^^^^^^^^^ 6 | One (n, Six) -> () + ^^^^^^^^^^^^^^^^^^^^^^ 7 | | Two -> () + ^^^^^^^^^^^^^^^^^^^^^^ 8 | | Three -> () + ^^^^^^^^^^^^^^^^^^^^^^ Error : this pattern-matching is not exhaustive. Here are examples of cases that are not matched: @@ -90,9 +108,13 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/missing_cases/c_r_c.mligo", line 5, character 2 to line 8, character 29: 4 | let s (x : t) = 5 | match x with + ^^^^^^^^^^^^ 6 | One { a ; b = Six } -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 7 | | Two -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 8 | | Three -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error : this pattern-matching is not exhaustive. Here are examples of cases that are not matched: @@ -106,9 +128,13 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/missing_cases/t_t_c.mligo", line 7, character 2 to line 10, character 35: 6 | let s (x : t) = 7 | match x with + ^^^^^^^^^^^^ 8 | ((_, _, _), (One, Six)) -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | | ((_, _, _), (Two, Six)) -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | | ((_, _, _), (Three, Six)) -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error : this pattern-matching is not exhaustive. Here are examples of cases that are not matched: @@ -122,8 +148,11 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/missing_cases/t_r_c.mligo", line 7, character 2 to line 9, character 40: 6 | let s (x : t) = 7 | match x with + ^^^^^^^^^^^^ 8 | (n, ({ a ; c ; b = One }, s)) -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | | (n, ({ a ; b = Four ; c }, s)) -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error : this pattern-matching is not exhaustive. Here are examples of cases that are not matched: @@ -155,8 +184,11 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/missing_cases/r_t_c.mligo", line 7, character 2 to line 9, character 44: 6 | let s (x : t) = 7 | match x with + ^^^^^^^^^^^^ 8 | { a ; c ; b = ((x, y), (One, z)) } -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | | { a ; b = ((x, y), (Two, z)) ; c } -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error : this pattern-matching is not exhaustive. Here are examples of cases that are not matched: @@ -170,8 +202,11 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/missing_cases/r_r_c.mligo", line 7, character 2 to line 9, character 67: 6 | let s (x : t) = 7 | match x with + ^^^^^^^^^^^^ 8 | { a ; b = { d = { e ; f } ; i = { g = Two ; h } } ; c } -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | | { a ; c ; b = { d = { e ; f } ; i = { g = Three ; h } } } -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error : this pattern-matching is not exhaustive. Here are examples of cases that are not matched: @@ -185,8 +220,11 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/missing_cases/last.mligo", line 2, character 2 to line 4, character 20: 1 | let rec last (xs : int list) : int = 2 | match xs with + ^^^^^^^^^^^^^ 3 | x::[] -> x + ^^^^^^^^^^^^^^ 4 | | _::xs -> last xs + ^^^^^^^^^^^^^^^^^^^^ Error : this pattern-matching is not exhaustive. Here are examples of cases that are not matched: @@ -199,8 +237,11 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/missing_cases/c.jsligo", line 4, character 2 to line 6, character 4: 3 | let s = (x : t) : unit => 4 | match(x, { + ^^^^^^^^^^ 5 | Two: (_ : nat) => unit, + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 6 | }) + ^^^^ Error : this pattern-matching is not exhaustive. Here are examples of cases that are not matched: @@ -214,8 +255,11 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/missing_cases/c_c.jsligo", line 9, character 21 to line 11, character 6: 8 | Three: () => unit, 9 | One: (c : p) => (match(c, { + ^^^^^^^^^^^^ 10 | Four: () => unit + ^^^^^^^^^^^^^^^^^^^^^^ 11 | })) + ^^^^^^ 12 | }) Error : this pattern-matching is not exhaustive. @@ -232,10 +276,15 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/redundant_case/c1_c1_c2_c3.mligo", line 4, character 2 to line 8, character 15: 3 | let s (x : t) = 4 | match x with + ^^^^^^^^^^^^ 5 | One a -> () + ^^^^^^^^^^^^^^^ 6 | | One b -> () + ^^^^^^^^^^^^^^^ 7 | | Two c -> () + ^^^^^^^^^^^^^^^ 8 | | Three -> () + ^^^^^^^^^^^^^^^ Error : this match case is unused. |}] @@ -246,10 +295,15 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/redundant_case/c1_c2_c1_c3.mligo", line 4, character 2 to line 8, character 15: 3 | let s (x : t) = 4 | match x with + ^^^^^^^^^^^^ 5 | One a -> () + ^^^^^^^^^^^^^^^ 6 | | Two c -> () + ^^^^^^^^^^^^^^^ 7 | | One b -> () + ^^^^^^^^^^^^^^^ 8 | | Three -> () + ^^^^^^^^^^^^^^^ Error : this match case is unused. |}] @@ -260,10 +314,15 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/redundant_case/c1_c2_c3_c1.mligo", line 4, character 2 to line 8, character 15: 3 | let s (x : t) = 4 | match x with + ^^^^^^^^^^^^ 5 | One a -> () + ^^^^^^^^^^^^^^^ 6 | | Two c -> () + ^^^^^^^^^^^^^^^ 7 | | Three -> () + ^^^^^^^^^^^^^^^ 8 | | One b -> () + ^^^^^^^^^^^^^^^ Error : this match case is unused. |}] @@ -274,10 +333,15 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/redundant_case/c1_c2_c3_w.mligo", line 4, character 2 to line 8, character 15: 3 | let s (x : t) = 4 | match x with + ^^^^^^^^^^^^ 5 | One a -> () + ^^^^^^^^^^^^^^^ 6 | | Two c -> () + ^^^^^^^^^^^^^^^ 7 | | Three -> () + ^^^^^^^^^^^^^^^ 8 | | _ -> () + ^^^^^^^^^^^^^^^ Error : this match case is unused. |}] @@ -288,10 +352,15 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/redundant_case/c1_w_c2_c3.mligo", line 4, character 2 to line 8, character 15: 3 | let s (x : t) = 4 | match x with + ^^^^^^^^^^^^ 5 | One a -> () + ^^^^^^^^^^^^^^^ 6 | | _ -> () + ^^^^^^^^^^^^^^^ 7 | | Two c -> () + ^^^^^^^^^^^^^^^ 8 | | Three -> () + ^^^^^^^^^^^^^^^ Error : this match case is unused. |}] @@ -302,10 +371,15 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/redundant_case/w_c1_c2_c3.mligo", line 4, character 2 to line 8, character 15: 3 | let s (x : t) = 4 | match x with + ^^^^^^^^^^^^ 5 | _ -> () + ^^^^^^^^^^^^^^^ 6 | | One a -> () + ^^^^^^^^^^^^^^^ 7 | | Two c -> () + ^^^^^^^^^^^^^^^ 8 | | Three -> () + ^^^^^^^^^^^^^^^ Error : this match case is unused. |}] @@ -316,9 +390,13 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/redundant_case/tx_tx_ty.mligo", line 6, character 2 to line 9, character 18: 5 | let s (x : t) = 6 | match x with + ^^^^^^^^^^^^ 7 | (n, One) -> () + ^^^^^^^^^^^^^^^^^^ 8 | | (n, One) -> () + ^^^^^^^^^^^^^^^^^^ 9 | | (n, Two) -> () + ^^^^^^^^^^^^^^^^^^ Error : this match case is unused. |}] @@ -329,9 +407,13 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/redundant_case/tx_w_ty.mligo", line 6, character 2 to line 9, character 18: 5 | let s (x : t) = 6 | match x with + ^^^^^^^^^^^^ 7 | (n, One) -> () + ^^^^^^^^^^^^^^^^^^ 8 | | _ -> () + ^^^^^^^^^^^^^^^^^^ 9 | | (n, Two) -> () + ^^^^^^^^^^^^^^^^^^ Error : this match case is unused. |}] @@ -342,9 +424,13 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/redundant_case/w_tx_ty.mligo", line 6, character 2 to line 9, character 18: 5 | let s (x : t) = 6 | match x with + ^^^^^^^^^^^^ 7 | _ -> () + ^^^^^^^^^^^^^^^^^^ 8 | | (n, One) -> () + ^^^^^^^^^^^^^^^^^^ 9 | | (n, Two) -> () + ^^^^^^^^^^^^^^^^^^ Error : this match case is unused. |}] @@ -355,9 +441,13 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/redundant_case/rx_rx_ry.mligo", line 6, character 2 to line 9, character 25: 5 | let s (x : t) = 6 | match x with + ^^^^^^^^^^^^ 7 | { a ; b = One } -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^ 8 | | { a ; b = One } -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | | { a ; b = Two } -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^ Error : this match case is unused. |}] @@ -368,9 +458,13 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/redundant_case/rx_w_ry.mligo", line 6, character 2 to line 9, character 25: 5 | let s (x : t) = 6 | match x with + ^^^^^^^^^^^^ 7 | { a ; b = One } -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^ 8 | | _ -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | | { a ; b = Two } -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^ Error : this match case is unused. |}] @@ -381,9 +475,13 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/redundant_case/w_rx_ry.mligo", line 6, character 2 to line 9, character 25: 5 | let s (x : t) = 6 | match x with + ^^^^^^^^^^^^ 7 | _ -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^ 8 | | { a ; b = One } -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | | { a ; b = Two } -> () + ^^^^^^^^^^^^^^^^^^^^^^^^^ Error : this match case is unused. |}] @@ -394,11 +492,17 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/redundant_case/c_c.mligo", line 6, character 2 to line 11, character 18: 5 | let s (x : t) = 6 | match x with + ^^^^^^^^^^^^ 7 | One Five -> () + ^^^^^^^^^^^^^^^^^^ 8 | | One Four -> () + ^^^^^^^^^^^^^^^^^^ 9 | | Two c -> () + ^^^^^^^^^^^^^^^^^^ 10 | | Three -> () + ^^^^^^^^^^^^^^^^^^ 11 | | One Four -> () + ^^^^^^^^^^^^^^^^^^ Error : this match case is unused. |}] @@ -409,11 +513,17 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/redundant_case/c1_c1_c2_c3.jsligo", line 4, character 2 to line 9, character 4: 3 | let s = (x : t) : unit => 4 | match(x, { + ^^^^^^^^^^ 5 | One: (a : int) => unit, + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 6 | One: (b : int) => unit, + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 7 | Two: (c : nat) => unit, + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 8 | Three: () => unit + ^^^^^^^^^^^^^^^^^^^^^ 9 | }) + ^^^^ Error : this match case is unused. |}] @@ -424,11 +534,17 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/redundant_case/c1_c2_c1_c3.jsligo", line 4, character 2 to line 9, character 4: 3 | let s = (x : t) : unit => 4 | match(x, { + ^^^^^^^^^^ 5 | One: (a : int) => unit, + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 6 | Two: (c : nat) => unit, + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 7 | One: (b : int) => unit, + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 8 | Three: () => unit + ^^^^^^^^^^^^^^^^^^^^^ 9 | }) + ^^^^ Error : this match case is unused. |}] @@ -439,10 +555,16 @@ let%expect_test _ = File "../../test/contracts/negative//pattern_matching_anomalies/redundant_case/c1_c2_c3_c1.jsligo", line 4, character 2 to line 9, character 4: 3 | let s = (x : t) : unit => 4 | match(x, { + ^^^^^^^^^^ 5 | One: (a : int) => unit, + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 6 | Two: (c : nat) => unit, + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 7 | Three: () => unit, + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 8 | One: (b : int) => unit, + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | }) + ^^^^ Error : this match case is unused. |}] diff --git a/src/bin/expect_tests/pattern_matching_jsligo.ml b/src/bin/expect_tests/pattern_matching_jsligo.ml index 8accc9e5c6..e74ab9fc60 100644 --- a/src/bin/expect_tests/pattern_matching_jsligo.ml +++ b/src/bin/expect_tests/pattern_matching_jsligo.ml @@ -18,8 +18,11 @@ let%expect_test _ = File "../../test/contracts/negative/pattern_match1.jsligo", line 2, character 9 to line 4, character 4: 1 | let test_foo = (x : test_exec_result) : string => { 2 | return match(x, { + ^^^^^^^^^^ 3 | Fail: (_ : test_exec_error) => "", + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | }); + ^^^^ 5 | } Error : this pattern-matching is not exhaustive. @@ -33,6 +36,7 @@ let%expect_test _ = File "../../test/contracts/negative/pattern_match2.jsligo", line 3, characters 13-15: 2 | match(x, { 3 | Success: () => "", + ^^ 4 | Fail: (_ : test_exec_error) => "" Pattern not of the expected type "nat". |}] @@ -44,9 +48,13 @@ let%expect_test _ = File "../../test/contracts/negative/pattern_match5.jsligo", line 2, character 2 to line 5, character 4: 1 | let test_foo = (x : test_exec_result) : string => { 2 | match(x, { + ^^^^^^^^^^ 3 | Success: (x : nat, y : nat) => "", + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | Fail: (_ : test_exec_error) => "" + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 5 | }); + ^^^^ 6 | } Invalid type(s) @@ -59,6 +67,7 @@ let%expect_test _ = File "../../test/contracts/negative/pattern_match3.jsligo", line 4, characters 4-11: 3 | Success: (_ : nat) => "", 4 | Failure: (_ : test_exec_error) => "" + ^^^^^^^ 5 | }); Pattern not of the expected type "test_exec_result". |}] @@ -70,9 +79,13 @@ let%expect_test _ = File "../../test/contracts/negative/pattern_match6.jsligo", line 7, character 19 to line 10, character 10: 6 | return match(state, { 7 | S1: () => (match(action, { + ^^^^^^^^^^^^^^^ 8 | A: () => S1(), + ^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | B: () => S2() + ^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | })), + ^^^^^^^^^^ 11 | S2: () => (match(action, { Error : this pattern-matching is not exhaustive. @@ -85,6 +98,7 @@ let%expect_test _ = {| File "../../test/contracts/negative/pattern_match7.jsligo", line 1, characters 47-60: 1 | let foo = ([a,b,c,d] : [int,int,int]) : int => a + b + c + d; + ^^^^^^^^^^^^^ Invalid type(s) Cannot unify "( ^a * ^b * ^c * ^d )" with "( int * int * int )". diff --git a/src/bin/expect_tests/polymorphism.ml b/src/bin/expect_tests/polymorphism.ml index 46ee25ab49..a3f9066dbc 100644 --- a/src/bin/expect_tests/polymorphism.ml +++ b/src/bin/expect_tests/polymorphism.ml @@ -259,6 +259,7 @@ let%expect_test _ = {| File "./annotate2.mligo", line 1, characters 11-13: 1 | let f (x : _a) = x + ^^ Type "_a" not found. |}] @@ -275,6 +276,7 @@ let%expect_test _ = {| File "./annotate_arrow.mligo", line 1, characters 0-36: 1 | let f (_:unit) (_:nat option) = None + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Cannot monomorphise the expression. The inferred type was "unit -> ∀ a . option (nat) -> option (a)". @@ -287,6 +289,7 @@ let%expect_test _ = File "./constants.mligo", line 5, characters 14-45: 4 | 5 | let m = merge (Map.empty : (int, string) foo) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid type(s) Cannot unify "string" with "int". |}] @@ -350,6 +353,7 @@ let%expect_test _ = File "./unresolved/contract.mligo", line 6, characters 29-31: 5 | let b = List.length ys in 6 | [], (a + b + List.length []) + ^^ Underspecified type "^a". Please add additional annotations. @@ -362,6 +366,7 @@ let%expect_test _ = File "./unresolved/contract2.mligo", line 4, characters 13-15: 3 | let main (_ : int list) (_ : nat) : (operation list * nat) = 4 | [], (one []) + ^^ Underspecified type "^a". Please add additional annotations. @@ -373,6 +378,7 @@ let%expect_test _ = {xxx| File "./unresolved/storage.mligo", line 1, characters 20-22: 1 | let s = List.length [] + ^^ 2 | Underspecified type "^a". @@ -385,6 +391,7 @@ let%expect_test _ = {xxx| File "./unresolved/parameter.mligo", line 1, characters 8-10: 1 | let p = [] + ^^ 2 | Underspecified type "list (^a)". @@ -405,6 +412,7 @@ let%expect_test _ = {| File "./monomorphisation_fail.mligo", line 1, characters 0-28: 1 | let f (_ : unit) s = ([], s) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | Cannot monomorphise the expression. @@ -418,12 +426,19 @@ let%expect_test _ = File "./monomorphisation_fail2.mligo", line 2, character 2 to line 8, character 6: 1 | let nested (type a) = 2 | let x (type b) = + ^^^^^^^^^^^^^^^^ 3 | let y (type c) = + ^^^^^^^^^^^^^^^^^^^^ 4 | let z = + ^^^^^^^^^^^^^ 5 | (failwith("nested") : a -> b -> c) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 6 | in z + ^^^^^^^^^^ 7 | in y + ^^^^^^^^ 8 | in x + ^^^^^^ 9 | Cannot monomorphise the expression. |}] diff --git a/src/bin/expect_tests/protocol_specific.ml b/src/bin/expect_tests/protocol_specific.ml index cb9be03d41..2320a4f7b5 100644 --- a/src/bin/expect_tests/protocol_specific.ml +++ b/src/bin/expect_tests/protocol_specific.ml @@ -10,6 +10,7 @@ let%expect_test _ = File "../../test/contracts/protocol_dalphanet.mligo", line 12, characters 22-23: 11 | 12 | let main (p : bls_l) (s : bool) : operation list * bool = + ^ 13 | (([] : operation list), Tezos.pairing_check p) : Warning: unused variable "s". @@ -31,6 +32,7 @@ let%expect_test _ = File "../../test/contracts/sapling.mligo", line 8, characters 27-32: 7 | 8 | let main (tr : parameter) (store : storage) : return = + ^^^^^ 9 | ([] : operation list), : Warning: unused variable "store". @@ -83,6 +85,7 @@ let%expect_test _ = File "../../test/contracts/negative/emit.mligo", line 3, characters 3-18: 2 | let x = "%lol" in 3 | [Tezos.emit x 12],x + ^^^^^^^^^^^^^^^ Invalid event tag. The tag must be a string literal. |}] diff --git a/src/bin/expect_tests/regressions.ml b/src/bin/expect_tests/regressions.ml index 68b2ad0c5a..4cc8bc49c0 100644 --- a/src/bin/expect_tests/regressions.ml +++ b/src/bin/expect_tests/regressions.ml @@ -10,6 +10,7 @@ let%expect_test _ = File "../../test/contracts/negative/regression_typecheking_recursive_function.mligo", line 2, characters 39-41: 1 | 2 | let rec toto : unit -> int = fun () -> () + ^^ Invalid type(s) Cannot unify "unit" with "int". |}] @@ -21,6 +22,7 @@ let%expect_test _ = File "../../test/contracts/negative/regression_import_scope_B.mligo", line 2, characters 8-11: 1 | 2 | let b = A.a + ^^^ 3 | Module "A" not found. |}] diff --git a/src/bin/expect_tests/reverse_app_operator.ml b/src/bin/expect_tests/reverse_app_operator.ml index 654792f415..f3de0a729b 100644 --- a/src/bin/expect_tests/reverse_app_operator.ml +++ b/src/bin/expect_tests/reverse_app_operator.ml @@ -17,6 +17,7 @@ let%expect_test _ = File "../../test/contracts/negative/error_reverse_app.mligo", line 4, characters 19-26: 3 | 4 | let typing_error = "Hello" |> f + ^^^^^^^ Invalid type(s). Expected "int", but got: "string". |}] @@ -28,6 +29,7 @@ let%expect_test _ = File "../../test/contracts/negative/error_reverse_app_2.mligo", line 6, characters 19-29: 5 | 6 | let typing_error = f 42 |> gg |> h + ^^^^^^^^^^ Invalid type(s) Cannot unify "int -> int" with "int". |}] diff --git a/src/bin/expect_tests/switch_jsligo_syntax_error.ml b/src/bin/expect_tests/switch_jsligo_syntax_error.ml index d45fd7c0ea..f1d8bf0f93 100644 --- a/src/bin/expect_tests/switch_jsligo_syntax_error.ml +++ b/src/bin/expect_tests/switch_jsligo_syntax_error.ml @@ -11,6 +11,7 @@ let%expect_test _ = File "../../test/contracts/negative/switch_jsligo/empty_switch.jsligo", line 4, characters 4-5: 3 | switch (n) { 4 | }; + ^ 5 | output = output + "World"; Ill-formed switch statement. At this point, a case starting with the keyword 'case' is expected. |}] @@ -26,6 +27,7 @@ let%expect_test _ = File "../../test/contracts/negative/switch_jsligo/default_in_between.jsligo", line 10, characters 6-10: 9 | output = output + "###"; 10 | case 3: + ^^^^ 11 | output = output + "@@@"; Ill-formed switch statement. At this point, if the case is complete, one of the following is expected: @@ -43,6 +45,7 @@ let%expect_test _ = File "../../test/contracts/negative/switch_jsligo/more_than_one_default.jsligo", line 14, characters 6-13: 13 | output = output + "###"; 14 | default: + ^^^^^^^ 15 | output = output + "***"; Ill-formed switch statement. At this point, if the case is complete, one of the following is expected: @@ -60,6 +63,7 @@ let%expect_test _ = File "../../test/contracts/negative/switch_jsligo/break_outside_case1.jsligo", line 3, characters 4-9: 2 | let output = "Hello"; 3 | break; + ^^^^^ 4 | return output; Ill-formed block of statements. At this point, one of the following is expected: @@ -77,6 +81,7 @@ let%expect_test _ = File "../../test/contracts/negative/switch_jsligo/break_outside_case2.jsligo", line 4, characters 8-13: 3 | if (output == "") { 4 | break; + ^^^^^ 5 | } else { Ill-formed block of statements. At this point, the first statement is expected. |}] @@ -92,6 +97,7 @@ let%expect_test _ = File "../../test/contracts/negative/switch_jsligo/break_outside_case3.jsligo", line 6, characters 16-21: 5 | if (output == "") { 6 | break; + ^^^^^ 7 | } else { Ill-formed block of statements. At this point, the first statement is expected. |}] @@ -107,6 +113,7 @@ let%expect_test _ = File "../../test/contracts/negative/switch_jsligo/break_outside_case4.jsligo", line 7, characters 16-21: 6 | output = output + "World"; 7 | break; + ^^^^^ 8 | }; Ill-formed block of statements. At this point, one of the following is expected: diff --git a/src/bin/expect_tests/syntax_error_tests.ml b/src/bin/expect_tests/syntax_error_tests.ml index fd02da42bf..07e54c96a2 100644 --- a/src/bin/expect_tests/syntax_error_tests.ml +++ b/src/bin/expect_tests/syntax_error_tests.ml @@ -19,5 +19,6 @@ let%expect_test _ = File "../../test/contracts/negative/export_attr_const.jsligo", line 2, characters 12-18: 1 | export /* @no_mutation */ 2 | const toto: D.titi = E.toto; + ^^^^^^ Module "D" not found. |}] diff --git a/src/bin/expect_tests/tail_rec_warning.ml b/src/bin/expect_tests/tail_rec_warning.ml index 127fbab465..f930487aff 100644 --- a/src/bin/expect_tests/tail_rec_warning.ml +++ b/src/bin/expect_tests/tail_rec_warning.ml @@ -26,6 +26,7 @@ let%expect_test _ = File "../../test/contracts/unused_recursion.mligo", line 9, characters 10-14: 8 | (* parameter shadows fun_name: simple *) 9 | let rec toto : int -> int = fun (toto:int) : int -> let number = toto in number + 1 in + ^^^^ 10 | : Warning: unused recursion . @@ -34,6 +35,7 @@ let%expect_test _ = File "../../test/contracts/unused_recursion.mligo", line 12, characters 10-13: 11 | (* parameter shadows fun_name: complex *) 12 | let rec foo : (int -> int) -> int = fun (foo : (int -> int)) -> let foo = foo 0 in foo in + ^^^ 13 | : Warning: unused recursion . @@ -42,6 +44,7 @@ let%expect_test _ = File "../../test/contracts/unused_recursion.mligo", line 15, characters 10-13: 14 | (* fun_name shadowed in body *) 15 | let rec bar : int -> t = fun (x : int) -> + ^^^ 16 | let bar = x in : Warning: unused recursion . @@ -66,32 +69,59 @@ let%expect_test _ = File "../../test/contracts/unused_recursion.jsligo", line 3, character 0 to line 29, character 1: 2 | 3 | let coucou = (storage : t) : t => { + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | let number = 2; + ^^^^^^^^^^^^^^^^^ 5 | + ^^ 6 | let id = (x : int) : int => x; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 7 | + ^^ 8 | /* parameter shadows fun_name: simple */ + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | let toto = (toto:int) : int => { + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | let number = toto; + ^^^^^^^^^^^^^^^^^^^^^^ 11 | return number + 1; + ^^^^^^^^^^^^^^^^^^^^^^ 12 | }; + ^^^^ 13 | + 14 | /* parameter shadows fun_name: complex */ + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 15 | let foo = (foo : ((p:int) => int)) : int => { + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 16 | let foox = foo(0); + ^^^^^^^^^^^^^^^^^^^^^^ 17 | return foox; + ^^^^^^^^^^^^^^^^ 18 | }; + ^^^^ 19 | + ^^ 20 | /* fun_name shadowed in body */ + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 21 | let bar = (x : int) : t => { + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 22 | let bar = x; + ^^^^^^^^^^^^^^^^ 23 | return { ...storage, bar : bar }; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 24 | }; + ^^^^ 25 | + ^^ 26 | let n = toto(number) + foo(id); + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 27 | + ^^ 28 | return bar(n); + ^^^^^^^^^^^^^^^^^ 29 | } + ^ 30 | Toplevel let declaration are silently change to const declaration. @@ -99,11 +129,17 @@ let%expect_test _ = File "../../test/contracts/unused_recursion.jsligo", line 31, character 0 to line 36, character 1: 30 | 31 | let main = (_ : unit, storage : t) : [list, t] => { + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 32 | return [ + ^^^^^^^^^^ 33 | (list([]) as list), + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 34 | coucou(storage) + ^^^^^^^^^^^^^^^^^^^ 35 | ]; + ^^^^ 36 | } + ^ Toplevel let declaration are silently change to const declaration. @@ -127,32 +163,59 @@ let%expect_test _ = File "../../test/contracts/unused_recursion.jsligo", line 3, character 0 to line 29, character 1: 2 | 3 | let coucou = (storage : t) : t => { + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | let number = 2; + ^^^^^^^^^^^^^^^^^ 5 | + ^^ 6 | let id = (x : int) : int => x; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 7 | + ^^ 8 | /* parameter shadows fun_name: simple */ + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | let toto = (toto:int) : int => { + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | let number = toto; + ^^^^^^^^^^^^^^^^^^^^^^ 11 | return number + 1; + ^^^^^^^^^^^^^^^^^^^^^^ 12 | }; + ^^^^ 13 | + 14 | /* parameter shadows fun_name: complex */ + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 15 | let foo = (foo : ((p:int) => int)) : int => { + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 16 | let foox = foo(0); + ^^^^^^^^^^^^^^^^^^^^^^ 17 | return foox; + ^^^^^^^^^^^^^^^^ 18 | }; + ^^^^ 19 | + ^^ 20 | /* fun_name shadowed in body */ + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 21 | let bar = (x : int) : t => { + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 22 | let bar = x; + ^^^^^^^^^^^^^^^^ 23 | return { ...storage, bar : bar }; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 24 | }; + ^^^^ 25 | + ^^ 26 | let n = toto(number) + foo(id); + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 27 | + ^^ 28 | return bar(n); + ^^^^^^^^^^^^^^^^^ 29 | } + ^ 30 | Toplevel let declaration are silently change to const declaration. @@ -160,11 +223,17 @@ let%expect_test _ = File "../../test/contracts/unused_recursion.jsligo", line 31, character 0 to line 36, character 1: 30 | 31 | let main = (_ : unit, storage : t) : [list, t] => { + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 32 | return [ + ^^^^^^^^^^ 33 | (list([]) as list), + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 34 | coucou(storage) + ^^^^^^^^^^^^^^^^^^^ 35 | ]; + ^^^^ 36 | } + ^ Toplevel let declaration are silently change to const declaration. diff --git a/src/bin/expect_tests/top_level_binding_pattern_cameligo.ml b/src/bin/expect_tests/top_level_binding_pattern_cameligo.ml index b70853a694..60494120c9 100644 --- a/src/bin/expect_tests/top_level_binding_pattern_cameligo.ml +++ b/src/bin/expect_tests/top_level_binding_pattern_cameligo.ml @@ -131,6 +131,7 @@ let%expect_test _ = File "../../test/contracts/top_level_patterns/negative/cameligo/inside_module.mligo", line 2, characters 7-11: 1 | module A = struct 2 | let (x, x) = (1, "string") + ^^^^ 3 | end Repeated variable in pattern. @@ -143,6 +144,7 @@ let%expect_test _ = File "../../test/contracts/top_level_patterns/negative/cameligo/inside_mod_in.mligo", line 3, characters 9-13: 2 | module A = struct 3 | let (x, x) = (1, "1") + ^^^^ 4 | end in Repeated variable in pattern. @@ -155,9 +157,13 @@ let%expect_test _ = File "../../test/contracts/top_level_patterns/negative/cameligo/nested_record.mligo", line 8, character 4 to line 11, character 5: 7 | } 8 | let { a = { c = c1 ; d = d1 ; e = e1 } + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | ; b = { c = c2 ; d = d2 ; e = e2 } + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | ; c = { c = c3 ; d = c1 ; e = e3 } + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | } = r + ^^^^^ Repeated variable in pattern. Hint: Change the name. |}] @@ -169,6 +175,7 @@ let%expect_test _ = File "../../test/contracts/top_level_patterns/negative/cameligo/nested_tuple.mligo", line 2, characters 5-45: 1 | let r = ((1n, 1, "H"), (2n, 2, "E"), (3n, 3, "Hello")) 2 | let ((a1, a2, a3), (b1, a2, b3), (c1, c2, c3)) = r + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Repeated variable in pattern. Hint: Change the name. |}] @@ -180,6 +187,7 @@ let%expect_test _ = File "../../test/contracts/top_level_patterns/negative/cameligo/record.mligo", line 4, characters 4-21: 3 | let r = { a = 1n ; b = 1 ; c = "Hello" } 4 | let { a ; b = a ; c } = r + ^^^^^^^^^^^^^^^^^ Repeated variable in pattern. Hint: Change the name. |}] @@ -191,6 +199,7 @@ let%expect_test _ = File "../../test/contracts/top_level_patterns/negative/cameligo/tuple.mligo", line 2, characters 5-12: 1 | let r = (1n, 1, "Hello") 2 | let (a, a, c) = r + ^^^^^^^ Repeated variable in pattern. Hint: Change the name. |}] @@ -202,9 +211,13 @@ let%expect_test _ = File "../../test/contracts/top_level_patterns/negative/cameligo/record_tuple.mligo", line 10, character 4 to line 13, character 5: 9 | } 10 | let { a = (a1, a2, a3) + ^^^^^^^^^^^^^^^^^^ 11 | ; b = (b1, a2, b3) + ^^^^^^^^^^^^^^^^^^^^^^ 12 | ; c = (c1, c2, c3) + ^^^^^^^^^^^^^^^^^^^^^^ 13 | } = r + ^^^^^ Repeated variable in pattern. Hint: Change the name. |}] @@ -216,8 +229,11 @@ let%expect_test _ = File "../../test/contracts/top_level_patterns/negative/cameligo/tuple_record.mligo", line 7, character 6 to line 9, character 34: 6 | ) 7 | let ( { a = a1 ; b = b1 ; c = c1 } + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 8 | , { a = a2 ; b = b2 ; c = a2 } + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | , { a = a3 ; b = b3 ; c = c3 } + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | ) = r Repeated variable in pattern. @@ -238,6 +254,7 @@ let%expect_test _ = File "../../test/contracts/top_level_patterns/negative/cameligo/ticket_record.mligo", line 3, characters 6-7: 2 | 3 | let { b } = { b = Option.unopt (Tezos.create_ticket "one" 10n) } + ^ 4 | : Warning: variable "b" cannot be used more than once. @@ -245,6 +262,7 @@ let%expect_test _ = File "../../test/contracts/top_level_patterns/negative/cameligo/ticket_record.mligo", line 3, characters 6-7: 2 | 3 | let { b } = { b = Option.unopt (Tezos.create_ticket "one" 10n) } + ^ 4 | : Warning: variable "b" cannot be used more than once. @@ -274,12 +292,14 @@ let%expect_test _ = {| File "../../test/contracts/top_level_patterns/negative/cameligo/ticket_tuple.mligo", line 1, characters 5-6: 1 | let (b, _) = (Option.unopt (Tezos.create_ticket "one" 10n), 1) + ^ 2 | : Warning: variable "b" cannot be used more than once. File "../../test/contracts/top_level_patterns/negative/cameligo/ticket_tuple.mligo", line 1, characters 5-6: 1 | let (b, _) = (Option.unopt (Tezos.create_ticket "one" 10n), 1) + ^ 2 | : Warning: variable "b" cannot be used more than once. @@ -313,6 +333,7 @@ let%expect_test _ = File "../../test/contracts/top_level_patterns/negative/cameligo/constr_record_destructuring.mligo", line 4, characters 0-62: 3 | 4 | let { a ; b = (Foo x) ; c} = { a = 1 ; b = Foo 2 ; c = "hey" } + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 5 | Error : this pattern-matching is not exhaustive. @@ -332,6 +353,7 @@ let%expect_test _ = File "../../test/contracts/top_level_patterns/negative/cameligo/constr_tuple_destructuring.mligo", line 3, characters 0-40: 2 | 3 | let (a, (Foo x), c) = (1, Foo 2, "hey") + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | Error : this pattern-matching is not exhaustive. @@ -345,7 +367,9 @@ let%expect_test _ = File "../../test/contracts/top_level_patterns/negative/cameligo/constr_let_in.mligo", line 4, character 2 to line 5, character 4: 3 | let test = 4 | let B = B in + ^^^^^^^^^^^^ 5 | () + ^^^^ Error : this pattern-matching is not exhaustive. Here are examples of cases that are not matched: @@ -358,7 +382,9 @@ let%expect_test _ = File "../../test/contracts/top_level_patterns/negative/cameligo/constr_let_in2.mligo", line 2, character 2 to line 3, character 4: 1 | let test = 2 | let True = true in + ^^^^^^^^^^^^^^^^^^ 3 | 42 + ^^^^ Error : this pattern-matching is not exhaustive. Here are examples of cases that are not matched: diff --git a/src/bin/expect_tests/top_level_binding_pattern_jsligo.ml b/src/bin/expect_tests/top_level_binding_pattern_jsligo.ml index ee9ffccf1b..959ceb5b31 100644 --- a/src/bin/expect_tests/top_level_binding_pattern_jsligo.ml +++ b/src/bin/expect_tests/top_level_binding_pattern_jsligo.ml @@ -53,6 +53,7 @@ let%expect_test _ = File "../../test/contracts/top_level_patterns/negative/jsligo/nested_tuple.jsligo", line 2, characters 26-28: 1 | const r = [[1 as nat, 1, "H"], [2 as nat, 2, "E"], [3 as nat, 3, "Hello"]] 2 | const [[a1, a2, a3], [b1, a2, b3], [c1, c2, c3]] = r + ^^ Duplicate identifier. |}] @@ -68,6 +69,7 @@ let%expect_test _ = File "../../test/contracts/top_level_patterns/negative/jsligo/tuple.jsligo", line 2, characters 10-11: 1 | const r = [1 as nat, 1, "Hello"] 2 | const [a, a, c] = r + ^ Duplicate identifier. |}] @@ -96,6 +98,7 @@ let%expect_test _ = File "../../test/contracts/top_level_patterns/negative/jsligo/ticket_record.jsligo", line 3, characters 8-9: 2 | 3 | const { b } = { b : Option.unopt(Tezos.create_ticket("one", 10 as nat)) } + ^ 4 | : Warning: variable "b" cannot be used more than once. @@ -103,6 +106,7 @@ let%expect_test _ = File "../../test/contracts/top_level_patterns/negative/jsligo/ticket_record.jsligo", line 3, characters 8-9: 2 | 3 | const { b } = { b : Option.unopt(Tezos.create_ticket("one", 10 as nat)) } + ^ 4 | : Warning: variable "b" cannot be used more than once. @@ -132,12 +136,14 @@ let%expect_test _ = {| File "../../test/contracts/top_level_patterns/negative/jsligo/ticket_tuple.jsligo", line 1, characters 7-8: 1 | const [b, _] = [Option.unopt(Tezos.create_ticket("one", 10 as nat)), 1] + ^ 2 | : Warning: variable "b" cannot be used more than once. File "../../test/contracts/top_level_patterns/negative/jsligo/ticket_tuple.jsligo", line 1, characters 7-8: 1 | const [b, _] = [Option.unopt(Tezos.create_ticket("one", 10 as nat)), 1] + ^ 2 | : Warning: variable "b" cannot be used more than once. diff --git a/src/bin/expect_tests/transpilation.ml b/src/bin/expect_tests/transpilation.ml index 359ac3d1ac..dcaddd79cb 100644 --- a/src/bin/expect_tests/transpilation.ml +++ b/src/bin/expect_tests/transpilation.ml @@ -125,6 +125,7 @@ let%expect_test _ = File "../../test/contracts/transpile_warn_shadowing.jsligo", line 12, characters 6-7: 11 | const x = 42; 12 | const x = 33; + ^ 13 | Duplicate identifier. |}] diff --git a/src/bin/expect_tests/typer_error_tests.ml b/src/bin/expect_tests/typer_error_tests.ml index cecbe1c4b7..877f6ed7c9 100644 --- a/src/bin/expect_tests/typer_error_tests.ml +++ b/src/bin/expect_tests/typer_error_tests.ml @@ -11,6 +11,7 @@ let%expect_test _ = {| File "../../test/contracts/negative/error_function_annotation_1.mligo", line 1, characters 26-27: 1 | let main (a:int) : unit = a + ^ Invalid type(s) Cannot unify "int" with "unit". |}]; @@ -26,6 +27,7 @@ let%expect_test _ = {| File "../../test/contracts/negative/error_function_annotation_2.mligo", line 1, characters 14-43: 1 | let f : int = fun (x, y : int*int) -> x + y + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | let g (x, y : int * int) : int = f (x, y) Invalid type(s) @@ -43,6 +45,7 @@ let%expect_test _ = File "../../test/contracts/negative/error_function_annotation_3.mligo", line 8, characters 14-20: 7 | match s with 8 | | Add si -> Add si + ^^^^^^ 9 | | Sub si -> Sub si Invalid type(s) @@ -74,6 +77,7 @@ let%expect_test _ = File "../../test/contracts/negative/error_type_record_access.mligo", line 6, characters 17-20: 5 | let bar (x : foo) : int = 6 | let y : bool = x.i in + ^^^ 7 | 42 Invalid type(s) @@ -89,6 +93,7 @@ let%expect_test _ = File "../../test/contracts/negative/error_type_record_update.mligo", line 7, characters 23-26: 6 | let bar (x : foo) : foo = 7 | let x = { x with i = x.j } in + ^^^ 8 | x Invalid type(s) @@ -104,6 +109,7 @@ let%expect_test _ = File "../../test/contracts/negative/error_typer_1.mligo", line 3, characters 19-27: 2 | 3 | let foo : string = 42 + 127 + ^^^^^^^^ 4 | Invalid type(s) @@ -119,6 +125,7 @@ let%expect_test _ = File "../../test/contracts/negative/error_typer_2.mligo", line 3, characters 24-39: 2 | 3 | let foo : string list = Some (42 + 127) + ^^^^^^^^^^^^^^^ 4 | Invalid type(s) @@ -134,6 +141,7 @@ let%expect_test _ = File "../../test/contracts/negative/error_typer_3.mligo", line 3, characters 34-53: 2 | 3 | let foo : (int * string * bool) = ((1, "foo") : toto) + ^^^^^^^^^^^^^^^^^^^ 4 | Invalid type(s) @@ -149,6 +157,7 @@ let%expect_test _ = File "../../test/contracts/negative/error_typer_4.mligo", line 4, characters 17-56: 3 | 4 | let foo : tata = ({a = 1 ; b = "foo" ; c = true} : toto) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 5 | Invalid type(s) @@ -163,6 +172,7 @@ let%expect_test _ = {| File "../../test/contracts/negative/error_typer_5.mligo", line 1, characters 10-17: 1 | let foo : boolean = 3 + ^^^^^^^ 2 | Type "boolean" not found. |}]; @@ -176,6 +186,7 @@ let%expect_test _ = {| File "../../test/contracts/negative/error_typer_6.mligo", line 1, characters 30-64: 1 | let foo : (int, string) map = (Map.literal [] : (int, bool) map) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | let main (p:int) (storage : int) = Invalid type(s) @@ -191,6 +202,7 @@ let%expect_test _ = File "../../test/contracts/negative/error_typer_7.mligo", line 4, characters 18-48: 3 | 4 | let foo : tata = ({a = 1 ; b = "foo" ; c = true} : toto) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 5 | Mismatching record labels. Expected record of type "toto". |}]; @@ -205,8 +217,11 @@ let%expect_test _ = File "../../test/contracts/negative/error_typer_1.jsligo", line 5, character 0 to line 7, character 1: 4 | 5 | let addone = (oldStorage: nat) : nat => { + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 6 | return oldStorage + (1 as nat); + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 7 | } + ^ 8 | Toplevel let declaration are silently change to const declaration. @@ -214,15 +229,20 @@ let%expect_test _ = File "../../test/contracts/negative/error_typer_1.jsligo", line 9, character 0 to line 12, character 1: 8 | 9 | let main = (param : action, oldStorage : storage) : [list, storage] => { + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | let newStorage : storage = addone (oldStorage, 1 as nat); + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | return [list([]) as list, newStorage]; + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 12 | } + ^ Toplevel let declaration are silently change to const declaration. File "../../test/contracts/negative/error_typer_1.jsligo", line 10, characters 31-60: 9 | let main = (param : action, oldStorage : storage) : [list, storage] => { 10 | let newStorage : storage = addone (oldStorage, 1 as nat); + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | return [list([]) as list, newStorage]; Invalid type. @@ -234,6 +254,7 @@ let%expect_test _ = File "../../test/contracts/negative/id.mligo", line 45, characters 26-40: 44 | let updated_identities: (id, id_details) big_map = 45 | Big_map.update new_id new_id_details identities + ^^^^^^^^^^^^^^ 46 | in Invalid type(s) @@ -269,6 +290,7 @@ let%expect_test _ = File "../../test/contracts/negative/invalid_field_record_update.mligo", line 4, characters 27-55: 3 | let main (p:int) (storage : abc) = 4 | (([] : operation list) , { storage with nofield=2048} ) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Invalid record field "nofield" in record. |}] @@ -284,6 +306,7 @@ let%expect_test _ = File "../../test/contracts/negative/override_option.mligo", line 3, characters 57-61: 2 | 3 | let main (x : bool) (y : bool) = ([] : operation list), (None : option) + ^^^^ Constructor "None" not found. |}] @@ -299,6 +322,7 @@ let%expect_test _ = File "../../test/contracts/negative/will_be_ignored.mligo", line 7, characters 47-62: 6 | let receiver : contract = 7 | match (Tezos.get_contract_opt(s.owner) : contract option) with + ^^^^^^^^^^^^^^^ 8 | Some (contract) -> contract Invalid type @@ -375,6 +399,7 @@ let%expect_test _ = File "../../test/contracts/negative/typer_unify_error_diff/int_vs_nat.mligo", line 4, characters 16-17: 3 | let x : int = 42 in 4 | let y : nat = x in + ^ 5 | ([] : operation list), s Invalid type(s) @@ -394,6 +419,7 @@ let%expect_test _ = File "../../test/contracts/negative/typer_unify_error_diff/int_vs_tuple.mligo", line 4, characters 31-32: 3 | let x : int = 42 in 4 | let y : nat * int * string = x in + ^ 5 | ([] : operation list), s Invalid type(s) @@ -441,6 +467,7 @@ let%expect_test _ = File "../../test/contracts/negative/typer_unify_error_diff/tuple_vs_tuple_1.mligo", line 4, characters 40-41: 3 | let y : string * int * int * string = "foo", 42, 24, "bar" in 4 | let x : tez * nat * tez = y in + ^ 5 | ([] : operation list), s Invalid type(s) @@ -471,6 +498,7 @@ let%expect_test _ = File "../../test/contracts/negative/typer_unify_error_diff/tuple_vs_tuple_2.mligo", line 4, characters 53-54: 3 | let x : string * int * nat * int * string = "foo" , 42 , 24n , 42 , "bar" in 4 | let _y : tez * int * tez * nat * string = x in + ^ 5 | // ^^^^^^ ^^^ ^^^ Invalid type(s) @@ -492,6 +520,7 @@ let%expect_test _ = File "../../test/contracts/negative/typer_unify_error_diff/tuple_vs_tuple_3.mligo", line 4, characters 59-60: 3 | let x : string * int * nat * tez * string * int = "foo" , 42 , 24n , 42tez , "bar", 42 in 4 | let _y : tez * int * tez * nat * string = x in + ^ 5 | // ^^^^^^ ^^^ ^^^ ^^^ Invalid type(s) @@ -523,6 +552,7 @@ let%expect_test _ = File "../../test/contracts/negative/typer_unify_error_diff/tuple_vs_tuple_4.mligo", line 4, characters 72-73: 3 | let x : int * nat * int * nat * int * nat = 42 , 4n , 42 , 24n , 42 , 24n in 4 | let _y : int * tez * string * nat * int * address * int * tez * nat = x in + ^ 5 | // ^^^ ^^^^^^ ^^^^^^^ ^^^ Invalid type(s) @@ -595,6 +625,7 @@ let%expect_test _ = File "../../test/contracts/negative/typer_unify_error_diff/subtuples_1.mligo", line 4, characters 71-72: 3 | let x : int * string * (nat * tez * nat) * tez = 1, "a", (1n, 1tez, 1n), 1tez in 4 | let _y : int * (nat * tez * int) * string * tez * address = x in + ^ 5 | // ^^^^^^ ^^^ ^^^^^^ ^^^^^^^ Invalid type(s) @@ -639,6 +670,7 @@ let%expect_test _ = File "../../test/contracts/negative/typer_unify_error_diff/subtuples_2.mligo", line 9, characters 48-49: 8 | let x : int * s * nat = 42, (1n, 1tez, 1tez, 1n), 1n in 9 | let _y : int * s1 * s2 * s_close * s2 * nat = x in + ^ 10 | ([] : operation list), s Invalid type(s) @@ -672,6 +704,7 @@ let%expect_test _ = File "../../test/contracts/negative/typer_unify_error_diff/tuple_lists.mligo", line 4, characters 65-66: 3 | let x : (string * int * nat * int * string * int) list = [ "foo" , 42 , 24n , 42 , "bar", 42 ] in 4 | let y : (tez * int * tez * nat * string) list = x in + ^ 5 | // ^^^^^^ ^^^ ^^^ ^^^ Invalid type(s) @@ -714,6 +747,7 @@ let%expect_test _ = File "../../test/contracts/negative/typer_unify_error_diff/record_vs_record.mligo", line 4, characters 47-48: 3 | let y : {foo : int ; bar : (nat * string)} = {foo = 1 ; bar = (2n, "lol") } in 4 | let x : {foo : int ; bar : (nat * nat )} = y in + ^ 5 | // ^^^^^^ Invalid type(s) @@ -737,6 +771,7 @@ let%expect_test _ = File "../../test/contracts/negative/typer_unify_error_diff/record_vs_record_2.mligo", line 4, characters 67-68: 3 | let y : {foo : int ; bar : (nat * string) ; third_field : tez} = {foo = 1 ; bar = (2n, "lol") ; third_field = 42tez } in 4 | let x : {foo : int ; bar : (nat * nat )} = y in + ^ 5 | // ^^^^^^ ^^^^^^^^^^^^^^^^^ Invalid type(s) @@ -765,6 +800,7 @@ let%expect_test _ = File "../../test/contracts/negative/typer_unify_error_diff/arrow_vs_arrow.mligo", line 4, characters 45-46: 3 | let x : int -> nat -> nat -> tez = (fun _x _y _z -> 1tez) in 4 | let _y : int -> int -> int -> int -> nat = x in + ^ 5 | // ^^^ ^^^ ^^^ ^^^ Invalid type(s) diff --git a/src/bin/expect_tests/vars_consts.ml b/src/bin/expect_tests/vars_consts.ml index 9891e6d6d4..9c9315b519 100644 --- a/src/bin/expect_tests/vars_consts.ml +++ b/src/bin/expect_tests/vars_consts.ml @@ -12,6 +12,7 @@ let%expect_test _ = File "../../test/contracts/negative/vars_consts/match.jsligo", line 7, characters 23-24: 6 | let store2 = match (action, { 7 | Add: (n: int) => { n = 42; return n; }, + ^ 8 | Sub: (n: int) => { n = 42; return -n; } Mutable variable "n" not found. |}] @@ -47,6 +48,7 @@ let%expect_test _ = File "../../test/contracts/negative/vars_consts/assign_consts.jsligo", line 3, characters 2-3: 2 | const [x, y] = [4, 5]; 3 | x = 1; + ^ 4 | return (x + y + z); Mutable variable "x" not found. |}] @@ -105,6 +107,7 @@ let%expect_test _ = File "../../test/contracts/negative/vars_consts/assign_const_param.jsligo", line 5, characters 5-8: 4 | const age: int = 3; // does not give an error 5 | age = 42; // does give an error + ^^^ 6 | return age; Mutable variable "age" not found. |}] @@ -116,6 +119,7 @@ let%expect_test _ = File "../../test/contracts/negative/vars_consts/assign_const_param_2.jsligo", line 2, characters 2-3: 1 | let x = (a: int): int => { 2 | a = 42; + ^ 3 | return a; Mutable variable "a" not found. |}] @@ -127,6 +131,7 @@ let%expect_test _ = File "../../test/contracts/negative/vars_consts/multiple_vars_1.jsligo", line 4, characters 4-5: 3 | const [x,y] = [4,5]; 4 | x = 2; + ^ 5 | y = 3; Mutable variable "x" not found. |}] @@ -138,6 +143,7 @@ let%expect_test _ = File "../../test/contracts/negative/vars_consts/multiple_vars_2.jsligo", line 4, characters 44-45: 3 | let [x,y] = [4,5]; 4 | let add = (_ : unit) : int => { return (x + y); }; + ^ 5 | return add(); Invalid capture of mutable variable "x" |}] diff --git a/src/bin/expect_tests/view.ml b/src/bin/expect_tests/view.ml index 0d83e10283..b89769841c 100644 --- a/src/bin/expect_tests/view.ml +++ b/src/bin/expect_tests/view.ml @@ -30,6 +30,7 @@ let%expect_test _ = File "../../test/contracts/view.mligo", line 3, characters 12-14: 2 | 3 | [@view] let v1 (n : int) (s: int) : int = s + n + 1 + ^^ 4 | let v2 (_ : int) (s: int) : int = s + 2 Warning: This view will be ignored, command line option override [ @@ -48,6 +49,7 @@ let%expect_test _ = File "../../test/contracts/view.mligo", line 5, characters 4-12: 4 | let v2 (_ : int) (s: int) : int = s + 2 5 | let bad_view (_ : int) (_: nat) : nat = 1n + ^^^^^^^^ 6 | Invalid type for view "main#11". @@ -88,6 +90,7 @@ let%expect_test _ = File "../../test/contracts/view_restrictions.mligo", line 7, characters 10-70: 6 | let bad_view1 (n : int) (s : int) : int = 7 | let _ = Tezos.create_contract main (None : key_hash option) 0mutez 2 in + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 8 | s + n + 1 View rule violated: @@ -149,6 +152,7 @@ let%expect_test _ = File "../../test/contracts/negative/views_shadow.mligo", line 3, characters 12-14: 2 | 3 | [@view] let v1 (n : int) (s: int) : int = s + n + 1 + ^^ 4 | let v1 (n : int) (s: int) : int = s + n + 111111 This declaration holds an annotation and is later shadowed. |}] @@ -160,6 +164,7 @@ let%expect_test _ = File "../../test/contracts/negative/views_shadow_top_pat.mligo", line 3, characters 12-14: 2 | 3 | [@view] let v1 = fun (n : int) (s : int) : int -> s + n + 1 + ^^ 4 | let v1 = fun (n : int) (s: int) : int -> s + n + 111111 This declaration holds an annotation and is later shadowed. |}] diff --git a/src/bin/expect_tests/warnings.ml b/src/bin/expect_tests/warnings.ml index 9ff914f306..59c8257b25 100644 --- a/src/bin/expect_tests/warnings.ml +++ b/src/bin/expect_tests/warnings.ml @@ -10,6 +10,7 @@ let%expect_test _ = File "../../test/contracts/warning_unused.mligo", line 11, characters 6-7: 10 | let x = s.x + 3 in 11 | let x = foo x in + ^ 12 | let x = bar s.x in : Warning: unused variable "x". @@ -48,6 +49,7 @@ let%expect_test _ = File "../../test/contracts/warning_duplicate.mligo", line 2, characters 2-65: 1 | module Foo = struct 2 | let x : nat ticket = Option.unopt (Tezos.create_ticket 42n 42n) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 | end : Warning: variable "Foo.x" cannot be used more than once. @@ -69,6 +71,7 @@ let%expect_test _ = {| File "../../test/contracts/warning_duplicate2.mligo", line 1, characters 4-5: 1 | let x = Tezos.create_ticket 42n 42n + ^ 2 | let x = (x, x) : Warning: variable "x" cannot be used more than once. @@ -84,6 +87,7 @@ let%expect_test _ = File "../../test/contracts/duplicate_ticket_local_module.mligo", line 8, characters 4-26: 7 | let ticket = Option.unopt (Tezos.create_ticket 10n 10n) 8 | let y = ticket, ticket + ^^^^^^^^^^^^^^^^^^^^^^ 9 | end in : Warning: variable "B.y" cannot be used more than once. @@ -91,6 +95,7 @@ let%expect_test _ = File "../../test/contracts/duplicate_ticket_local_module.mligo", line 7, characters 8-14: 6 | module B = struct 7 | let ticket = Option.unopt (Tezos.create_ticket 10n 10n) + ^^^^^^ 8 | let y = ticket, ticket : Warning: variable "ticket" cannot be used more than once. @@ -129,6 +134,7 @@ let%expect_test _ = File "../../test/contracts/warning_ambiguous_ctor.mligo", line 9, characters 66-69: 8 | (* here we expect a warning because both A constructor have the same parameter type *) 9 | let main = fun (() : unit) (_: union_b) -> ([]: operation list) , A 1 + ^^^ Warning: The type of "A(1)" is ambiguous: Inferred type is "union_b" but could be of type "union_a". Hint: You might want to add a type annotation. @@ -150,6 +156,7 @@ let%expect_test _ = File "../../test/contracts/warning_sum_types.mligo", line 65, characters 14-23: 64 | 65 | let warn_me = TopTop 42 + ^^^^^^^^^ 66 | let warn_me = TopA 42 Warning: The type of "TopTop(42)" is ambiguous: Inferred type is "ttop2" but could be of type "ttop". @@ -158,6 +165,7 @@ let%expect_test _ = File "../../test/contracts/warning_sum_types.mligo", line 66, characters 14-21: 65 | let warn_me = TopTop 42 66 | let warn_me = TopA 42 + ^^^^^^^ 67 | let warn_me = TopB 42 Warning: The type of "TopA(42)" is ambiguous: Inferred type is "ttop" but could be of type "ta". @@ -166,6 +174,7 @@ let%expect_test _ = File "../../test/contracts/warning_sum_types.mligo", line 67, characters 14-21: 66 | let warn_me = TopA 42 67 | let warn_me = TopB 42 + ^^^^^^^ 68 | Warning: The type of "TopB(42)" is ambiguous: Inferred type is "ttop" but could be of type "tb". @@ -174,6 +183,7 @@ let%expect_test _ = File "../../test/contracts/warning_sum_types.mligo", line 69, characters 14-19: 68 | 69 | let warn_me = BA 42 + ^^^^^ 70 | let warn_me = BB 42 Warning: The type of "BA(42)" is ambiguous: Inferred type is "tb" but could be of type "ta". @@ -182,6 +192,7 @@ let%expect_test _ = File "../../test/contracts/warning_sum_types.mligo", line 70, characters 14-19: 69 | let warn_me = BA 42 70 | let warn_me = BB 42 + ^^^^^ 71 | let warn_me = AA 42 Warning: The type of "BB(42)" is ambiguous: Inferred type is "tb" but could be of type "tb2". @@ -190,6 +201,7 @@ let%expect_test _ = File "../../test/contracts/warning_sum_types.mligo", line 71, characters 14-19: 70 | let warn_me = BB 42 71 | let warn_me = AA 42 + ^^^^^ 72 | Warning: The type of "AA(42)" is ambiguous: Inferred type is "ta" but could be of type "ta2". @@ -198,6 +210,7 @@ let%expect_test _ = File "../../test/contracts/warning_sum_types.mligo", line 73, characters 14-19: 72 | 73 | let warn_me = BN 42 + ^^^^^ 74 | let warn_me = AN 42 (* TODO : It should infer ta and warn about tn and not the contrary *) Warning: The type of "BN(42)" is ambiguous: Inferred type is "tb" but could be of type "tn". @@ -206,6 +219,7 @@ let%expect_test _ = File "../../test/contracts/warning_sum_types.mligo", line 74, characters 14-19: 73 | let warn_me = BN 42 74 | let warn_me = AN 42 (* TODO : It should infer ta and warn about tn and not the contrary *) + ^^^^^ 75 | let warn_me = NN 42 Warning: The type of "AN(42)" is ambiguous: Inferred type is "tn" but could be of type "ta". @@ -214,6 +228,7 @@ let%expect_test _ = File "../../test/contracts/warning_sum_types.mligo", line 75, characters 14-19: 74 | let warn_me = AN 42 (* TODO : It should infer ta and warn about tn and not the contrary *) 75 | let warn_me = NN 42 + ^^^^^ 76 | Warning: The type of "NN(42)" is ambiguous: Inferred type is "tn" but could be of type "tn2". @@ -222,6 +237,7 @@ let%expect_test _ = File "../../test/contracts/warning_sum_types.mligo", line 77, characters 14-22: 76 | 77 | let warn_me = TopS1 42 + ^^^^^^^^ 78 | let warn_me = TopS2 42 Warning: The type of "TopS1(42)" is ambiguous: Inferred type is "ttop" but could be of type "ts1". @@ -230,6 +246,7 @@ let%expect_test _ = File "../../test/contracts/warning_sum_types.mligo", line 78, characters 14-22: 77 | let warn_me = TopS1 42 78 | let warn_me = TopS2 42 + ^^^^^^^^ 79 | let dont_warn_me = TopS3 42 Warning: The type of "TopS2(42)" is ambiguous: Inferred type is "ttop" but could be of type "ts2". diff --git a/src/test/contracts/no_color_underline/one_line_error.mligo b/src/test/contracts/no_color_underline/one_line_error.mligo new file mode 100644 index 0000000000..0a6fb28fdd --- /dev/null +++ b/src/test/contracts/no_color_underline/one_line_error.mligo @@ -0,0 +1,2 @@ + +let main {| I should be underlined in error message with no-color |} blah-blah diff --git a/src/test/contracts/no_color_underline/several_lines_error.mligo b/src/test/contracts/no_color_underline/several_lines_error.mligo new file mode 100644 index 0000000000..5bfa97d9d2 --- /dev/null +++ b/src/test/contracts/no_color_underline/several_lines_error.mligo @@ -0,0 +1,5 @@ + +let main {| I should be underlined in + error message with no-color and + I am a long message spreading + on 4 lines |} blah-blah \ No newline at end of file diff --git a/src/test/contracts/no_color_underline/two_lines_error.mligo b/src/test/contracts/no_color_underline/two_lines_error.mligo new file mode 100644 index 0000000000..62b812ad1e --- /dev/null +++ b/src/test/contracts/no_color_underline/two_lines_error.mligo @@ -0,0 +1,3 @@ + +let main {| I should be underlined in + error message with no-color |} blah-blah diff --git a/vendored-dune/ligo-utils/simple-utils/snippet.ml b/vendored-dune/ligo-utils/simple-utils/snippet.ml index e555e505a5..5f2821f923 100644 --- a/vendored-dune/ligo-utils/simple-utils/snippet.ml +++ b/vendored-dune/ligo-utils/simple-utils/snippet.ml @@ -25,6 +25,11 @@ let print_code ~(no_colour:bool) ppf (region : Region.t) (in_chan : In_channel.t and start_offs = region#start#offset `Point and stop = region#stop#line and stop_offs = region#stop#offset `Point in + let print_underline ppf blanks_len line_len = + let blanks = String.make blanks_len ' ' in + let line = String.make line_len '^' in + fprintf ppf " %s%s\n%!" blanks line + in let rec loop_over_lines current start stop = try let current = current + 1 @@ -36,7 +41,9 @@ let print_code ~(no_colour:bool) ppf (region : Region.t) (in_chan : In_channel.t if start <= current && current <= stop then if start < current && current < stop then let line = escape line in - if dont_print_colors then fprintf ppf " | %s\n%!" line + if dont_print_colors then ( + fprintf ppf " | %s\n%!" line; + print_underline ppf 0 (String.length line)) else fprintf ppf " | \027[1m\027[31m%s\027[0m\n%!" line else if current = start then @@ -65,13 +72,17 @@ let print_code ~(no_colour:bool) ppf (region : Region.t) (in_chan : In_channel.t ~pos:stop_offs ~len:(width - stop_offs) in let after = escape after in - if dont_print_colors then fprintf ppf "%s%!%s\n" between after + if dont_print_colors then ( + fprintf ppf "%s%!%s\n" between after; + print_underline ppf (String.length before) (String.length between)) else fprintf ppf "\027[1m\027[31m%s\027[0m%!%s\n" between after else let after = String.sub line ~pos:start_offs ~len:(width - start_offs) in let after = escape after in - if dont_print_colors then fprintf ppf "%s%!\n" after + if dont_print_colors then ( + fprintf ppf "%s%!\n" after; + print_underline ppf (String.length before) (String.length after)) else fprintf ppf "\027[1m\027[31m%s\027[0m%!\n" after else if current = stop then @@ -79,7 +90,9 @@ let print_code ~(no_colour:bool) ppf (region : Region.t) (in_chan : In_channel.t let after = String.sub line ~pos:stop_offs ~len:(width - stop_offs) in let after = escape after in fprintf ppf " | "; - if dont_print_colors then fprintf ppf "%s%!%s\n" before after + if dont_print_colors then ( + fprintf ppf "%s%!%s\n" before after; + print_underline ppf 0 (String.length before)) else fprintf ppf "\027[1m\027[31m%s\027[0m%!%s\n" before after else () else fprintf ppf " | %s\n" (escape line)