roc icon indicating copy to clipboard operation
roc copied to clipboard

Closures in doc code (WIP)

Open Chadtech opened this issue 4 years ago • 4 comments

I ran the doc gen code on my test Roc module, to see the new syntax highlighting in action, and I got this error:

[ast/src/lang/env.rs:78] "Don't Forget to set the region eventually" = "Don't Forget to set the region eventually"
thread 'insert_doc_syntax_highlighting::closure_expr' panicked at 'A SpaceBefore did not get removed during operator desugaring somehow: SpaceBefore(
    Defs(
        [
            |L 1-4, C 16-21| Body(|L 1-1, C 16-17| Identifier("f"), |L 1-4, C 20-21| Closure([|L 1-1, C 21-22| Identifier("x"), |L 1-1, C 24-25| Identifier("y")], |L 2-4, C 20-21| SpaceBefore(Defs([|L 2-2, C 20-25| Body(|L 2-2, C 20-21| Identifier("a"), |L 2-2, C 24-25| Num("3")), |L 3-3, C 20-25| SpaceBefore(Body(|L 3-3, C 20-21| Identifier("b"), |L 3-3, C 24-25| Num("6")), [Newline])], |L 4-4, C 20-21| SpaceBefore(Var { module_name: "", ident: "c" }, [Newline])), [Newline]))),
        ],
        |L 6-6, C 16-24| SpaceBefore(Str(PlainLine("string")), [Newline, Newline]),
    ),
    [
        Newline,
    ],
)', ast/src/lang/core/expr/expr_to_expr2.rs:676:13

It looks like my code snippet doesnt work.

                f = \x, y ->
                    a = 3
                    b = 6
                    c
    
                "string"

@Anton-4 you just worked on this. Is it obvious to you what is going wrong? I am happy to keep looking into this if not, and thanks again for working on the docs syntax highlighting.

Chadtech avatar Oct 16 '21 17:10 Chadtech

I'm almost done supporting Closures in PR #1787 :)

Anton-4 avatar Oct 16 '21 17:10 Anton-4

@Anton-4 Awesome!

Chadtech avatar Oct 16 '21 17:10 Chadtech

Can this be closed in favor of #1787 @Chadtech ?

Anton-4 avatar Oct 19 '21 17:10 Anton-4

Yeah. Sounds good.

Chadtech avatar Oct 19 '21 19:10 Chadtech

I don't know why this was reopened/restored (twice), but I'm closing/deleting this PR/branch now for staleness.

kili-ilo avatar Sep 25 '22 02:09 kili-ilo