roc icon indicating copy to clipboard operation
roc copied to clipboard

Add new `...` ellipsis keyword

Open smores56 opened this issue 11 months ago • 3 comments

To support incomplete code, we want to add a new ... ellipsis keyword (not an operator, since it doesn't operate on anything, even though it's not a word). It will be a syntax node that takes no arguments and acts somewhat like crash "Not yet written". The difference being that:

  • An ellipsis won't trigger "unreachable code" errors
  • It is considered as a new type of code issue: a note, in addition to errors and warnings.
    • For reporting notes, they should be highlighted as issues in code (but not doc code blocks), but only reported if there are no errors or warnings.
    • Notes should return a non-zero exit code to imply that there is an issue.
    • Notes should also be aggregated at the module level, something like:
── UNFINISHED CODE in path/To/Module.roc ───────────────────────────────────────

I still see a 3 places where code was left unfinished in this module:

35| if x == ... then
            ^^^

37| abc = ...
          ^^^

60| func.call("foo", ...)
                     ^^^

────────────────────────────────────────────────────────────────────────────────

0 errors and 0 warnings found in XYZ ms.

A good way to implement this would probably be to desugar this to crash "Not yet written", but add a kind: CrashKind field on roc_can crash nodes to report compilation issues differently for ellipses and normal crashes.

smores56 avatar Dec 30 '24 22:12 smores56

For clarity for whoever implements this (as there isn't a linked a Zulip thread), this wouldn't be for type annotations, where the existing type hole (_) type would be used instead, right?

lishaduck avatar Jan 02 '25 22:01 lishaduck

That's correct! This is just for arbitrary expressions in code and in doc code blocks.

smores56 avatar Jan 02 '25 23:01 smores56

We have only implemented the parsing of ellipses, their canonicalization and all is the remaining bulk of the work.

smores56 avatar Mar 01 '25 04:03 smores56