[
https://issues.apache.org/jira/browse/GROOVY-12625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18135719#comment-18135719
]
ASF GitHub Bot commented on GROOVY-12625:
-----------------------------------------
testlens-app[bot] commented on PR #3151:
URL: https://github.com/apache/groovy/pull/3151#issuecomment-6541050244
## ✅ All tests passed ✅
🏷️ Commit: 5aa432bb7d4637d4f49b9feac6cee0e8bb0d6ccd
▶️ Tests: 123267 executed
⚪️ Checks: 26/26 completed
---
_Learn more about TestLens at
[testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
> SC fails with ArrayIndexOutOfBoundsException for ++ or -- on a subscript
> whose element type is not a primitive or wrapper number type
> -------------------------------------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12625
> URL: https://issues.apache.org/jira/browse/GROOVY-12625
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 4.0.33, 5.0.8, 6.0.0
> Reporter: Scott Murphy Heiberg
> Priority: Major
>
> {code:groovy}
> @groovy.transform.CompileStatic
> def f() {
> List<BigDecimal> l = [1.0]
> l[0]++
> l
> }
> assert f() == [2.0]
> {code}
> Actual: compilation fails with "General error during instruction selection:
> Index 1 out of bounds for length 1" (ArrayIndexOutOfBoundsException in
> StaticInvocationWriter.loadArguments). The same happens for prefix and
> postfix ++ and -- on a BigDecimal array, a map of BigDecimal values, a list
> of BigInteger, String, Character, char[], and a class with getAt/putAt
> returning BigDecimal.
> Expected: the code compiles and the assertion passes, as it does without the
> annotation and with @TypeChecked.
> The type checker resolves next() or previous() by passing the subscript
> expression to findMethodOrFail. StaticCompilationVisitor then stores next()
> as that expression's binary target, replacing getAt, so l[0] is compiled as a
> call to next with argument 0.
> Seen in 4.0.33, 5.0.8 and 6.0.0.
> PR: https://github.com/apache/groovy/pull/3151
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)