Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib/tests: Relax precondition for step when creating interval #2608

Merged
merged 1 commit into from
Feb 26, 2024

Conversation

fridis
Copy link
Member

@fridis fridis commented Feb 23, 2024

For an interval a..a:s, it is now allowed that step is any value including s=0, which gives the interval with singe element a.

This fixes content/examples/examples/fib_iterative_neg.fz from fuzion-lang.dev, which gives an example for why this relaxation makes sense.

This also required changes in size and contains.

This patch also improves interval.as_string for infinite intervals and adds postifx ..∞ as an alias for postifx ...

Also added a test to check various combinations of values for from, through and step.

For an interval `a..a:s`, it is now allowed that step is any value including
`s=0`, which gives the interval with singe element `a`.

This fixes `content/examples/examples/fib_iterative_neg.fz` from
fuzion-lang.dev, which gives an example for why this relaxation makes sense.

This also required changes in `size` and `contains`.

This patch also improves `interval.as_string` for infinite intervals and adds
`postifx ..∞` as an alias for `postifx ..`.

Also added a test to check various combinations of values for `from`, `through`
and `step`.
@maxteufel maxteufel merged commit 83fed34 into main Feb 26, 2024
5 checks passed
@maxteufel maxteufel deleted the lib_interval_improvements branch February 26, 2024 09:22
@fridis fridis restored the lib_interval_improvements branch February 26, 2024 15:28
@maxteufel maxteufel deleted the lib_interval_improvements branch May 22, 2024 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants