[
https://issues.apache.org/jira/browse/GROOVY-12473?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18130629#comment-18130629
]
ASF GitHub Bot commented on GROOVY-12473:
-----------------------------------------
testlens-app[bot] commented on PR #3008:
URL: https://github.com/apache/groovy/pull/3008#issuecomment-6353392764
## 🚨 TestLens detected 1 failed test 🚨
### Test Summary
> [!TIP]
> Inspect all details with the [TestLens
CLI](https://testlens.app/docs/features/cli): `testlens pr 3008`
#### [Build and test / lts \(17, windows-latest,
1\)](https://github.com/apache/groovy/actions/runs/39866885547/job/120132132080?pr=3008)
> :test
| Test | Runs | Flakiness |
|---|---|--:|
| ClosuresStaticCompileTest > testClassClosureDelegateProperty\(\) | ❌ |
0% 🟢 |
🏷️ Commit: d66bb867237ffd136011e01a66aa17d00a8eaa9e
▶️ Tests: 39561 executed
🟡 Checks: 1/20 completed
### Test Failures
<details><summary><strong>ClosuresStaticCompileTest >
testClassClosureDelegateProperty()</strong> (:test in <a
href="https://github.com/apache/groovy/actions/runs/39866885547/job/120132132080?pr=3008">Build
and test / lts (17, windows-latest, 1)</a>)</summary>
```
Assertion failed:
assert name == 'Foo'
|
'java.lang.Class'
at
org.codehaus.groovy.runtime.InvokerHelper.createAssertError(InvokerHelper.java:409)
at
TestScript3b6b5eb548904983adde53d7a231e633$_run_closure1.doCall(TestScript3b6b5eb548904983adde53d7a231e633.groovy:8)
at
TestScript3b6b5eb548904983adde53d7a231e633$_run_closure1.call(TestScript3b6b5eb548904983adde53d7a231e633.groovy)
at
org.codehaus.groovy.runtime.DefaultGroovyMethods.callWithDelegateAndParameter(DefaultGroovyMethods.java:293)
at
org.codehaus.groovy.runtime.DefaultGroovyMethods.with(DefaultGroovyMethods.java:19874)
at
TestScript3b6b5eb548904983adde53d7a231e633.run(TestScript3b6b5eb548904983adde53d7a231e633.groovy:7)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:552)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:587)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:571)
at
groovy.transform.stc.StaticTypeCheckingTestCase.assertScript(StaticTypeCheckingTestCase.groovy:78)
at
groovy.transform.stc.ClosuresSTCTest.testClassClosureDelegateProperty(ClosuresSTCTest.groovy:1204)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
```
</details>
### Rerun Controls
> [!NOTE]
> Checks are currently running using the configuration below.
Select tests to mute in this pull request:
🔲 ClosuresStaticCompileTest > testClassClosureDelegateProperty\(\) <!
> SC: static compilation in some situation prefers boolean getter over static
> field and produces cast exception
> -------------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12473
> URL: https://issues.apache.org/jira/browse/GROOVY-12473
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 2.5.23, 3.0.25, 5.0.3, 4.0.33, 5.1.3, 6.0.0
> Reporter: Björn Kautler
> Assignee: Eric Milles
> Priority: Major
>
> Given this snippet:
> {code:groovy}
> @groovy.transform.CompileStatic
> def foo() {
> (Float as Class<Float>).NaN
> }
> foo().toString()
> {code}
> It fails at runtime with a class-cast exception, because static compilation
> decides it would be a good idea to interpret the {{NaN}} not as the static
> field, but as {{isNaN()}} call, casting the {{Class<FLoat>}} to {{Float}}
> which fails of course.
> (This might seem like forged example, of course you would usually do
> {{Float.NaN}} which works. Nevertheless it should work and not produce cast
> exception, and if you use {{Float.NaN}} in a Spock assertion with a
> SC-optimized Spock, you get exactly that cast exception)
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)