[
https://issues.apache.org/jira/browse/GROOVY-12562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18134456#comment-18134456
]
ASF GitHub Bot commented on GROOVY-12562:
-----------------------------------------
codecov-commenter commented on PR #3091:
URL: https://github.com/apache/groovy/pull/3091#issuecomment-6508058328
##
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3091?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 `93.15068%` with `5 lines` in your changes missing
coverage. Please review.
:white_check_mark: Project coverage is 73.6821%. Comparing base
([`5b077f9`](https://app.codecov.io/gh/apache/groovy/commit/5b077f9dcf610898e3415f1f1cebbaab8eecab61?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
to head
([`94a3fd6`](https://app.codecov.io/gh/apache/groovy/commit/94a3fd60930134ecea1851f6722a764a62fe65f7?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 4 commits behind head on master.
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/3091?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/3091?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)
| 93.1507% | [0 Missing and 5 partials :warning:
](https://app.codecov.io/gh/apache/groovy/pull/3091?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>
[](https://app.codecov.io/gh/apache/groovy/pull/3091?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #3091 +/- ##
==================================================
+ Coverage 73.6711% 73.6821% +0.0110%
- Complexity 42584 42632 +48
==================================================
Files 1678 1678
Lines 146907 146972 +65
Branches 27790 27812 +22
==================================================
+ Hits 108228 108292 +64
+ Misses 28528 28525 -3
- Partials 10151 10155 +4
```
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/3091?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/3091?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)
| `87.5472% <93.1507%> (+0.0809%)` | :arrow_up: |
... and [14 files with indirect coverage
changes](https://app.codecov.io/gh/apache/groovy/pull/3091/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: instanceof narrows a variable where the check does not guard the code
> --------------------------------------------------------------------------
>
> Key: GROOVY-12562
> URL: https://issues.apache.org/jira/browse/GROOVY-12562
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Affects Versions: 4.0.33, 5.0.8, 6.0.0
> Reporter: Scott Murphy Heiberg
> Priority: Major
>
> The type checker narrows a variable after any {{instanceof}} check on it, for
> the rest of the expression or statement, wherever the check is. Under
> {{@CompileStatic}} the program then fails with a ClassCastException:
> {code:groovy}
> @groovy.transform.CompileStatic
> String f(CharSequence cs) { 'x' + (cs instanceof String) + cs.length() }
> f(new StringBuilder('ab')) // ClassCastException: StringBuilder cannot be
> cast to String (5.0.8, 6.0.0)
> {code}
> The same holds for {{foo(cs instanceof String, cs.length())}}, {{[cs
> instanceof String, cs]}} and {{(cs instanceof String) == cs.isEmpty()}}. A
> comparison with {{false}} narrows the wrong branch, and the condition of a
> loop narrows after the loop:
> {code:groovy}
> @groovy.transform.CompileStatic
> int h(Object x) { if ((x instanceof String) == false) { return x.length() };
> 0 }
> h(42) // ClassCastException: Integer cannot be cast to String
> @groovy.transform.CompileStatic
> int g(Object x) { while (x instanceof String) { break }; x.length() }
> g(42) // ClassCastException
> {code}
> The last two fail in 4.0.33, 5.0.8 and 6.0.0, the first in 5.0.8 and 6.0.0.
> Expected: a check narrows only where its outcome guards what follows (the
> condition of an if, while, for, assert or conditional expression, and
> operands of &&, || and ! there); {{(x instanceof T) == true}} narrows like
> the check and {{== false}} like its negation; a loop condition narrows inside
> the loop only.
> PR: https://github.com/apache/groovy/pull/3091
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)