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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3183?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 74.1565%. Comparing base 
([`0941dba`](https://app.codecov.io/gh/apache/groovy/commit/0941dbacf496a1667c27681c6fe76deee59bfb57?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`1830b63`](https://app.codecov.io/gh/apache/groovy/commit/1830b63e1c0afff5ed1e25dc8f6bf5b6e85231fc?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 11 commits behind head on master.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree 
graph](https://app.codecov.io/gh/apache/groovy/pull/3183/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/3183?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3183        +/-   ##
   ==================================================
   + Coverage     74.1533%   74.1565%   +0.0032%     
   - Complexity      43751      43756         +5     
   ==================================================
     Files            1692       1692                
     Lines          149516     149519         +3     
     Branches        28366      28367         +1     
   ==================================================
   + Hits           110871     110878         +7     
   + Misses          28448      28444         -4     
     Partials        10197      10197                
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3183?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...roovy/transform/stc/StaticTypeCheckingVisitor.java](https://app.codecov.io/gh/apache/groovy/pull/3183?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2Fstc%2FStaticTypeCheckingVisitor.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9zdGMvU3RhdGljVHlwZUNoZWNraW5nVmlzaXRvci5qYXZh)
 | `88.2253% <100.0000%> (+0.0075%)` | :arrow_up: |
   
   ... and [13 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3183/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>




> STC rejects an implicit-this call in a closure to an overloaded Closure 
> method, such as curry(x), as ambiguous, and ignores argument types when 
> choosing the Closure method
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12662
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12662
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 4.0.33, 5.0.8, 7.0.0-alpha-1, 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> {code:groovy}
> @groovy.transform.TypeChecked // or @CompileStatic
> def test() {
>     Closure<Object> c = { String a, String b -> b == null ? curry(a) : a + b }
>     ((Closure) c('x', null))('y')
> }
> assert test() == 'xy'
> {code}
> *Actual:*
> {noformat}
> [Static type checking] - Reference to method is ambiguous. Cannot choose 
> between [groovy.lang.Closure<V> 
> groovy.lang.Closure#curry(java.lang.Object[]), groovy.lang.Closure<V> 
> groovy.lang.Closure#curry(java.lang.Object)]
> {noformat}
> *Expected:* 'xy', as in dynamic Groovy, which calls curry(Object) on the 
> enclosing closure. rcurry, ncurry, trampoline(), andThenSelf(), composeSelf() 
> and leftShift(Closure) fail the same way.
> The selection ignores argument types altogether. If the owner declares 
> memoize(String) or getDelegate(int), then memoize('x') or getDelegate(1) 
> inside a closure is bound to Closure.memoize() or Closure.getDelegate(). 
> Under @CompileStatic the closure's method is called. Under @TypeChecked the 
> inferred type is wrong, and the call fails with a GroovyCastException. 
> Dynamic Groovy calls the owner's method. Under DELEGATE_ONLY, 
> ClosureMetaClass sends curry, ncurry, rcurry, leftShift and rightShift to the 
> delegate, but the type checker binds them to the closure.
> Cause: for an implicit-this call in a closure, StaticTypeCheckingVisitor 
> takes every Closure method of that name (GROOVY-11386) without choosing among 
> them by argument type, and never falls back to the delegate or owner when 
> none of them accepts the arguments.
> Verified: 4.0.33 (ambiguity only), 5.0.8, 6.0.0 and master.



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

Reply via email to