A fast, friendly, functional language. Work in progress!
Go to file
Joshua Warner a046428ce6
Add fuzzing for the formatter and fix bugs
This commit adds fuzzing for the (expr) formatter, with the same invariants that we use for fmt tests:
  * We start with text, which we parse
  * We format the AST, which must succeed
  * We parse back the AST and make sure it's identical igoring whitespace+comments
  * We format the new AST and assert it's equal to the first formatted version ("idempotency")

Interestingly, while a lot of bugs this found were in the formatter, it also found some parsing bugs.

It then fixes a bunch of bugs that fell out:
* Some small oversights in RemoveSpaces
* Make sure `_a` doesn't parse as an inferred type (`_`) followed by an identifier (parsing bug!)
* Call `extract_spaces` on a parsed expr before matching on it, lest it be Expr::SpaceBefore - when parsing aliases
* A few cases where the formatter generated invalid/different code
* Numerous formatting bugs that caused the formatting to not be idempotent

The last point there is worth talking further about. There were several cases where the old code was trying to enforce strong
opinions about how to insert newlines in function types and defs. In both of those cases, it looked like the goals of
(1) idempotency, (2) giving the user some say in the output, and (3) these strong opinions - were often in conflict.

For these cases, I erred on the side of following the user's existing choices about where to put newlines.

We can go back and re-add this strong opinionation later - but this seemed the right approach for now.
2022-12-17 09:52:09 -08:00
.cargo Add debug flag to check IR after specialization 2022-12-05 18:05:35 -06:00
.github back to cron 2022-12-14 19:44:16 +01:00
.reuse s/rtfeldman/roc-lang/g in links to GitHub repos 2022-08-12 15:24:09 -04:00
ci fix release packaging 2022-12-07 16:53:38 +01:00
crates Add fuzzing for the formatter and fix bugs 2022-12-17 09:52:09 -08:00
design design doc updates 2022-11-25 12:01:06 +01:00
devtools vscode marketplace example 2022-10-28 11:33:01 +02:00
examples Merge pull request #4744 from roc-lang/rust-example-toolchain 2022-12-13 10:52:36 +01:00
getting_started tutorial and docs improvements 2022-12-05 14:53:18 +01:00
nightly_benches changed Cargo versions from 0.1.0 to 0.0.1 2022-08-03 11:41:19 +02:00
www added webiste view instructions 2022-12-14 19:37:07 +01:00
.gitignore Merge remote-tracking branch 'origin/main' into expect-print-values 2022-12-08 23:42:03 +01:00
.llvmenv Update .llvmenv 2022-05-09 19:45:09 +02:00
AUTHORS Update AUTHORS 2022-10-31 20:58:26 -04:00
BUILDING_FROM_SOURCE.md add zig version 2022-11-14 09:36:09 +01:00
Cargo.lock Merge pull request #4745 from roc-lang/i4712 2022-12-14 14:55:25 -06:00
Cargo.toml Merge pull request #4653 from roc-lang/fix-mv 2022-12-02 07:19:57 -05:00
CODE_OF_CONDUCT.md Use dashes for list markers 2022-09-09 01:12:31 -06:00
CONTRIBUTING.md typos 2022-11-16 16:15:12 +01:00
default.nix update inkwell nix sha 2022-12-04 09:07:44 +01:00
FAQ.md Revise roc-for-elm-programmers re: dbg and crash 2022-12-08 06:09:01 -05:00
flake.lock rust 1.64 + clippy 2022-11-09 19:35:09 +01:00
flake.nix added webiste view instructions 2022-12-14 19:37:07 +01:00
LEGAL_DETAILS remove unused install-ci-libraries.sh 2022-05-09 09:24:37 +02:00
LICENSE Use © instead of (c) for copyright symbol 2021-05-03 21:18:36 -04:00
mlc_config.json ignore 0.0.0.0 for link checking 2022-12-14 19:42:49 +01:00
README.md Delete TUTORIAL.md in favor of HTML version 2022-11-24 16:06:37 -05:00
roc-for-elm-programmers.md Add testing section to roc-for-elm-programmers 2022-12-08 06:09:53 -05:00
rust-toolchain.toml added toolchain file to example 2022-12-12 19:57:56 +01:00
shell.nix formatted nix files 2022-06-03 16:51:54 +02:00
typos.toml Merge branch 'main' into markdown 2022-09-06 08:31:49 +02:00
version.txt Make version.txt default to a valid file path 2022-11-20 10:55:15 -05:00

Work in progress!

Roc is not ready for a 0.1 release yet, but we do have:

If you'd like to get involved in contributing to the language, the Zulip chat is also the best place to get help with good first issues.

Sponsors

We are very grateful to our sponsors NoRedInk, rwx, and Tweede golf.

NoRedInk logo      rwx logo      tweede golf logo

If you or your employer would like to sponsor Roc's development, please DM Richard Feldman on Zulip!