silverchain icon indicating copy to clipboard operation
silverchain copied to clipboard

Cryptic error on rules without "tail" method

Open bannmann opened this issue 2 years ago • 0 comments

Due to sloppy editing, at one point I ended up with an AG whose structure looked as shown below (except that the rule ended after the *). I was confused because I could not see a "conflict" anywhere, then figured out what the cause was.

// fails with the following error:
// Conflict: String#L12C5, secondA()#L15C9, secondB()#L17C9
//
// fix:
// replace "//third()" with "third()"
//
// ideas for helpful messages:
// - line 21:4 rule must have non-repeatable tail method so it can return String#L16C5
//          ^-- points to the semicolon ending the rule
//
Foo {
    String
    first()
    (
        secondA()
        |
        secondB()
    )
    *
    //third()
    ;
}

I guess if the error message had said something about what I would (informally?) call a "tail" method, I'd have understood immediately.

bannmann avatar Dec 01 '21 18:12 bannmann