From 16ac289381fa6fe700909a5a32a83f65dede3698 Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Wed, 8 Jan 2020 10:54:21 +0000 Subject: [PATCH] [LIGO-347] Add changelog --- CHANGELOG.md | 28 +++ ligo.opam | 1 + src/bin/cli.ml | 9 + src/bin/cli_helpers.ml | 15 +- src/bin/dune | 5 +- src/bin/expect_tests/contract_tests.ml | 73 +++++++- src/bin/expect_tests/help_tests.ml | 6 + src/bin/expect_tests/lexer_tests.ml | 198 ++++++++++++++++++++++ src/bin/expect_tests/typer_error_tests.ml | 84 ++++++++- 9 files changed, 402 insertions(+), 17 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..812aaafb0 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,28 @@ +# Changelog + +## [Unreleased] + +## [1899dfe8d7285580b3aa30fab933ed589f8f1bc5] - 2020-01-08 +### Added +- Partial application and OCaml-like currying behavior to CameLIGO & ReasonLIGO + +### Changed +- Contract entrypoints now need to use tuple parameters in CameLIGO + +### Docs +- Explain currying +- Now use tuple parameters in function examples +- Now have map examples which are runnable as a combined block for doc tests + +### Tests +- More tests take advantage of tuple parameter destructuring (i.e. +`let thing (p,s: param * storage) : int = ...`) +- Entrypoints now use tuple parameters +- Added Currying behavior test + + +## [Changelog Patch](https://gitlab.com/ligolang/ligo/merge_requests/300) - 2020-01-08 +### Added +- CHANGELOG.md that keeps track of notable changes to LIGO, etc +- 'changelog' command to LIGO command line that dumps CHANGELOG.md to stdout +- Help tips message with options for getting assistance that's printed on error diff --git a/ligo.opam b/ligo.opam index 7b4f8c210..92b0e4051 100644 --- a/ligo.opam +++ b/ligo.opam @@ -15,6 +15,7 @@ depends: [ "ppx_let" "ppx_deriving" "ppx_expect" + "ppx_blob" "tezos-utils" "proto-alpha-utils" "yojson" diff --git a/src/bin/cli.ml b/src/bin/cli.ml index 0e1859839..a1275d78f 100644 --- a/src/bin/cli.ml +++ b/src/bin/cli.ml @@ -337,6 +337,14 @@ let compile_expression = let doc = "Subcommand: compile to a michelson value." in (Term.ret term , Term.info ~doc cmdname) +let dump_changelog = + let f display_format = toplevel ~display_format @@ (ok @@ [%blob "../../CHANGELOG.md"]) in + let term = + Term.(const f $ display_format) in + let cmdname = "changelog" in + let doc = "Dump the LIGO changelog to stdout." in + (Term.ret term , Term.info ~doc cmdname) + let run ?argv () = Term.eval_choice ?argv main [ compile_file ; @@ -348,4 +356,5 @@ let run ?argv () = dry_run ; run_function ; evaluate_value ; + dump_changelog ; ] diff --git a/src/bin/cli_helpers.ml b/src/bin/cli_helpers.ml index 34a4834a1..fdd9826c9 100644 --- a/src/bin/cli_helpers.ml +++ b/src/bin/cli_helpers.ml @@ -2,9 +2,22 @@ open Cmdliner open Trace open Main.Display +let error_suggest: string = "\n If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog'" + let toplevel ~(display_format : display_format) (x : string result) : unit Term.ret = match x with | Ok _ -> Format.printf "%a%!" (formatted_string_result_pp display_format) x; `Ok () | Error _ -> - `Error (false, Format.asprintf "%a%!" (formatted_string_result_pp display_format) x) + begin + match display_format with + | `Human_readable -> print_string error_suggest ; + | _ -> () + end ; + `Error (false, Format.asprintf "%a%!" (formatted_string_result_pp display_format) x) diff --git a/src/bin/dune b/src/bin/dune index f0219a5f6..162963b4b 100644 --- a/src/bin/dune +++ b/src/bin/dune @@ -7,8 +7,9 @@ ) (modules cli cli_helpers version) (preprocess - (pps ppx_let bisect_ppx --conditional) + (pps ppx_let ppx_blob bisect_ppx --conditional) ) + (preprocessor_deps (file ../../CHANGELOG.md)) (flags (:standard -open Simple_utils)) ) @@ -31,7 +32,7 @@ (modules runligo) (package ligo) (preprocess - (pps ppx_let bisect_ppx --conditional) + (pps ppx_let ppx_blob bisect_ppx --conditional) ) (flags (:standard -open Simple_utils)) ) diff --git a/src/bin/expect_tests/contract_tests.ml b/src/bin/expect_tests/contract_tests.ml index acf82eb2f..362eae03e 100644 --- a/src/bin/expect_tests/contract_tests.ml +++ b/src/bin/expect_tests/contract_tests.ml @@ -23,10 +23,30 @@ let%expect_test _ = [%expect {| (Pair (Pair {} {}) 3) |}] ; run_ligo_bad [ "compile-storage" ; contract "coase.ligo" ; "main" ; "Buy_single (record card_to_buy = 1n end)" ] ; - [%expect {| ligo: different kinds: {"a":"record[next_id -> nat , cards -> (TO_Map (nat,record[card_pattern -> nat , card_owner -> address])) , card_patterns -> (TO_Map (nat,record[quantity -> nat , coefficient -> mutez]))]","b":"sum[Transfer_single -> record[destination -> address , card_to_transfer -> nat] , Sell_single -> record[card_to_sell -> nat] , Buy_single -> record[card_to_buy -> nat]]"} |}] ; + [%expect {| + ligo: different kinds: {"a":"record[next_id -> nat , cards -> (TO_Map (nat,record[card_pattern -> nat , card_owner -> address])) , card_patterns -> (TO_Map (nat,record[quantity -> nat , coefficient -> mutez]))]","b":"sum[Transfer_single -> record[destination -> address , card_to_transfer -> nat] , Sell_single -> record[card_to_sell -> nat] , Buy_single -> record[card_to_buy -> nat]]"} + + + If you're not sure how to fix this error, you can + do one of the following: + + * Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ + * Ask a question on our Discord: https://discord.gg/9rhYaEt + * Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new + * Check the changelog by running 'ligo changelog' |}] ; run_ligo_bad [ "compile-parameter" ; contract "coase.ligo" ; "main" ; "record cards = (map end : cards) ; card_patterns = (map end : card_patterns) ; next_id = 3n ; end" ] ; - [%expect {| ligo: different kinds: {"a":"sum[Transfer_single -> record[destination -> address , card_to_transfer -> nat] , Sell_single -> record[card_to_sell -> nat] , Buy_single -> record[card_to_buy -> nat]]","b":"record[next_id -> nat , cards -> (TO_Map (nat,record[card_pattern -> nat , card_owner -> address])) , card_patterns -> (TO_Map (nat,record[quantity -> nat , coefficient -> mutez]))]"} |}] ; + [%expect {| + ligo: different kinds: {"a":"sum[Transfer_single -> record[destination -> address , card_to_transfer -> nat] , Sell_single -> record[card_to_sell -> nat] , Buy_single -> record[card_to_buy -> nat]]","b":"record[next_id -> nat , cards -> (TO_Map (nat,record[card_pattern -> nat , card_owner -> address])) , card_patterns -> (TO_Map (nat,record[quantity -> nat , coefficient -> mutez]))]"} + + + If you're not sure how to fix this error, you can + do one of the following: + + * Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ + * Ask a question on our Discord: https://discord.gg/9rhYaEt + * Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new + * Check the changelog by running 'ligo changelog' |}] ; () @@ -931,19 +951,58 @@ let%expect_test _ = let%expect_test _ = run_ligo_bad [ "compile-contract" ; contract "bad_type_operator.ligo" ; "main" ] ; - [%expect {| ligo: bad type operator (TO_Map (unit,unit)): |}] + [%expect {| + ligo: bad type operator (TO_Map (unit,unit)): + + If you're not sure how to fix this error, you can + do one of the following: + + * Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ + * Ask a question on our Discord: https://discord.gg/9rhYaEt + * Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new + * Check the changelog by running 'ligo changelog' |}] let%expect_test _ = run_ligo_bad [ "run-function" ; contract "failwith.ligo" ; "failer" ; "1" ] ; - [%expect {| ligo: Execution failed: {"value":"some_string","type":"string"} |}] + [%expect {| + ligo: Execution failed: {"value":"some_string","type":"string"} + + + If you're not sure how to fix this error, you can + do one of the following: + + * Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ + * Ask a question on our Discord: https://discord.gg/9rhYaEt + * Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new + * Check the changelog by running 'ligo changelog' |}] let%expect_test _ = run_ligo_bad [ "compile-contract" ; contract "bad_address_format.religo" ; "main" ] ; - [%expect {| ligo: in file "bad_address_format.religo", line 2, characters 25-47. Badly formatted literal: address "KT1badaddr" {"location":"in file \"bad_address_format.religo\", line 2, characters 25-47"} |}] + [%expect {| + ligo: in file "bad_address_format.religo", line 2, characters 25-47. Badly formatted literal: address "KT1badaddr" {"location":"in file \"bad_address_format.religo\", line 2, characters 25-47"} + + + If you're not sure how to fix this error, you can + do one of the following: + + * Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ + * Ask a question on our Discord: https://discord.gg/9rhYaEt + * Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new + * Check the changelog by running 'ligo changelog' |}] let%expect_test _ = run_ligo_bad [ "compile-contract" ; contract "bad_timestamp.ligo" ; "main" ] ; - [%expect {| ligo: in file "bad_timestamp.ligo", line 5, characters 29-43. Badly formatted timestamp "badtimestamp": {"location":"in file \"bad_timestamp.ligo\", line 5, characters 29-43"} |}] + [%expect {| + ligo: in file "bad_timestamp.ligo", line 5, characters 29-43. Badly formatted timestamp "badtimestamp": {"location":"in file \"bad_timestamp.ligo\", line 5, characters 29-43"} + + + If you're not sure how to fix this error, you can + do one of the following: + + * Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ + * Ask a question on our Discord: https://discord.gg/9rhYaEt + * Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new + * Check the changelog by running 'ligo changelog' |}] let%expect_test _ = run_ligo_good [ "dry-run" ; contract "redeclaration.ligo" ; "main" ; "unit" ; "0" ] ; @@ -951,4 +1010,4 @@ let%expect_test _ = let%expect_test _ = run_ligo_good [ "dry-run" ; contract "double_main.ligo" ; "main" ; "unit" ; "0" ] ; - [%expect {|( [] , 2 ) |}] \ No newline at end of file + [%expect {|( [] , 2 ) |}] diff --git a/src/bin/expect_tests/help_tests.ml b/src/bin/expect_tests/help_tests.ml index fc9bf0e7d..b42ac2c8b 100644 --- a/src/bin/expect_tests/help_tests.ml +++ b/src/bin/expect_tests/help_tests.ml @@ -14,6 +14,9 @@ let%expect_test _ = Use `ligo COMMAND --help' for help on a single command. COMMANDS + changelog + Dump the LIGO changelog to stdout. + compile-contract Subcommand: compile a contract. @@ -68,6 +71,9 @@ let%expect_test _ = Use `ligo COMMAND --help' for help on a single command. COMMANDS + changelog + Dump the LIGO changelog to stdout. + compile-contract Subcommand: compile a contract. diff --git a/src/bin/expect_tests/lexer_tests.ml b/src/bin/expect_tests/lexer_tests.ml index 06188eba2..1e016fe78 100644 --- a/src/bin/expect_tests/lexer_tests.ml +++ b/src/bin/expect_tests/lexer_tests.ml @@ -6,6 +6,15 @@ let%expect_test _ = ligo: lexer error: The string starting here is interrupted by a line break. Hint: Remove the break, close the string before or insert a backslash. {"parser_loc":"in file \"broken_string.ligo\", line 1, characters 18-19"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ]; run_ligo_bad [ "compile-contract" ; "../../test/lexer/broken_string.mligo" ; "main" ] ; @@ -13,6 +22,15 @@ ligo: lexer error: The string starting here is interrupted by a line break. ligo: lexer error: The string starting here is interrupted by a line break. Hint: Remove the break, close the string before or insert a backslash. {"parser_loc":"in file \"broken_string.mligo\", line 1, characters 8-9"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ]; run_ligo_bad [ "compile-contract" ; "../../test/lexer/broken_string.religo" ; "main" ] ; @@ -20,6 +38,15 @@ ligo: lexer error: The string starting here is interrupted by a line break. ligo: lexer error: The string starting here is interrupted by a line break. Hint: Remove the break, close the string before or insert a backslash. {"parser_loc":"in file \"broken_string.religo\", line 1, characters 8-9"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ]; run_ligo_bad [ "compile-contract" ; "../../test/lexer/negative_byte_sequence.ligo" ; "main" ] ; @@ -27,6 +54,15 @@ run_ligo_bad [ "compile-contract" ; "../../test/lexer/negative_byte_sequence.lig ligo: lexer error: Negative byte sequence. Hint: Remove the leading minus sign. {"parser_loc":"in file \"negative_byte_sequence.ligo\", line 1, characters 18-23"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ]; run_ligo_bad [ "compile-contract" ; "../../test/lexer/negative_byte_sequence.mligo" ; "main" ] ; @@ -34,6 +70,15 @@ run_ligo_bad [ "compile-contract" ; "../../test/lexer/negative_byte_sequence.mli ligo: lexer error: Negative byte sequence. Hint: Remove the leading minus sign. {"parser_loc":"in file \"negative_byte_sequence.mligo\", line 1, characters 8-13"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ]; run_ligo_bad [ "compile-contract" ; "../../test/lexer/negative_byte_sequence.religo" ; "main" ] ; @@ -41,6 +86,15 @@ run_ligo_bad [ "compile-contract" ; "../../test/lexer/negative_byte_sequence.rel ligo: lexer error: Negative byte sequence. Hint: Remove the leading minus sign. {"parser_loc":"in file \"negative_byte_sequence.religo\", line 1, characters 8-13"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ]; run_ligo_bad [ "compile-contract" ; "../../test/lexer/reserved_name.ligo" ; "main" ] ; @@ -48,6 +102,15 @@ ligo: lexer error: Negative byte sequence. ligo: lexer error: Reserved name: args. Hint: Change the name. {"parser_loc":"in file \"reserved_name.ligo\", line 1, characters 4-8"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ]; run_ligo_bad [ "compile-contract" ; "../../test/lexer/reserved_name.religo" ; "main" ] ; @@ -55,6 +118,15 @@ run_ligo_bad [ "compile-contract" ; "../../test/lexer/reserved_name.religo" ; "m ligo: lexer error: Reserved name: end. Hint: Change the name. {"parser_loc":"in file \"reserved_name.religo\", line 1, characters 4-7"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ]; run_ligo_bad [ "compile-contract" ; "../../test/lexer/reserved_name.mligo" ; "main" ] ; @@ -62,24 +134,60 @@ run_ligo_bad [ "compile-contract" ; "../../test/lexer/reserved_name.mligo" ; "ma ligo: lexer error: Reserved name: object. Hint: Change the name. {"parser_loc":"in file \"reserved_name.mligo\", line 1, characters 4-10"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ]; run_ligo_bad [ "compile-contract" ; "../../test/lexer/unexpected_character.ligo" ; "main" ] ; [%expect {| ligo: lexer error: Unexpected character '\239'. {"parser_loc":"in file \"unexpected_character.ligo\", line 1, characters 18-19"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ]; run_ligo_bad [ "compile-contract" ; "../../test/lexer/unexpected_character.mligo" ; "main" ] ; [%expect {| ligo: lexer error: Unexpected character '\239'. {"parser_loc":"in file \"unexpected_character.mligo\", line 1, characters 8-9"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ]; run_ligo_bad [ "compile-contract" ; "../../test/lexer/unexpected_character.religo" ; "main" ] ; [%expect {| ligo: lexer error: Unexpected character '\239'. {"parser_loc":"in file \"unexpected_character.religo\", line 1, characters 8-9"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ]; run_ligo_bad [ "compile-contract" ; "../../test/lexer/unterminated_comment.mligo" ; "main" ] ; @@ -87,6 +195,15 @@ ligo: lexer error: Unexpected character '\239'. ligo: lexer error: Unterminated comment. Hint: Close with "*)". {"parser_loc":"in file \"unterminated_comment.mligo\", line 1, characters 0-2"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ]; run_ligo_bad [ "compile-contract" ; "../../test/lexer/invalid_symbol.ligo" ; "main" ] ; @@ -94,6 +211,15 @@ run_ligo_bad [ "compile-contract" ; "../../test/lexer/invalid_symbol.ligo" ; "ma ligo: lexer error: Invalid symbol. Hint: Check the LIGO syntax you use. {"parser_loc":"in file \"invalid_symbol.ligo\", line 1, characters 17-20"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ]; run_ligo_bad [ "compile-contract" ; "../../test/lexer/invalid_symbol.mligo" ; "main" ] ; @@ -101,6 +227,15 @@ run_ligo_bad [ "compile-contract" ; "../../test/lexer/invalid_symbol.mligo" ; "m ligo: lexer error: Invalid symbol. Hint: Check the LIGO syntax you use. {"parser_loc":"in file \"invalid_symbol.mligo\", line 1, characters 10-13"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ]; run_ligo_bad [ "compile-contract" ; "../../test/lexer/invalid_symbol.religo" ; "main" ] ; @@ -108,6 +243,15 @@ run_ligo_bad [ "compile-contract" ; "../../test/lexer/invalid_symbol.religo" ; " ligo: lexer error: Invalid symbol. Hint: Check the LIGO syntax you use. {"parser_loc":"in file \"invalid_symbol.religo\", line 1, characters 10-11"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ]; run_ligo_bad [ "compile-contract" ; "../../test/lexer/missing_break.ligo" ; "main" ] ; @@ -115,6 +259,15 @@ ligo: lexer error: Invalid symbol. ligo: lexer error: Missing break. Hint: Insert some space. {"parser_loc":"in file \"missing_break.ligo\", line 1, characters 18-18"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ]; run_ligo_bad [ "compile-contract" ; "../../test/lexer/missing_break.mligo" ; "main" ] ; @@ -122,6 +275,15 @@ ligo: lexer error: Missing break. ligo: lexer error: Missing break. Hint: Insert some space. {"parser_loc":"in file \"missing_break.mligo\", line 1, characters 11-11"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ]; run_ligo_bad [ "compile-contract" ; "../../test/lexer/missing_break.religo" ; "main" ] ; @@ -129,6 +291,15 @@ ligo: lexer error: Missing break. ligo: lexer error: Missing break. Hint: Insert some space. {"parser_loc":"in file \"missing_break.religo\", line 1, characters 11-11"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ]; run_ligo_bad [ "compile-contract" ; "../../test/lexer/invalid_character_in_string.ligo" ; "main" ] ; @@ -136,6 +307,15 @@ run_ligo_bad [ "compile-contract" ; "../../test/lexer/invalid_character_in_strin ligo: lexer error: Invalid character in string. Hint: Remove or replace the character. {"parser_loc":"in file \"invalid_character_in_string.ligo\", line 1, characters 19-20"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ]; run_ligo_bad [ "compile-contract" ; "../../test/lexer/invalid_character_in_string.mligo" ; "main" ] ; @@ -143,6 +323,15 @@ run_ligo_bad [ "compile-contract" ; "../../test/lexer/invalid_character_in_strin ligo: lexer error: Invalid character in string. Hint: Remove or replace the character. {"parser_loc":"in file \"invalid_character_in_string.mligo\", line 1, characters 9-10"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ]; run_ligo_bad [ "compile-contract" ; "../../test/lexer/invalid_character_in_string.religo" ; "main" ] ; @@ -150,4 +339,13 @@ run_ligo_bad [ "compile-contract" ; "../../test/lexer/invalid_character_in_strin ligo: lexer error: Invalid character in string. Hint: Remove or replace the character. {"parser_loc":"in file \"invalid_character_in_string.religo\", line 1, characters 9-10"} + + + If you're not sure how to fix this error, you can + do one of the following: + +* Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ +* Ask a question on our Discord: https://discord.gg/9rhYaEt +* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new +* Check the changelog by running 'ligo changelog' |} ] \ No newline at end of file diff --git a/src/bin/expect_tests/typer_error_tests.ml b/src/bin/expect_tests/typer_error_tests.ml index 45146c911..2fcc7f4e5 100644 --- a/src/bin/expect_tests/typer_error_tests.ml +++ b/src/bin/expect_tests/typer_error_tests.ml @@ -2,24 +2,94 @@ open Cli_expect let%expect_test _ = run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_1.mligo" ; "main" ] ; - [%expect {| ligo: in file "error_typer_1.mligo", line 3, characters 19-27. different type constructors: Expected these two constant type constructors to be the same, but they're different {"a":"string","b":"int"} |} ] ; + [%expect {| + ligo: in file "error_typer_1.mligo", line 3, characters 19-27. different type constructors: Expected these two constant type constructors to be the same, but they're different {"a":"string","b":"int"} + + + If you're not sure how to fix this error, you can + do one of the following: + + * Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ + * Ask a question on our Discord: https://discord.gg/9rhYaEt + * Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new + * Check the changelog by running 'ligo changelog' |} ] ; run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_2.mligo" ; "main" ] ; - [%expect {| ligo: in file "error_typer_2.mligo", line 3, characters 24-39. different type constructors: Expected these two n-ary type constructors to be the same, but they're different {"a":"(TO_list(string))","b":"(TO_option(int))"} |} ] ; + [%expect {| + ligo: in file "error_typer_2.mligo", line 3, characters 24-39. different type constructors: Expected these two n-ary type constructors to be the same, but they're different {"a":"(TO_list(string))","b":"(TO_option(int))"} + + + If you're not sure how to fix this error, you can + do one of the following: + + * Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ + * Ask a question on our Discord: https://discord.gg/9rhYaEt + * Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new + * Check the changelog by running 'ligo changelog' |} ] ; run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_3.mligo" ; "main" ] ; - [%expect {| ligo: in file "error_typer_3.mligo", line 3, characters 34-53. tuples have different sizes: Expected these two types to be the same, but they're different (both are tuples, but with a different number of arguments) {"a":"tuple[int , string , bool]","b":"tuple[int , string]"} |} ] ; + [%expect {| + ligo: in file "error_typer_3.mligo", line 3, characters 34-53. tuples have different sizes: Expected these two types to be the same, but they're different (both are tuples, but with a different number of arguments) {"a":"tuple[int , string , bool]","b":"tuple[int , string]"} + + + If you're not sure how to fix this error, you can + do one of the following: + + * Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ + * Ask a question on our Discord: https://discord.gg/9rhYaEt + * Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new + * Check the changelog by running 'ligo changelog' |} ] ; run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_4.mligo" ; "main" ] ; - [%expect {| ligo: in file "error_typer_4.mligo", line 4, characters 17-56. different keys in record: {"key_a":"d","key_b":"c"} |} ] ; + [%expect {| + ligo: in file "error_typer_4.mligo", line 4, characters 17-56. different keys in record: {"key_a":"d","key_b":"c"} + + + If you're not sure how to fix this error, you can + do one of the following: + + * Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ + * Ask a question on our Discord: https://discord.gg/9rhYaEt + * Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new + * Check the changelog by running 'ligo changelog' |} ] ; run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_5.mligo" ; "main" ] ; - [%expect {| ligo: unbound type variable: {"variable":"boolean","in":"- E[]\tT[] ]","did_you_mean":"bool"} |} ] ; + [%expect {| + ligo: unbound type variable: {"variable":"boolean","in":"- E[]\tT[] ]","did_you_mean":"bool"} + + + If you're not sure how to fix this error, you can + do one of the following: + + * Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ + * Ask a question on our Discord: https://discord.gg/9rhYaEt + * Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new + * Check the changelog by running 'ligo changelog' |} ] ; run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_6.mligo" ; "main" ] ; - [%expect {| ligo: in file "error_typer_6.mligo", line 1, characters 30-64. different type constructors: Expected these two constant type constructors to be the same, but they're different {"a":"string","b":"bool"} |} ] ; + [%expect {| + ligo: in file "error_typer_6.mligo", line 1, characters 30-64. different type constructors: Expected these two constant type constructors to be the same, but they're different {"a":"string","b":"bool"} + + + If you're not sure how to fix this error, you can + do one of the following: + + * Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ + * Ask a question on our Discord: https://discord.gg/9rhYaEt + * Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new + * Check the changelog by running 'ligo changelog' |} ] ; run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_7.mligo" ; "main" ] ; - [%expect {| ligo: in file "error_typer_7.mligo", line 4, characters 18-48. records have different sizes: Expected these two types to be the same, but they're different (both are records, but with a different number of arguments) {"a":"record[b -> string , a -> int]","b":"record[c -> bool , b -> string , a -> int]"} |} ] ; + [%expect {| + ligo: in file "error_typer_7.mligo", line 4, characters 18-48. records have different sizes: Expected these two types to be the same, but they're different (both are records, but with a different number of arguments) {"a":"record[b -> string , a -> int]","b":"record[c -> bool , b -> string , a -> int]"} + + + If you're not sure how to fix this error, you can + do one of the following: + + * Visit our documentation: https://ligolang.org/docs/intro/what-and-why/ + * Ask a question on our Discord: https://discord.gg/9rhYaEt + * Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new + * Check the changelog by running 'ligo changelog' |} ] ;