Skip to content

RangeExpression.relative(to:) permits bounds that extend on the lower bound side but not the upper bound side #74364

Open
@phausler

Description

@phausler

Description

The preconditions associated with the function relative(to:) has inconsistent checking for lower versus upper bounds.

Reproduction

print((0...5).relative(to: 0..<4)) // fatal
print((-1...3).relative(to: 0..<4)) // not fatal

Expected behavior

Both upper and lower bounds should have fatal conditions to ensure proper bounds checking.

Environment

all

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.standard libraryArea: Standard library umbrella

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions