Closed loafoflead closed 3 days ago
That error is indeed uninformative, I've updated it. However this is more worrying:
FATAL ERROR Should be unreachable -> in expr_is_constant_eval @ in /home/runner/work/c3c/c3c/src/compiler/expr.c:346
In what version do you see this? I hope it's not reproducible in 0.6.4
The error is not reproducible in 0.6.4, the fatal error was in 0.5 I think.
Will make sure to include version of compiler in future issues 👍.
Thank you for reporting unclear errors, those are indeed important.
When writing macros that take types as arguments, if the type is named with a lowercase identifier (e.g. 'type', instead of 'Type'), the compiler emits a very cryptic message.
The following functions fine:
And when called return the expected result.
However when 'Type' is 'type', the compiler emits the following error when trying to call the macro:
Sorry if this is just a skill issue, but I couldn't find any mention of the importance of case-sensitivity in the docs on macros, and only found this out through trial and error and in the source code.
Perhaps just a mention in the 'Macros' section that types need to have the correct case as in the rest of the language (which makes sense) would be good, or a compiler message that says 'Incorrect case'.
Below is the full code snippet: