Skip to content

Improving error recovery #69

@doorgan

Description

@doorgan

Following discussion in #65

One thing that caught my attention is that we have a test with this snippet(doesn't drop the cursor node):

%{state |
          foo: s
        __cursor__()
        ,
          bar: Foo.Bar.load(state.foo, state.baz)}

This would incorrectly report an unexpected ) for the Foo.Bar.load call before the fix in #65, but then I noticed that after parsing, it gets recovered to this:

%{state | foo: s}
s(__cursor__())
nil
Foo.Bar.load(state.foo, state.baz)
nil
nil

Essentially we:

  1. Find the unexpected __cursor__() and close the map
  2. Extract the following lines from that map
  3. The bar: part doesn't make sense outside of a map/kw list, so we drop it

I think dropping bar: there makes sense, but shouldn't the second line be just __cursor__()? The s is already preserved inside the map under the foo key

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions