Repository navigation
fix: #1941 commit to named arguments once the first one starts, so a typo inside the list is reported where it is - #2231
Conversation
Benchmark comparisonMedian of 5 round(s) per side, interleaved on the same runner against the PR merge-base, with the bench fixture frozen across both builds. Noise is the spread between the fastest and the slowest round, taken from the noisier side.
ScalingEach sized case against its
No case moved by more than 20% beyond its own noise. |
|
@yegor256 CI is green and the branch is up to date with |
d9724da to
cf72d5d
Compare
|
@yegor256 CI is green and the branch is up to date with |
3d29443 to
e7cfc13
Compare
yegor256
left a comment
There was a problem hiding this comment.
The parser commits to named arguments only after lookahead sees an attribute or index followed by an arrow. Tests pin the improved error locations and retain nested positional calls.
84344af to
2df9b97
Compare
…tarts, so a typo inside the list is reported where it is
2df9b97 to
ba1ceee
Compare
An application read its whole list of named arguments inside one
try, so a failure anywhere in the list backtracked into the positional form, which then failed at the first↦. A)forgotten on line 6 of the program in #1941 was blamed on line 3, at the↦oftext, which is valid code.exTailnow only looks ahead for the start of a named argument, an attribute or anαindex followed by↦, and once it sees one it parses the rest of the list without backtracking. The program of #1941 is now reported at7:10, the↦ofmode, the first token after the missing)that cannot be read.⟦ a ↦ Φ.foo( x ↦ 1, y ↦ ) ⟧is reported at the empty value ofy, and⟦ a ↦ Φ.foo( x ↦ 1, 2 ) ⟧at the2, both instead of at the↦afterx. Since #2259 an argument takes no inline voids, so the lookahead takes none either.A
ParserSpecblock checks the three positions and fails without the change. A case in "parse applications with mixed bindings" checks thatQ.f(b(c), d), a nested call, stays positional.Fixes #1941