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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3232?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.2490%. Comparing base 
([`6f8af97`](https://app.codecov.io/gh/apache/groovy/commit/6f8af97b170657b67dec91bdbc8ec50b18e8d9fb?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`6536687`](https://app.codecov.io/gh/apache/groovy/commit/653668752b1113495217515e71dc31f348cca253?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 GROOVY_6_0_X.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree 
graph](https://app.codecov.io/gh/apache/groovy/pull/3232/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/3232?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      #3232        +/-   ##
   ======================================================
   + Coverage         72.2468%   72.2490%   +0.0022%     
   - Complexity          38996      38997         +1     
   ======================================================
     Files                1591       1591                
     Lines              139195     139195                
     Branches            26045      26045                
   ======================================================
   + Hits               100564     100567         +3     
   + Misses              29573      29570         -3     
     Partials             9058       9058                
   ```
   [see 9 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3232/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>




> SC: a property defined by an extension method of List is read from each 
> element of the list
> -------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12534
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12534
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 7.0.0-alpha-1, 6.0.1
>
>
> Under {{@CompileStatic}}, a property whose getter is an extension method of 
> {{List}}, or of a class that implements {{List}}, is compiled as a property 
> of the list's elements: the getter is called once for each element, with the 
> element cast to the extension's receiver type. With this extension module:
> {code:java}
> package demo;
> import java.util.List;
> public class ListExtension {
>     public static String getJoined(List<String> self) { return 
> String.join(",", self); }
> }
> {code}
> {code:groovy}
> @groovy.transform.CompileStatic
> class C {
>     def test(List<String> words) { words.joined }
> }
> new C().test(['x', 'y']) // GroovyCastException: Cannot cast object 'x' with 
> class 'java.lang.String' to class 'java.util.List'
> {code}
> {{words.getJoined()}} returns 'x,y' in every mode, and dynamic Groovy and 
> {{@TypeChecked}} return 'x,y' for {{words.joined}} too. On an empty list, 
> {{words.joined}} evaluates to {{[]}} instead of an empty string.
> {{StaticCompilationVisitor.existsProperty}} marks the property expression 
> spread-safe when the getter's declaring class implements {{List}} but does 
> not declare the getter, which is meant for a property of the element type. 
> The declaring class of an extension method is its receiver type, which never 
> declares it. Extension getters declared for {{Collection}} or {{Iterable}}, 
> such as {{getIndices}} and {{isSorted}}, are not affected. 
> {{DefaultGroovyMethodsSTCTest.testPropertySemantics2}}, which 
> {{StaticCompileDGMTest}} also runs, keeps the property forms of 
> {{getSequence(List)}} and {{getString(List)}} from {{TestStringExtension}} 
> commented out. Seen in 4.0.33, 5.0.8, 6.0.0 and master.
> Expected: the property calls the extension getter on the list, as in dynamic 
> Groovy and {{@TypeChecked}}.



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

Reply via email to