[
https://issues.apache.org/jira/browse/GROOVY-12072?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King resolved GROOVY-12072.
--------------------------------
Fix Version/s: 6.0.0-alpha-2
Resolution: Fixed
> groovy-contracts: loop invariant doesn't run static import visitor
> ------------------------------------------------------------------
>
> Key: GROOVY-12072
> URL: https://issues.apache.org/jira/browse/GROOVY-12072
> Project: Groovy
> Issue Type: Bug
> Reporter: Paul King
> Assignee: Paul King
> Priority: Major
> Fix For: 6.0.0-alpha-2
>
>
> Static case:
> {code:groovy}
> import groovy.contracts.*
> import static java.lang.Math.max
> @groovy.transform.CompileStatic
> @Invariant({ max(3, 4) == 4 })
> class C {
> @Requires({ max(3, 4) == 4 })
> static int iter(int n) {
> int a = 0
> @Invariant({ max(3, 4) == 4 }) // Error
> while (a < n) { a++ }
> return a
> }
> }
> assert C.iter(4) == 4
> {code}
> Normal imports:
> {code:groovy}
> import groovy.contracts.*
> import java.lang.Math
> @groovy.transform.CompileStatic
> @Invariant({ Math.max(3, 4) == 4 })
> class C {
> @Requires({ Math.max(3, 4) == 4 })
> static int iter(int n) {
> int a = 0
> @Invariant({ Math.max(3, 4) == 4 }) // Error
> while (a < n) { a++ }
> return a
> }
> }
> assert C.iter(4) == 4
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)