You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Timofey Ananyev (Jira)" <ji...@apache.org> on 2022/02/16 17:31:00 UTC
[jira] [Updated] (GROOVY-10496) Wrong IntRange.by(...) behaviour for left-open ranges
[ https://issues.apache.org/jira/browse/GROOVY-10496?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Timofey Ananyev updated GROOVY-10496:
-------------------------------------
Description:
Call {{by}} on {{IntRange}} results in loss of information about inclusion of the left border, because {{inclusiveLeft}} flag is not passed into {{NumberRange}} constructor.
For example, {{5 in (5<..20)}} gives {{false}} when {{5 in (5<..20).by(2)}} gives {{true}}.
While with {{NumberRange}} {{5 in (5L<..20)}} and {{5 in (5L<..20).by(2)}} both gives {{false}}.
Also with {{@CompileStatic}} even {{5 in (5<..20)}} gives {{true}}, because new parameter lost in {{RangeExpressionTransformer}}.
was:
Call {{by}} on {{IntRange}} results in loss of information about inclusion of the left border, because {{inclusiveLeft}} flag is not passed into {{NumberRange}} constructor.
For example, {{5 in (5<..20)}} gives {{false}} when {{5 in (5<..20).by(2)}} gives {{true}}.
While with {{NumberRange}} {{5 in (5L<..20)}} and {{5 in (5L<..20).by(2)}} both gives {{false}}.
> Wrong IntRange.by(...) behaviour for left-open ranges
> -----------------------------------------------------
>
> Key: GROOVY-10496
> URL: https://issues.apache.org/jira/browse/GROOVY-10496
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 4.0.0
> Reporter: Timofey Ananyev
> Priority: Major
>
> Call {{by}} on {{IntRange}} results in loss of information about inclusion of the left border, because {{inclusiveLeft}} flag is not passed into {{NumberRange}} constructor.
> For example, {{5 in (5<..20)}} gives {{false}} when {{5 in (5<..20).by(2)}} gives {{true}}.
> While with {{NumberRange}} {{5 in (5L<..20)}} and {{5 in (5L<..20).by(2)}} both gives {{false}}.
> Also with {{@CompileStatic}} even {{5 in (5<..20)}} gives {{true}}, because new parameter lost in {{RangeExpressionTransformer}}.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)