[
https://issues.apache.org/jira/browse/GROOVY-12169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18097205#comment-18097205
]
ASF GitHub Bot commented on GROOVY-12169:
-----------------------------------------
codecov-commenter commented on PR #2718:
URL: https://github.com/apache/groovy/pull/2718#issuecomment-5007622627
##
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2718?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
Report
:x: Patch coverage is `62.72189%` with `63 lines` in your changes missing
coverage. Please review.
:white_check_mark: Project coverage is 69.1396%. Comparing base
([`b9a3822`](https://app.codecov.io/gh/apache/groovy/commit/b9a3822a2b24ec8a87101cd7b3c04b68683db504?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
to head
([`2ae01a3`](https://app.codecov.io/gh/apache/groovy/commit/2ae01a3e703031668c45481556642d4768fe1fc1?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/2718?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Patch % | Lines |
|---|---|---|
|
[...parser/antlr4/internal/MissingParenDiagnostic.java](https://app.codecov.io/gh/apache/groovy/pull/2718?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fparser%2Fantlr4%2Finternal%2FMissingParenDiagnostic.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9wYXJzZXIvYW50bHI0L2ludGVybmFsL01pc3NpbmdQYXJlbkRpYWdub3N0aWMuamF2YQ==)
| 61.4907% | [30 Missing and 32 partials :warning:
](https://app.codecov.io/gh/apache/groovy/pull/2718?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
|
|
[...rser/antlr4/internal/DescriptiveErrorStrategy.java](https://app.codecov.io/gh/apache/groovy/pull/2718?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fparser%2Fantlr4%2Finternal%2FDescriptiveErrorStrategy.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9wYXJzZXIvYW50bHI0L2ludGVybmFsL0Rlc2NyaXB0aXZlRXJyb3JTdHJhdGVneS5qYXZh)
| 87.5000% | [1 Missing :warning:
](https://app.codecov.io/gh/apache/groovy/pull/2718?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
|
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/groovy/pull/2718?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #2718 +/- ##
==================================================
- Coverage 69.1438% 69.1396% -0.0042%
- Complexity 34327 34377 +50
==================================================
Files 1538 1539 +1
Lines 129611 129778 +167
Branches 23580 23635 +55
==================================================
+ Hits 89618 89728 +110
- Misses 31950 31979 +29
- Partials 8043 8071 +28
```
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/2718?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Coverage Δ | |
|---|---|---|
|
[...rser/antlr4/internal/DescriptiveErrorStrategy.java](https://app.codecov.io/gh/apache/groovy/pull/2718?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fparser%2Fantlr4%2Finternal%2FDescriptiveErrorStrategy.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9wYXJzZXIvYW50bHI0L2ludGVybmFsL0Rlc2NyaXB0aXZlRXJyb3JTdHJhdGVneS5qYXZh)
| `61.1111% <87.5000%> (+7.7778%)` | :arrow_up: |
|
[...parser/antlr4/internal/MissingParenDiagnostic.java](https://app.codecov.io/gh/apache/groovy/pull/2718?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fparser%2Fantlr4%2Finternal%2FMissingParenDiagnostic.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9wYXJzZXIvYW50bHI0L2ludGVybmFsL01pc3NpbmdQYXJlbkRpYWdub3N0aWMuamF2YQ==)
| `61.4907% <61.4907%> (ø)` | |
... and [3 files with indirect coverage
changes](https://app.codecov.io/gh/apache/groovy/pull/2718/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test
Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests,
report on failures, and find test suite problems.
- :package: [JS Bundle
Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save
yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
> Improve syntax error message and caret position for missing ')'
> ---------------------------------------------------------------
>
> Key: GROOVY-12169
> URL: https://issues.apache.org/jira/browse/GROOVY-12169
> Project: Groovy
> Issue Type: Improvement
> Reporter: Daniel Sun
> Priority: Major
>
> h3. Problem
> When a Groovy source is missing a closing parenthesis {{{}){}}}, the ANTLR4
> parser often reports a generic *Unexpected input* message at a *misleading*
> location (frequently the opening {{(}} or an earlier token), instead of
> *Missing ')'* at the place where {{)}} should be inserted or where the
> construct first went wrong.
> This makes simple typos hard to fix, especially with casts, method calls, and
> formal parameter lists.
> h3. Root cause
> * ANTLR4 does not recover missing tokens as helpfully as the old Antlr2 path.
> * Grammar-level *error alternatives* on {{rparen}} can produce {*}Missing
> ')'{*}, but they enlarge the ATN and hurt successful-parse performance. They
> were removed in the GROOVY-9588 work for that reason.
> * With {{BailErrorStrategy}} + generic mismatch reporting, prediction often
> fails a deep parenthesised alternative and falls back to a shorter parse, so
> the surface error points far from the real omission.
> h3. Goal
> Report *Missing ')'* with an accurate caret when the token stream clearly
> indicates a missing or incomplete {{{}){}}}, *without* reintroducing grammar
> error alternatives on the hot (successful) parse path.
> h3. Approach
> Error-path-only diagnostics in the existing error strategy:
> * {{DescriptiveErrorStrategy}} — on {{InputMismatch}} / {{{}NoViableAlt{}}},
> prefer a missing-paren diagnostic over the generic message.
> * {{MissingParenDiagnostic}} — single linear scan of the (fully filled)
> token stream after failure; *no* work on successful parses.
> Detection order (most specific first):
> # RecognitionException whose *sole* expected token is {{{}RPAREN{}}}, and
> net paren depth > 0 (avoids false positives like {{foo(1;2;3)}} where parens
> are balanced but {{;}} is wrong).
> # Cast / parenthesised-type pattern: {{(type <expr-start>}} without the
> cast's {{)}} (e.g. {{{}(int 123){}}}).
> # Unclosed {{(}} at EOF or at a structural hard-stop such as an outer
> {{{}}{}}}.
> Token stream is force-filled to EOF before scanning so a trailing {{)}} is
> visible even when the parser failed earlier inside the list.
> h3. Expected result (after)
> ||Source||Expected message||
> |{{println ((int 123)}}|{{Missing ')'}} at the start of {{123}}|
> |{\{def x() { println((int) 123 }}}|{{Missing ')'}} at the insertion point
> after {{123}}|
> |{\{def m( { }}}|{{Missing ')'}} at {{'
> Unknown macro: \{'}
> }|
> |{{foo(1, 2}}|{{Missing ')'}} at end of line|
> |{{def f(int x}}|{{Missing ')'}} after {{x}}|
> |{{println ((int) 123}}|{{Missing ')'}} at end of line|
> Balanced but invalid constructs (e.g. {{{}[].bar(1;2;3){}}}) must *not* be
> rewritten as {*}Missing ')'{*}; keep the generic unexpected-input (or other)
> message.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)