I was wondering if there is anyone who is good at scripting and interested in bulk translating our snapshots from the rust compiler crates/compiler/test_syntax/tests/snapshots to the new format in src/snapshots/...?
There's a lot there so I imagine a script would be the way to go. No all of them will be valid with the new language design, but we can certainly delete any of those as we go.
It would be great to have these and really harden up the parser.
It would be great if we could have the translater in the Rust version move them to v0.1 first and then run a script on that
@Norbert Hajagos would this interest you?
There will be some human review required. For example we dont have abilities in roc 0.1 syntax, so no need to worry about those tests etc.
I figure I would need to be working on the rust based formatter. I'm not familiar with that, but that just means I'll need more time. First thought was that it would be (sorry for the wording) "wasted learning", since we are abandoning that part of the code and rust with the new compiler soon. Then I realized that's how one misses on learning opportunities. The bigger the challenge :)
Am I correct, I should be looking at crates/compiler/fmt/src/migrate.rs ?
Are there tests for the "migrator" I could start from?
Going to bed, bye
I personally wouldn't bother with the migrate script or rust compiler, it's not strictly necessary and I'm not sure it would save much time.
You could write a bash or python script to copy them into the right folder with the snapshot format, then change the syntax by hand and delete any we dont want one by one. There is quite a few but it wouldn't take that long, and it's a good way to learn the new syntax. I've been doing a similar thing writing new snapshot tests to try and cover various combinations of features.
That being said I'm not that familiar with the translator we have in rust.
It may a simple as just using the roc binary and passing an argument like --migrate... in which case you might make a bash script to copy all the syntax tests into another format and make them .roc filles, and then convert them to snapshot format.
I haven't fully scoped out the task, it was just an idea to keep/re-use all the syntax tests.
i think i'd rather bring them over manually in a curated fashion
we have a lot of fuzzer crash output in there that won't apply necessarily to the new syntax/compiler
We do have a new fuzzer that is just running away
Churning out errors
oh damn
Though generally gets stuck finding the same errors
This is the new zig compiler fuzzer? I haven't poked that for a while
https://roc-lang.github.io/roc-compiler-fuzz/
Oh I forgot about that site :heart_eyes:
Would you be interested @Brendan Hansknecht in helping me upgrade that to include the Can stage as well?
I've been meaning to get to it but haven't yet
we also have the type check stage too
If you add a fuzzer to the roc repo with a target, I can easily add it to the site
I'll push the changes to the branch so you can see what is there
https://github.com/roc-lang/roc/pull/7890
If there is anything we don't want I'm happy to clean it up
It's also got a bunch of random fuzz fixes in commits too. I was going to bring them across into a separate clean branch, but figure if we want the compiler pipeline fuzzer as a new target, then it's probably ok to just bring everything across together.
I've been running the fuzzer using system afl.
There’s already a mostly built translator from the old syntax to the new one
https://github.com/roc-lang/roc/blob/main/crates/compiler/fmt/src/migrate.rs
I've done this here https://github.com/roc-lang/roc/pull/7910
Figured we might find a bug from all that fuzzing we did. I found 1 (which I already have a PR in to fix).
So it feels like our new compiler is already more stable than the old.
After playing with it a bit, I figure it is helpful having the old syntax verbatim (no migration) in there as a snapshot. There are probably many common error cases that we would like to make nice error reports for.
Largest Roc PR ever :p ?
I didnt think the generated files counted to the line count stats :thinking:
Believe it or not, safari on my laptop chokes up in the web interface but my samsung mobile phone is butter smooth. :shrug:
Need to be smart about your buffering :)
This will also give a lot more seeds to the fuzz corpus base which is good
Last updated: Jun 16 2026 at 16:19 UTC