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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3180?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.1575%. 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 
([`55904cd`](https://app.codecov.io/gh/apache/groovy/commit/55904cdfc90ae2e67c3c2d31c651fccf0e1a7734?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/3180/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/3180?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3180        +/-   ##
   ==================================================
   + Coverage     74.1533%   74.1575%   +0.0042%     
   - Complexity      43751      43757         +6     
   ==================================================
     Files            1692       1692                
     Lines          149516     149529        +13     
     Branches        28366      28369         +3     
   ==================================================
   + Hits           110871     110887        +16     
   + Misses          28448      28447         -1     
   + Partials        10197      10195         -2     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3180?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...rg/codehaus/groovy/classgen/asm/ClosureWriter.java](https://app.codecov.io/gh/apache/groovy/pull/3180?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2Fasm%2FClosureWriter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL2FzbS9DbG9zdXJlV3JpdGVyLmphdmE=)
 | `90.6085% <100.0000%> (+0.4335%)` | :arrow_up: |
   
   ... and [16 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3180/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>




> Closure packing packs a closure literal that escapes through a ternary, an 
> elvis or a curry/asWritable/clone call
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12659
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12659
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 7.0.0-alpha-1, 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> {code:groovy}
> class Holder { Closure handler }
> @groovy.transform.PackedClosures
> class C {
>     void install(Holder h, boolean b) { h.handler = b ? { Integer x -> x + 1 
> } : null }
>     Closure make() { return { Integer x, Integer y -> x + y }.curry(1) }
> }
> def h = new Holder()
> new C().install(h, true)
> h.handler.delegate = 'd'
> new C().make().delegate = 'd'
> {code}
> *Actual:* both delegate assignments throw {{UnsupportedOperationException: 
> Cannot set a delegate on a @PackedClosures closure}}. The same happens for an 
> elvis and for a literal behind rcurry, ncurry, asWritable, clone, dehydrate 
> or rehydrate, when the result is stored to a field, property or index, 
> appended with {{<<}}, returned, or placed in a list or map literal.
> *Expected:* the literal is declined from packing, as it is when it is itself 
> the stored or returned value, and the delegate can be set.
> Cause: the escape walk in {{ClosureWriter.collectEscapingClosures}} marks a 
> literal only when it is the escaping expression itself. It does not follow 
> the value through ternary and elvis branches, through casts, or into the 
> curried or wrapped closure. CurriedClosure and the asWritable wrapper pass 
> setDelegate on to the packed closure, and clone, dehydrate and rehydrate 
> return a packed copy.
> Verified on 6.0.0 and master.



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

Reply via email to