[ 
https://issues.apache.org/jira/browse/GROOVY-12401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18114547#comment-18114547
 ] 

ASF GitHub Bot commented on GROOVY-12401:
-----------------------------------------

codecov-commenter commented on PR #2924:
URL: https://github.com/apache/groovy/pull/2924#issuecomment-5644883879

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2924?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 `67.90123%` with `104 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 71.1902%. Comparing base 
([`3246257`](https://app.codecov.io/gh/apache/groovy/commit/32462579e2689374115525c2ac3e50a1ad86dfb5?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`0d31ea8`](https://app.codecov.io/gh/apache/groovy/commit/0d31ea81fd8049e62fa7445f64800d1e245c70bd?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 1 commits behind head on master.
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2924?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[...antlr4/internal/AbstractFriendlyErrorStrategy.java](https://app.codecov.io/gh/apache/groovy/pull/2924?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fparser%2Fantlr4%2Finternal%2FAbstractFriendlyErrorStrategy.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9wYXJzZXIvYW50bHI0L2ludGVybmFsL0Fic3RyYWN0RnJpZW5kbHlFcnJvclN0cmF0ZWd5LmphdmE=)
 | 75.1968% | [22 Missing and 41 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2924?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   | 
[...va/org/apache/groovy/parser/antlr4/AstBuilder.java](https://app.codecov.io/gh/apache/groovy/pull/2924?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fparser%2Fantlr4%2FAstBuilder.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9wYXJzZXIvYW50bHI0L0FzdEJ1aWxkZXIuamF2YQ==)
 | 38.7097% | [27 Missing and 11 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2924?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   | 
[...g/apache/groovy/parser/antlr4/ModifierManager.java](https://app.codecov.io/gh/apache/groovy/pull/2924?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fparser%2Fantlr4%2FModifierManager.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9wYXJzZXIvYW50bHI0L01vZGlmaWVyTWFuYWdlci5qYXZh)
 | 0.0000% | [3 Missing :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2924?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>
   
   
   
   [![Impacted file tree 
graph](https://app.codecov.io/gh/apache/groovy/pull/2924/graphs/tree.svg?width=650&height=150&src=pr&token=1r45138NfQ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/groovy/pull/2924?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #2924        +/-   ##
   ==================================================
   - Coverage     71.1971%   71.1902%   -0.0069%     
   - Complexity      37729      37835       +106     
   ==================================================
     Files            1584       1584                
     Lines          136500     136797       +297     
     Branches        25361      25450        +89     
   ==================================================
   + Hits            97184      97386       +202     
   - Misses          30546      30589        +43     
   - Partials         8770       8822        +52     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2924?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...ovy/parser/antlr4/util/PositionConfigureUtils.java](https://app.codecov.io/gh/apache/groovy/pull/2924?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fparser%2Fantlr4%2Futil%2FPositionConfigureUtils.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9wYXJzZXIvYW50bHI0L3V0aWwvUG9zaXRpb25Db25maWd1cmVVdGlscy5qYXZh)
 | `98.0000% <100.0000%> (+0.0408%)` | :arrow_up: |
   | 
[.../main/java/org/codehaus/groovy/syntax/Numbers.java](https://app.codecov.io/gh/apache/groovy/pull/2924?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fsyntax%2FNumbers.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3N5bnRheC9OdW1iZXJzLmphdmE=)
 | `82.4324% <100.0000%> (ø)` | |
   | 
[...g/apache/groovy/parser/antlr4/ModifierManager.java](https://app.codecov.io/gh/apache/groovy/pull/2924?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fparser%2Fantlr4%2FModifierManager.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9wYXJzZXIvYW50bHI0L01vZGlmaWVyTWFuYWdlci5qYXZh)
 | `93.4210% <0.0000%> (ø)` | |
   | 
[...va/org/apache/groovy/parser/antlr4/AstBuilder.java](https://app.codecov.io/gh/apache/groovy/pull/2924?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fparser%2Fantlr4%2FAstBuilder.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9wYXJzZXIvYW50bHI0L0FzdEJ1aWxkZXIuamF2YQ==)
 | `85.9070% <38.7097%> (-0.7266%)` | :arrow_down: |
   | 
[...antlr4/internal/AbstractFriendlyErrorStrategy.java](https://app.codecov.io/gh/apache/groovy/pull/2924?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fparser%2Fantlr4%2Finternal%2FAbstractFriendlyErrorStrategy.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9wYXJzZXIvYW50bHI0L2ludGVybmFsL0Fic3RyYWN0RnJpZW5kbHlFcnJvclN0cmF0ZWd5LmphdmE=)
 | `82.6633% <75.1968%> (-13.1700%)` | :arrow_down: |
   
   ... and [10 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/2924/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 remaining parser diagnostics and authored AST source positions
> ----------------------------------------------------------------------
>
>                 Key: GROOVY-12401
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12401
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Daniel Sun
>            Priority: Major
>
> h3. Problem
> After GROOVY-12353, several everyday syntax mistakes still surface as generic 
> *Unexpected input*, and several authored AST nodes still carry line/column 
> {{-1}} even though they came from source. Tooling uses {{lineNumber > 0}} to 
> tell authored code from generated code ({{SecureASTCustomizer.isFromSource}}).
> h3. Diagnostics (before)
> * Array creation without a size, an extra empty dimension, or a size combined 
> with an initializer:
> {noformat}
> new int[]
> new int[][2]
> new int[2] { 1 }
> {noformat}
> reports *Unexpected input*.
> * A type argument list written as a comparison (meant {noformat}List<Integer> 
> name{noformat}):
> {noformat}
> List<Integer name
> {noformat}
> reports *Unexpected input*.
> * A method header in a statement position (for example inside a closure 
> invoked as a statement) reports *Unexpected input* instead of naming the 
> misplaced method.
> * {{import}} inside a method reports {{Unexpected input: 'import'}}.
> * {{do}} with two statements and a later {{while}}:
> {noformat}
> do
> println 1
> println 2
> while (false)
> {noformat}
> reports {{Missing 'while'}} on the second {{println}} even though {{while}} 
> is already on the next line.
> * Enum constants followed by members without a semicolon:
> {noformat}
> enum E { A
>     void m() {}
> }
> {noformat}
> reports *Unexpected input* instead of asking for {{;}} after the last 
> constant.
> * An extra closer or semicolon reports {{Unexpected input: ')'}} (or the 
> matching {{]}} / {{\}}} / {{;}}) instead of naming the extra token.
> * A second {{default}} in a switch points the caret at the first {{default}}, 
> not the duplicate.
> * Integer overflow wording does not match javac's {{Integer number too 
> large}}.
> h3. Source positions (before)
> At CONVERSION these authored nodes dump as {{-1}}:
> * Interface field {{int a;}} — {{FieldNode.lastLineNumber}} is copied from a 
> synthetic {{ConstantExpression(0)}}. 
> {{DefaultGroovyMethods.asBoolean(Object)}} is non-null, so the synthetic 
> value is treated as a real stop.
> * Classic for-control {noformat}for (int i = 0; i < n; i++){noformat} — the 
> outer {{ClosureListExpression}} is never given a source span. Empty 
> init/cond/update slots ({{EmptyExpression.INSTANCE}}) should stay {{-1}}.
> * Authored empty parentheses:
> {noformat}
> new Object()
> new Runnable() { }
> super()
> {noformat}
> * GROOVY-11492 annotation default — the {{listX}} rewrite drops the brace 
> span:
> {noformat}
> String[] x() default { }
> {noformat}
> * Single-spread index wrapper (the multi-index path was already stamped):
> {noformat}
> a[*[1, 2]]
> {noformat}
> Not a bug — these have no span in the source and should stay {{-1}}: 
> {{ModuleNode}}, a script's wrapping {{BlockStatement}}, implicit {{return 
> null}}, TWR desugaring (names such as {noformat}__$$t0{noformat}), synthetic 
> {{@Trait}}, the class initializer {noformat}<clinit>{noformat}, and 
> {{EmptyExpression.INSTANCE}}.
> h3. Goal
> * javac-aligned sentences for the remaining recognition failures, with the 
> caret on the right token
> * authored AST nodes carry a real source span; generated nodes stay at {{-1}}
> * error-path only — no grammar error alternatives (GROOVY-9588)
> h3. Approach
> * {{AbstractFriendlyErrorStrategy}} refines the fallback sentence: array 
> creation, unclosed type argument, method header in statement position, 
> misplaced {{import}}, unmatched {{do}}/{{while}}, enum semicolon, extra 
> closers, annotation-style {{default}} after a method header. 
> {{MissingDelimiterDiagnostic}} still relocates the caret for an unclosed 
> {{)}} / {{]}} / {{\}}}. Locate/refine stay in a defensive try; listener 
> dispatch is one call afterwards.
> * {{AstBuilder}} / {{ModifierManager}} / {{Numbers}}: record headers, missing 
> method body vs abstract, index used as a method call, overflow wording; 
> duplicate {{default}} points at the second {{default}}.
> * {{PositionConfigureUtils}}: copy an end position only when {{lastLineNumber 
> > 0}}. Stamp the classic-for control list, authored empty parentheses, the 
> GROOVY-11492 {{listX}} result, and the single-spread index wrapper.
> h3. Expected result (after)
> * {noformat}new int[]{noformat} → {noformat}Array dimension missing; specify 
> a size or add an initializer '{}'{noformat}
> * {noformat}List<Integer name{noformat} → {{Missing '>'}}
> * method header in a statement position → {{Method definition not expected 
> here}}
> * {{import}} inside a method → {{'import' is only allowed at the beginning of 
> a compilation unit}}
> * {{do}} / two statements / later {{while}} → {noformat}do-while body must be 
> a single statement; wrap multiple statements in '{ }'{noformat}; a true 
> omission is still {{Missing 'while'}}
> * enum constants then members, no semicolon → {{';' expected after the last 
> enum constant}}
> * extra {{)}} → {{Unexpected ')'}}
> * interface {{int a;}}, empty {noformat}for (;;) { }{noformat}, {{new 
> Object()}}, annotation {noformat}default { }{noformat}, and {noformat}a[*[1, 
> 2]]{noformat} carry real line/column on the authored node; synthetic children 
> stay {{-1}}
> Valid programs are unchanged.
> h3. Related
> GROOVY-12353, GROOVY-11492, GROOVY-12169, GROOVY-9588



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to