error[E012]: declaration `x` has no definition
--> /home/fmease/programming/main_projects/lushui/x.lushui:3:9
|
3 | x: X
| ><
|
help: provide a definition with `=`
Which is entirely correct but it is confusing for newcomers. The correct code would be:
data X: Type
of
x: X
So, when we encounter a non-intrinsic function declaration without a body and the declaration above is a data declaration, add the following help message: indent the declaration to make it a data constructor for type Type (or something similar).
We don't need to check if the of is in a separate line, it's a fine suggestion even in a more general setting. Just make sure (smh!) that we are not in a delimited section (we don't store this in the AST right now though, that needs to change). Another implementation issue: In the lowerer, we cannot currently say give me the declaration above, we either need to add this information to the DeclarationContext or make use of indices (node indices) in the AST (c.f. #44).
Given:
lushui
currently outputs:Which is entirely correct but it is confusing for newcomers. The correct code would be:
So, when we encounter a non-intrinsic function declaration without a body and the declaration above is a data declaration, add the following help message: indent the declaration to make it a data constructor for type
Type
(or something similar).We don't need to check if the
of
is in a separate line, it's a fine suggestion even in a more general setting. Just make sure (smh!) that we are not in a delimited section (we don't store this in the AST right now though, that needs to change). Another implementation issue: In the lowerer, we cannot currently say give me the declaration above, we either need to add this information to theDeclarationContext
or make use of indices (node indices) in the AST (c.f. #44).