Wrong function arguments error message.
This commit is contained in:
parent
c9426f7cf9
commit
6beccd09a8
@ -15,3 +15,22 @@ let%expect_test _ =
|
|||||||
* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new
|
* Open a gitlab issue: https://gitlab.com/ligolang/ligo/issues/new
|
||||||
* Check the changelog by running 'ligo changelog' |} ] ;
|
* Check the changelog by running 'ligo changelog' |} ] ;
|
||||||
|
|
||||||
|
run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_function_arguments.ligo" ; "main" ] ;
|
||||||
|
[%expect {|
|
||||||
|
ligo: in file "basic.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 \"basic.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 wrong_function_arguments (expr: AST.expr) =
|
||||||
let title () = "" in
|
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 expression_loc = AST.expr_to_region expr in
|
||||||
let data = [
|
let data = [
|
||||||
("location",
|
("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