Merge branch 'docs/changelog' into 'dev'

[LIGO-347] Add changelog

See merge request ligolang/ligo!300
This commit is contained in:
John David Pressman 2020-01-08 10:54:21 +00:00
commit e96bfc1c87
9 changed files with 402 additions and 17 deletions

28
CHANGELOG.md Normal file
View File

@ -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

View File

@ -15,6 +15,7 @@ depends: [
"ppx_let" "ppx_let"
"ppx_deriving" "ppx_deriving"
"ppx_expect" "ppx_expect"
"ppx_blob"
"tezos-utils" "tezos-utils"
"proto-alpha-utils" "proto-alpha-utils"
"yojson" "yojson"

View File

@ -337,6 +337,14 @@ let compile_expression =
let doc = "Subcommand: compile to a michelson value." in let doc = "Subcommand: compile to a michelson value." in
(Term.ret term , Term.info ~doc cmdname) (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 () = let run ?argv () =
Term.eval_choice ?argv main [ Term.eval_choice ?argv main [
compile_file ; compile_file ;
@ -348,4 +356,5 @@ let run ?argv () =
dry_run ; dry_run ;
run_function ; run_function ;
evaluate_value ; evaluate_value ;
dump_changelog ;
] ]

View File

@ -2,9 +2,22 @@ open Cmdliner
open Trace open Trace
open Main.Display 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 = let toplevel ~(display_format : display_format) (x : string result) : unit Term.ret =
match x with match x with
| Ok _ -> Format.printf "%a%!" (formatted_string_result_pp display_format) x; | Ok _ -> Format.printf "%a%!" (formatted_string_result_pp display_format) x;
`Ok () `Ok ()
| Error _ -> | 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)

View File

@ -7,8 +7,9 @@
) )
(modules cli cli_helpers version) (modules cli cli_helpers version)
(preprocess (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)) (flags (:standard -open Simple_utils))
) )
@ -31,7 +32,7 @@
(modules runligo) (modules runligo)
(package ligo) (package ligo)
(preprocess (preprocess
(pps ppx_let bisect_ppx --conditional) (pps ppx_let ppx_blob bisect_ppx --conditional)
) )
(flags (:standard -open Simple_utils)) (flags (:standard -open Simple_utils))
) )

View File

@ -23,10 +23,30 @@ let%expect_test _ =
[%expect {| (Pair (Pair {} {}) 3) |}] ; [%expect {| (Pair (Pair {} {}) 3) |}] ;
run_ligo_bad [ "compile-storage" ; contract "coase.ligo" ; "main" ; "Buy_single (record card_to_buy = 1n end)" ] ; 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" ] ; 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 _ = let%expect_test _ =
run_ligo_bad [ "compile-contract" ; contract "bad_type_operator.ligo" ; "main" ] ; 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 _ = let%expect_test _ =
run_ligo_bad [ "run-function" ; contract "failwith.ligo" ; "failer" ; "1" ] ; 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 _ = let%expect_test _ =
run_ligo_bad [ "compile-contract" ; contract "bad_address_format.religo" ; "main" ] ; 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 _ = let%expect_test _ =
run_ligo_bad [ "compile-contract" ; contract "bad_timestamp.ligo" ; "main" ] ; 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 _ = let%expect_test _ =
run_ligo_good [ "dry-run" ; contract "redeclaration.ligo" ; "main" ; "unit" ; "0" ] ; run_ligo_good [ "dry-run" ; contract "redeclaration.ligo" ; "main" ; "unit" ; "0" ] ;

View File

@ -14,6 +14,9 @@ let%expect_test _ =
Use `ligo COMMAND --help' for help on a single command. Use `ligo COMMAND --help' for help on a single command.
COMMANDS COMMANDS
changelog
Dump the LIGO changelog to stdout.
compile-contract compile-contract
Subcommand: compile a contract. Subcommand: compile a contract.
@ -68,6 +71,9 @@ let%expect_test _ =
Use `ligo COMMAND --help' for help on a single command. Use `ligo COMMAND --help' for help on a single command.
COMMANDS COMMANDS
changelog
Dump the LIGO changelog to stdout.
compile-contract compile-contract
Subcommand: compile a contract. Subcommand: compile a contract.

View File

@ -6,6 +6,15 @@ let%expect_test _ =
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. Hint: Remove the break, close the string before or insert a backslash.
{"parser_loc":"in file \"broken_string.ligo\", line 1, characters 18-19"} {"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" ] ; 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. 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. Hint: Remove the break, close the string before or insert a backslash.
{"parser_loc":"in file \"broken_string.mligo\", line 1, characters 8-9"} {"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" ] ; 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. 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. Hint: Remove the break, close the string before or insert a backslash.
{"parser_loc":"in file \"broken_string.religo\", line 1, characters 8-9"} {"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" ] ; 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. ligo: lexer error: Negative byte sequence.
Hint: Remove the leading minus sign. Hint: Remove the leading minus sign.
{"parser_loc":"in file \"negative_byte_sequence.ligo\", line 1, characters 18-23"} {"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" ] ; 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. ligo: lexer error: Negative byte sequence.
Hint: Remove the leading minus sign. Hint: Remove the leading minus sign.
{"parser_loc":"in file \"negative_byte_sequence.mligo\", line 1, characters 8-13"} {"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" ] ; 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. ligo: lexer error: Negative byte sequence.
Hint: Remove the leading minus sign. Hint: Remove the leading minus sign.
{"parser_loc":"in file \"negative_byte_sequence.religo\", line 1, characters 8-13"} {"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" ] ; 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. ligo: lexer error: Reserved name: args.
Hint: Change the name. Hint: Change the name.
{"parser_loc":"in file \"reserved_name.ligo\", line 1, characters 4-8"} {"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" ] ; 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. ligo: lexer error: Reserved name: end.
Hint: Change the name. Hint: Change the name.
{"parser_loc":"in file \"reserved_name.religo\", line 1, characters 4-7"} {"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" ] ; 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. ligo: lexer error: Reserved name: object.
Hint: Change the name. Hint: Change the name.
{"parser_loc":"in file \"reserved_name.mligo\", line 1, characters 4-10"} {"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" ] ; run_ligo_bad [ "compile-contract" ; "../../test/lexer/unexpected_character.ligo" ; "main" ] ;
[%expect {| [%expect {|
ligo: lexer error: Unexpected character '\239'. ligo: lexer error: Unexpected character '\239'.
{"parser_loc":"in file \"unexpected_character.ligo\", line 1, characters 18-19"} {"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" ] ; run_ligo_bad [ "compile-contract" ; "../../test/lexer/unexpected_character.mligo" ; "main" ] ;
[%expect {| [%expect {|
ligo: lexer error: Unexpected character '\239'. ligo: lexer error: Unexpected character '\239'.
{"parser_loc":"in file \"unexpected_character.mligo\", line 1, characters 8-9"} {"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" ] ; run_ligo_bad [ "compile-contract" ; "../../test/lexer/unexpected_character.religo" ; "main" ] ;
[%expect {| [%expect {|
ligo: lexer error: Unexpected character '\239'. ligo: lexer error: Unexpected character '\239'.
{"parser_loc":"in file \"unexpected_character.religo\", line 1, characters 8-9"} {"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" ] ; 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. ligo: lexer error: Unterminated comment.
Hint: Close with "*)". Hint: Close with "*)".
{"parser_loc":"in file \"unterminated_comment.mligo\", line 1, characters 0-2"} {"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" ] ; 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. ligo: lexer error: Invalid symbol.
Hint: Check the LIGO syntax you use. Hint: Check the LIGO syntax you use.
{"parser_loc":"in file \"invalid_symbol.ligo\", line 1, characters 17-20"} {"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" ] ; 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. ligo: lexer error: Invalid symbol.
Hint: Check the LIGO syntax you use. Hint: Check the LIGO syntax you use.
{"parser_loc":"in file \"invalid_symbol.mligo\", line 1, characters 10-13"} {"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" ] ; 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. ligo: lexer error: Invalid symbol.
Hint: Check the LIGO syntax you use. Hint: Check the LIGO syntax you use.
{"parser_loc":"in file \"invalid_symbol.religo\", line 1, characters 10-11"} {"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" ] ; 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. ligo: lexer error: Missing break.
Hint: Insert some space. Hint: Insert some space.
{"parser_loc":"in file \"missing_break.ligo\", line 1, characters 18-18"} {"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" ] ; 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. ligo: lexer error: Missing break.
Hint: Insert some space. Hint: Insert some space.
{"parser_loc":"in file \"missing_break.mligo\", line 1, characters 11-11"} {"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" ] ; 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. ligo: lexer error: Missing break.
Hint: Insert some space. Hint: Insert some space.
{"parser_loc":"in file \"missing_break.religo\", line 1, characters 11-11"} {"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" ] ; 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. ligo: lexer error: Invalid character in string.
Hint: Remove or replace the character. Hint: Remove or replace the character.
{"parser_loc":"in file \"invalid_character_in_string.ligo\", line 1, characters 19-20"} {"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" ] ; 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. ligo: lexer error: Invalid character in string.
Hint: Remove or replace the character. Hint: Remove or replace the character.
{"parser_loc":"in file \"invalid_character_in_string.mligo\", line 1, characters 9-10"} {"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" ] ; 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. ligo: lexer error: Invalid character in string.
Hint: Remove or replace the character. Hint: Remove or replace the character.
{"parser_loc":"in file \"invalid_character_in_string.religo\", line 1, characters 9-10"} {"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'
|} ] |} ]

View File

@ -2,24 +2,94 @@ open Cli_expect
let%expect_test _ = let%expect_test _ =
run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_1.mligo" ; "main" ] ; 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" ] ; 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" ] ; 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" ] ; 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" ] ; 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" ] ; 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" ] ; 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' |} ] ;