Range.lowerBound and Range.upperBound is correct for open ranges:
let rangeExclusiveInt = 1..<3
XCTAssertEqual(rangeExclusiveInt.lowerBound, 1)
XCTAssertEqual(rangeExclusiveInt.upperBound, 3)
But for ClosedRange, the upperBound is incorrect: Swift expects 1...3 to be 3, but SkipLib reports 4:
let rangeInclusiveInt = 1...3
XCTAssertEqual(rangeInclusiveInt.lowerBound, 1)
XCTAssertEqual(rangeInclusiveInt.upperBound, 3) // java.lang.AssertionError: 4 != 3
The reason is that we always translate upperBound into endInclusive + 1, since we assume open ranges. Kotlin doesn't distinguish between open ranges and closed ranges (they are both IntRange), so I'm not sure if there is any way of handling this correctly short of having our own independent Range structures.
Range.lowerBoundandRange.upperBoundis correct for open ranges:But for
ClosedRange, theupperBoundis incorrect: Swift expects 1...3 to be 3, but SkipLib reports 4:The reason is that we always translate
upperBoundintoendInclusive + 1, since we assume open ranges. Kotlin doesn't distinguish between open ranges and closed ranges (they are bothIntRange), so I'm not sure if there is any way of handling this correctly short of having our own independentRangestructures.