[ABNF] Require function output type.

Since this pre-testnet3 version of Leo does not support tuple types, and since a
missing function type is meant to be interpreted as the empty tuple type `()` in
future versions of Leo, it seems appropriate to require a function output type
in this version of Leo. We could instead default to a different type
(e.g. bool), but it seems cleaner to require it for now, and make it optional
later.
This commit is contained in:
Alessandro Coglio 2022-03-28 12:26:36 -07:00
parent 88c1bfd8a3
commit 4cce09d5c8
2 changed files with 2 additions and 2 deletions

View File

@ -778,7 +778,7 @@ Go to: _[print-arguments](#user-content-print-arguments), [print-function](#user
<a name="function-declaration"></a>
```abnf
function-declaration = %s"function" identifier
"(" [ function-parameters ] ")" [ "->" type ]
"(" [ function-parameters ] ")" "->" type
block
```

View File

@ -310,7 +310,7 @@ print-arguments = "(" string-literal *( "," expression ) [ "," ] ")"
print-call = print-function print-arguments
function-declaration = %s"function" identifier
"(" [ function-parameters ] ")" [ "->" type ]
"(" [ function-parameters ] ")" "->" type
block
function-parameters = function-parameter *( "," function-parameter ) [ "," ]