Merge branch 'fix-reasonligo-wrongfunctionarguments-error' into 'dev'
Correct wrong function arguments error message See merge request ligolang/ligo!375
This commit is contained in:
commit
5293fa3572
@ -15,3 +15,22 @@ let%expect_test _ =
|
||||
* 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_function_arguments.religo" ; "main" ] ;
|
||||
[%expect {|
|
||||
ligo: in file "error_function_arguments.religo", line 1, characters 14-27. : It looks like you are defining a function, however we do not
|
||||
understand the parameters declaration.
|
||||
Examples of valid functions:
|
||||
let x = (a: string, b: int) : int => 3;
|
||||
let tuple = ((a, b): (int, int)) => a + b;
|
||||
let x = (a: string) : string => "Hello, " ++ a;
|
||||
{"location":"in file \"error_function_arguments.religo\", line 1, characters 14-27"}
|
||||
|
||||
|
||||
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' |} ] ;
|
||||
|
||||
|
@ -55,7 +55,14 @@ module Errors =
|
||||
|
||||
let wrong_function_arguments (expr: AST.expr) =
|
||||
let title () = "" in
|
||||
let message () = "Wrong function arguments.\n" in
|
||||
let message () = "It looks like you are defining a function, \
|
||||
however we do not\n\
|
||||
understand the parameters declaration.\n\
|
||||
Examples of valid functions:\n\
|
||||
let x = (a: string, b: int) : int => 3;\n\
|
||||
let tuple = ((a, b): (int, int)) => a + b; \n\
|
||||
let x = (a: string) : string => \"Hello, \" ++ a;\n"
|
||||
in
|
||||
let expression_loc = AST.expr_to_region expr in
|
||||
let data = [
|
||||
("location",
|
||||
|
@ -0,0 +1,2 @@
|
||||
let div = (a, b : nat * nat) : option (nat) =>
|
||||
if (b == 0n) { None; } else { Some (a/b); }
|
Loading…
Reference in New Issue
Block a user