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

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

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

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3154?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 `86.53846%` with `7 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 74.1128%. Comparing base 
([`ef76fcb`](https://app.codecov.io/gh/apache/groovy/commit/ef76fcba756be3331227627f78b5ba6b62109645?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`7874450`](https://app.codecov.io/gh/apache/groovy/commit/7874450fcbcb6ba994bc3e87b403cd3e62fb4f12?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3154?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[...roovy/transform/stc/StaticTypeCheckingVisitor.java](https://app.codecov.io/gh/apache/groovy/pull/3154?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)
 | 85.7143% | [0 Missing and 7 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/3154?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/3154/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/3154?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3154        +/-   ##
   ==================================================
   + Coverage     74.1012%   74.1128%   +0.0116%     
   - Complexity      43600      43626        +26     
   ==================================================
     Files            1692       1692                
     Lines          149254     149290        +36     
     Branches        28286      28301        +15     
   ==================================================
   + Hits           110599     110643        +44     
   + Misses          28475      28468         -7     
   + Partials        10180      10179         -1     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3154?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[.../codehaus/groovy/runtime/DefaultGroovyMethods.java](https://app.codecov.io/gh/apache/groovy/pull/3154?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fruntime%2FDefaultGroovyMethods.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3J1bnRpbWUvRGVmYXVsdEdyb292eU1ldGhvZHMuamF2YQ==)
 | `75.7430% <100.0000%> (+0.0185%)` | :arrow_up: |
   | 
[...roovy/transform/stc/StaticTypeCheckingVisitor.java](https://app.codecov.io/gh/apache/groovy/pull/3154?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.1643% <85.7143%> (-0.0447%)` | :arrow_down: |
   
   ... and [13 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3154/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: property-style assignment to a Map<String,String> accepts a GString 
> value and stores it unconverted
> --------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12535
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12535
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Paul King
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 7.0.0-alpha-1, 6.0.1
>
>
> Under static type checking, a {{GString}} can't be put into a 
> {{Map<String,String>}} through {{put}} or the subscript operator; both are 
> rejected. Assigning through property notation is accepted, though, and the 
> {{GString}} is stored as is:
> {code:groovy}
> @groovy.transform.CompileStatic
> def go() {
>     def n = 'ab'
>     Map<String,String> m = [:]
>     m.k = "$n"
>     ((Map) m).values()*.getClass()*.simpleName
> }
> assert go() == ['GStringImpl']   // expected ['String']
> {code}
> ||Form||Result (4.0.29, 6.0.0, master)||
> |{{m.k = "$n"}}|compiles, stores a {{GStringImpl}}|
> |m.with { k = "$n" }|compiles, stores a {{GStringImpl}}|
> |{{m['k'] = "$n"}}|STC error: Cannot call ... putAt ...|
> |{{m.put('k', "$n")}}|STC error: Cannot call ... put(String, String) ...|
> Statically compiled code can't otherwise add a {{GString}} to a collection 
> typed for Strings ({{<<}}, {{add}}, {{set}}, {{addAll}}, {{+=}}, {{putAt}} 
> and {{put}} are all rejected), so this is the one hole on the write side. 
> Later reads that expect a {{String}} can then fail. For example, Java code 
> doing {{String s = m.get('k')}} throws {{ClassCastException}}, and 
> {{m.get('k').equals('ab')}} is false.
> Expected: either convert the value to a {{String}} at the assignment, as 
> Groovy does for {{String s = "$n"}}, or report the same error as {{put}} and 
> {{putAt}}. Converting matches the general rule that a {{GString}} becomes a 
> {{String}} where one is required, and wouldn't break existing code that 
> compiles today.



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

Reply via email to