Fixed again priority of "->" vs "*" in type expressions.
Fixed negative tests.
This commit is contained in:
parent
47a41971d7
commit
3c9dd93c8b
@ -3,7 +3,8 @@ open Cli_expect
|
|||||||
let%expect_test _ =
|
let%expect_test _ =
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/lexer/broken_string.ligo" ; "main" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/lexer/broken_string.ligo" ; "main" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: lexer error: The string starting here is interrupted by a line break.
|
ligo: : Lexical error in file "broken_string.ligo", line 1, characters 18-19:
|
||||||
|
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"}
|
||||||
|
|
||||||
@ -19,7 +20,8 @@ ligo: lexer error: The string starting here is interrupted by a line break.
|
|||||||
|
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/lexer/broken_string.mligo" ; "main" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/lexer/broken_string.mligo" ; "main" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: lexer error: The string starting here is interrupted by a line break.
|
ligo: : Lexical error at line 1, characters 8-9:
|
||||||
|
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"}
|
||||||
|
|
||||||
@ -35,7 +37,8 @@ ligo: lexer error: The string starting here is interrupted by a line break.
|
|||||||
|
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/lexer/broken_string.religo" ; "main" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/lexer/broken_string.religo" ; "main" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: lexer error: The string starting here is interrupted by a line break.
|
ligo: : Lexical error at line 1, characters 8-9:
|
||||||
|
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"}
|
||||||
|
|
||||||
@ -51,7 +54,8 @@ ligo: lexer error: The string starting here is interrupted by a line break.
|
|||||||
|
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/lexer/negative_byte_sequence.ligo" ; "main" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/lexer/negative_byte_sequence.ligo" ; "main" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: lexer error: Negative byte sequence.
|
ligo: : Lexical error in file "negative_byte_sequence.ligo", line 1, characters 18-23:
|
||||||
|
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"}
|
||||||
|
|
||||||
@ -67,7 +71,8 @@ ligo: lexer error: Negative byte sequence.
|
|||||||
|
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/lexer/negative_byte_sequence.mligo" ; "main" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/lexer/negative_byte_sequence.mligo" ; "main" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: lexer error: Negative byte sequence.
|
ligo: : Lexical error at line 1, characters 8-13:
|
||||||
|
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"}
|
||||||
|
|
||||||
@ -83,7 +88,8 @@ ligo: lexer error: Negative byte sequence.
|
|||||||
|
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/lexer/negative_byte_sequence.religo" ; "main" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/lexer/negative_byte_sequence.religo" ; "main" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: lexer error: Negative byte sequence.
|
ligo: : Lexical error at line 1, characters 8-13:
|
||||||
|
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"}
|
||||||
|
|
||||||
@ -99,7 +105,8 @@ ligo: lexer error: Negative byte sequence.
|
|||||||
|
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/lexer/reserved_name.ligo" ; "main" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/lexer/reserved_name.ligo" ; "main" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: lexer error: Reserved name: arguments.
|
ligo: : Lexical error in file "reserved_name.ligo", line 1, characters 4-13:
|
||||||
|
Reserved name: arguments.
|
||||||
Hint: Change the name.
|
Hint: Change the name.
|
||||||
{"parser_loc":"in file \"reserved_name.ligo\", line 1, characters 4-13"}
|
{"parser_loc":"in file \"reserved_name.ligo\", line 1, characters 4-13"}
|
||||||
|
|
||||||
@ -115,7 +122,8 @@ ligo: lexer error: Reserved name: arguments.
|
|||||||
|
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/lexer/reserved_name.religo" ; "main" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/lexer/reserved_name.religo" ; "main" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: lexer error: Reserved name: end.
|
ligo: : Lexical error at line 1, characters 4-7:
|
||||||
|
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"}
|
||||||
|
|
||||||
@ -131,7 +139,8 @@ ligo: lexer error: Reserved name: end.
|
|||||||
|
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/lexer/reserved_name.mligo" ; "main" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/lexer/reserved_name.mligo" ; "main" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: lexer error: Reserved name: object.
|
ligo: : Lexical error at line 1, characters 4-10:
|
||||||
|
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"}
|
||||||
|
|
||||||
@ -147,7 +156,8 @@ ligo: lexer error: Reserved name: object.
|
|||||||
|
|
||||||
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: : Lexical error in file "unexpected_character.ligo", line 1, characters 18-19:
|
||||||
|
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"}
|
||||||
|
|
||||||
|
|
||||||
@ -162,7 +172,8 @@ ligo: lexer error: Unexpected character '\239'.
|
|||||||
|
|
||||||
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: : Lexical error at line 1, characters 8-9:
|
||||||
|
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"}
|
||||||
|
|
||||||
|
|
||||||
@ -177,7 +188,8 @@ ligo: lexer error: Unexpected character '\239'.
|
|||||||
|
|
||||||
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: : Lexical error at line 1, characters 8-9:
|
||||||
|
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"}
|
||||||
|
|
||||||
|
|
||||||
@ -192,7 +204,8 @@ ligo: lexer error: Unexpected character '\239'.
|
|||||||
|
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/lexer/unterminated_comment.mligo" ; "main" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/lexer/unterminated_comment.mligo" ; "main" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: lexer error: Unterminated comment.
|
ligo: : Lexical error at line 1, characters 0-2:
|
||||||
|
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"}
|
||||||
|
|
||||||
@ -208,7 +221,8 @@ ligo: lexer error: Unterminated comment.
|
|||||||
|
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/lexer/invalid_symbol.ligo" ; "main" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/lexer/invalid_symbol.ligo" ; "main" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: lexer error: Invalid symbol.
|
ligo: : Lexical error in file "invalid_symbol.ligo", line 1, characters 17-20:
|
||||||
|
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"}
|
||||||
|
|
||||||
@ -224,7 +238,8 @@ ligo: lexer error: Invalid symbol.
|
|||||||
|
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/lexer/invalid_symbol.mligo" ; "main" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/lexer/invalid_symbol.mligo" ; "main" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: lexer error: Invalid symbol.
|
ligo: : Lexical error at line 1, characters 10-13:
|
||||||
|
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"}
|
||||||
|
|
||||||
@ -240,7 +255,8 @@ ligo: lexer error: Invalid symbol.
|
|||||||
|
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/lexer/invalid_symbol.religo" ; "main" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/lexer/invalid_symbol.religo" ; "main" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: lexer error: Invalid symbol.
|
ligo: : Lexical error at line 1, characters 10-11:
|
||||||
|
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"}
|
||||||
|
|
||||||
@ -256,7 +272,8 @@ ligo: lexer error: Invalid symbol.
|
|||||||
|
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/lexer/missing_break.ligo" ; "main" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/lexer/missing_break.ligo" ; "main" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: lexer error: Missing break.
|
ligo: : Lexical error in file "missing_break.ligo", line 1, characters 18-18:
|
||||||
|
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"}
|
||||||
|
|
||||||
@ -272,7 +289,8 @@ ligo: lexer error: Missing break.
|
|||||||
|
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/lexer/missing_break.mligo" ; "main" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/lexer/missing_break.mligo" ; "main" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: lexer error: Missing break.
|
ligo: : Lexical error at line 1, characters 11-11:
|
||||||
|
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"}
|
||||||
|
|
||||||
@ -288,7 +306,8 @@ ligo: lexer error: Missing break.
|
|||||||
|
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/lexer/missing_break.religo" ; "main" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/lexer/missing_break.religo" ; "main" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: lexer error: Missing break.
|
ligo: : Lexical error at line 1, characters 11-11:
|
||||||
|
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"}
|
||||||
|
|
||||||
@ -304,7 +323,8 @@ ligo: lexer error: Missing break.
|
|||||||
|
|
||||||
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" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: lexer error: Invalid character in string.
|
ligo: : Lexical error in file "invalid_character_in_string.ligo", line 1, characters 19-20:
|
||||||
|
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"}
|
||||||
|
|
||||||
@ -320,7 +340,8 @@ ligo: lexer error: Invalid character in string.
|
|||||||
|
|
||||||
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" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: lexer error: Invalid character in string.
|
ligo: : Lexical error at line 1, characters 9-10:
|
||||||
|
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"}
|
||||||
|
|
||||||
@ -336,7 +357,8 @@ ligo: lexer error: Invalid character in string.
|
|||||||
|
|
||||||
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" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: lexer error: Invalid character in string.
|
ligo: : Lexical error at line 1, characters 9-10:
|
||||||
|
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"}
|
||||||
|
|
||||||
|
@ -3,8 +3,8 @@ open Cli_expect
|
|||||||
let%expect_test _ =
|
let%expect_test _ =
|
||||||
run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_syntax.ligo" ; "main" ] ;
|
run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_syntax.ligo" ; "main" ] ;
|
||||||
[%expect {|
|
[%expect {|
|
||||||
ligo: parser error: Parse error at "-" from (1, 16) to (1, 17). In file "|../../test/contracts/negative/error_syntax.ligo"
|
ligo: : Parse error in file "error_syntax.ligo", line 1, characters 16-17, after "bar" and before "-".
|
||||||
{"parser_loc":"in file \"\", line 1, characters 16-17"}
|
{"parser_loc":"in file \"error_syntax.ligo\", line 1, characters 16-17"}
|
||||||
|
|
||||||
|
|
||||||
If you're not sure how to fix this error, you can
|
If you're not sure how to fix this error, you can
|
||||||
|
@ -182,7 +182,7 @@ sum_type:
|
|||||||
|
|
||||||
variant:
|
variant:
|
||||||
"<constr>" { {$1 with value={constr=$1; arg=None}} }
|
"<constr>" { {$1 with value={constr=$1; arg=None}} }
|
||||||
| "<constr>" "of" cartesian {
|
| "<constr>" "of" fun_type {
|
||||||
let region = cover $1.region (type_expr_to_region $3)
|
let region = cover $1.region (type_expr_to_region $3)
|
||||||
and value = {constr=$1; arg = Some ($2,$3)}
|
and value = {constr=$1; arg = Some ($2,$3)}
|
||||||
in {region; value} }
|
in {region; value} }
|
||||||
|
@ -201,7 +201,7 @@ sum_type:
|
|||||||
|
|
||||||
variant:
|
variant:
|
||||||
"<constr>" { {$1 with value = {constr=$1; arg=None}} }
|
"<constr>" { {$1 with value = {constr=$1; arg=None}} }
|
||||||
| "<constr>" "of" cartesian {
|
| "<constr>" "of" fun_type {
|
||||||
let region = cover $1.region (type_expr_to_region $3)
|
let region = cover $1.region (type_expr_to_region $3)
|
||||||
and value = {constr=$1; arg = Some ($2,$3)}
|
and value = {constr=$1; arg = Some ($2,$3)}
|
||||||
in {region; value} }
|
in {region; value} }
|
||||||
@ -315,7 +315,7 @@ param_decl:
|
|||||||
in ParamConst {region; value} }
|
in ParamConst {region; value} }
|
||||||
|
|
||||||
param_type:
|
param_type:
|
||||||
cartesian { $1 }
|
fun_type { $1 }
|
||||||
|
|
||||||
block:
|
block:
|
||||||
"begin" sep_or_term_list(statement,";") "end" {
|
"begin" sep_or_term_list(statement,";") "end" {
|
||||||
|
@ -1,52 +1,45 @@
|
|||||||
// Test a PascaLIGO function which takes another PascaLIGO function as an argument
|
// Test a PascaLIGO function which takes another PascaLIGO function as an argument
|
||||||
function foobar (const i : int) : int is
|
function foobar (const i : int) : int is
|
||||||
block {
|
begin
|
||||||
function foo (const i : int) : int is
|
function foo (const i : int) : int is i;
|
||||||
i ;
|
function bar (const f : int -> int) : int is f (i);
|
||||||
function bar (const f : int -> int) : int is
|
end with bar (foo);
|
||||||
f ( i ) ;
|
|
||||||
} with bar (foo) ;
|
|
||||||
|
|
||||||
// higher order function with more than one argument
|
// higher order function with more than one argument
|
||||||
function higher2(const i: int; const f: int -> int): int is
|
function higher2(const i : int; const f : int -> int): int is
|
||||||
block {
|
begin
|
||||||
const ii: int = f(i)
|
const ii: int = f (i)
|
||||||
} with ii
|
end with ii
|
||||||
|
|
||||||
function foobar2 (const i : int) : int is
|
function foobar2 (const i : int) : int is
|
||||||
block {
|
begin
|
||||||
function foo2 (const i : int) : int is
|
function foo2 (const i : int) : int is i
|
||||||
i;
|
end with higher2 (i,foo2)
|
||||||
} with higher2(i,foo2)
|
|
||||||
|
|
||||||
const a : int = 0;
|
const a : int = 0;
|
||||||
|
|
||||||
function foobar3 (const i : int) : int is
|
function foobar3 (const i : int) : int is
|
||||||
block {
|
begin
|
||||||
function foo2 (const i : int) : int is
|
function foo2 (const i : int) : int is a+i
|
||||||
(a+i);
|
end with higher2 (i,foo2)
|
||||||
} with higher2(i,foo2)
|
|
||||||
|
|
||||||
function f (const i : int) : int is
|
function f (const i : int) : int is i
|
||||||
i
|
|
||||||
|
|
||||||
function g (const i : int) : int is
|
function g (const i : int) : int is f (i)
|
||||||
f(i)
|
|
||||||
|
|
||||||
function foobar4 (const i : int) : int is
|
function foobar4 (const i : int) : int is g (g (i))
|
||||||
g(g(i))
|
|
||||||
|
|
||||||
function higher3(const i: int; const f: int -> int; const g: int -> int): int is
|
function higher3(const i : int; const f : int -> int; const g : int -> int)
|
||||||
block {
|
: int is
|
||||||
const ii: int = f(g(i));
|
begin
|
||||||
} with ii
|
const ii : int = f(g(i))
|
||||||
|
end with ii
|
||||||
|
|
||||||
function foobar5 (const i : int) : int is
|
function foobar5 (const i : int) : int is
|
||||||
block {
|
begin
|
||||||
const a : int = 0;
|
const a : int = 0;
|
||||||
function foo (const i : int) : int is
|
function foo (const i : int) : int is a+i;
|
||||||
(a+i);
|
function goo (const i : int) : int is foo (i)
|
||||||
function goo (const i : int) : int is
|
end with higher3(i,foo,goo)
|
||||||
foo(i);
|
|
||||||
} with higher3(i,foo,goo)
|
|
||||||
|
|
||||||
function foobar6 (const i : int) : (int->int) is f
|
function foobar6 (const i : int) : int -> int is f
|
||||||
|
Loading…
Reference in New Issue
Block a user