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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3355?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 72.6962%. Comparing base 
([`83cb245`](https://app.codecov.io/gh/apache/groovy/commit/83cb24530288ce0a32edb84ad8566a390c61af46?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`89643b3`](https://app.codecov.io/gh/apache/groovy/commit/89643b37396b146d8fd43aefd3e5b0b36e2b1973?dropdown=coverage&el=desc&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/3355/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/3355?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                  Coverage Diff                   @@
   ##             GROOVY_6_0_X      #3355        +/-   ##
   ======================================================
   - Coverage         72.7025%   72.6962%   -0.0063%     
   + Complexity          40308      40305         -3     
   ======================================================
     Files                1595       1595                
     Lines              141819     141819                
     Branches            26886      26886                
   ======================================================
   - Hits               103106     103097         -9     
   - Misses              29462      29465         +3     
   - Partials             9251       9257         +6     
   ```
   [see 9 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3355/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>




> A cast applied to await or to an async closure is parsed as a call to a 
> method named await or async
> ---------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12715
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12715
>             Project: Groovy
>          Issue Type: Bug
>          Components: parser-antlr4
>    Affects Versions: 6.0.0
>         Environment: Groovy 6.0.0 binary distribution and master 7379c5720d; 
> BellSoft JDK 21.0.12; macOS 15 arm64
>            Reporter: Scott Murphy Heiberg
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 7.0.0-alpha-1, 6.0.1
>
>
> {{await}} and {{async}} are contextual keywords with their own alternatives 
> in the {{expression}} rule of the grammar ({{awaitExprAlt}}, 
> {{asyncClosureExprAlt}}), but the operand of a cast is parsed by 
> {{castOperandExpression}}, which lists only another cast, a 
> {{postfixExpression}} and the unary operators. So after a cast the two words 
> fall back to being identifiers, and {{(BigDecimal) await(price)}} is a call 
> to a method named {{await}} with one argument, {{(Awaitable<Integer>) async { 
> 7 }}} a call to a method named {{async}} with a closure. At script level that 
> is a {{MissingMethodException}}; inside an async task the exception is 
> swallowed by the task nobody awaits, and the code awaiting the task's result 
> hangs.
> On 6.0.0 and master (JDK 21):
> {code:groovy}
> def t = async { 7 }
> Integer a = (Integer) await t          // MissingMethodException: No 
> signature of method: await for class: Script1 ... 
> (groovy.concurrent.Awaitable)
> {code}
> {code:groovy}
> import groovy.concurrent.Awaitable
> Awaitable<Integer> t = (Awaitable<Integer>) async { 7 }   // 
> MissingMethodException: ... async ... (Script1$_run_closure1)
> {code}
> {code:groovy}
> import groovy.concurrent.DataflowVariable
> DataflowVariable<BigDecimal> price = new DataflowVariable<BigDecimal>()
> DataflowVariable<Integer> quantity = new DataflowVariable<Integer>()
> DataflowVariable<BigDecimal> total = new DataflowVariable<BigDecimal>()
> async {
>     BigDecimal unitPrice = (BigDecimal) await(price)   // parsed as 
> this.await(price): the task fails
>     Integer count = (Integer) await(quantity)
>     total << unitPrice * count
> }
> async { quantity << 4 }
> async { price << 2.50 }
> println await(total)                                  // hangs: total is 
> never bound
> {code}
> The parenthesised forms {{(int) (await t)}} and {{-(await t)}} work, as do 
> {{BigDecimal b = await(price)}} and {{await(price) as BigDecimal}}. Found 
> because Claude Opus 5.5 wrote the cast form in every answer of an eval task 
> under static typing; the script then timed out.
> Suggested fix: add the {{asyncClosureExprAlt}} and {{awaitExprAlt}} 
> alternatives to {{castOperandExpression}} (it uses {{options { baseContext = 
> expression; }}}, so the same labels reuse the same contexts and 
> {{AstBuilder.visitAwaitExprAlt}} and {{visitAsyncClosureExprAlt}} apply 
> unchanged). Pull request to follow.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to