hylo icon indicating copy to clipboard operation
hylo copied to clipboard

Comparable constraint doesn't make >= operator available

Open dabrahams opened this issue 11 months ago • 1 comments

At 58b62b6adaaaa run DriverTests and you can see failures in the standard library reflecting the bug in the title.

Test Case '-[DriverTests.DriverTests testTypeCheckSuccess]' started./Users/dave/src/hylo/Tests/DriverTests/DriverTests.swift:104: error: -[DriverTests.DriverTests testTypeCheckSuccess] : XCTAssertTrue failed
/Users/dave/src/hylo/Tests/DriverTests/DriverTests.swift:105: error: -[DriverTests.DriverTests testTypeCheckSuccess] : XCTAssertEqual failed: ("
/Users/dave/src/hylo/StandardLibrary/Sources/Core/Range.hylo:27.24-26: error: type 'Bound' has no member 'infix>='
    return (e.unsafe[] >= lower_bound) && (e.unsafe[] < upper_bound)
                       ~~
/Users/dave/src/hylo/StandardLibrary/Sources/Core/Range.hylo:27.55-56: error: type 'Bound' has no member 'infix<'
    return (e.unsafe[] >= lower_bound) && (e.unsafe[] < upper_bound)
                                                      ^
/Users/dave/src/hylo/StandardLibrary/Sources/Core/Range.hylo:31.64-69: error: type 'B' does not conform to trait 'SemiRegular'
  public fun contains<B: Comparable where Bound == B>(_ other: Range<B>) -> Bool {
                                                               ~~~~~
/Users/dave/src/hylo/StandardLibrary/Sources/Core/Range.hylo:33.36-38: error: type 'Bound' has no member 'infix>='
    return (e.unsafe[].lower_bound >= self.lower_bound) && (e.unsafe[].upper_bound <= self.upper_bound)
                                   ~~
/Users/dave/src/hylo/StandardLibrary/Sources/Core/Range.hylo:33.84-86: error: type 'Bound' has no member 'infix<='
    return (e.unsafe[].lower_bound >= self.lower_bound) && (e.unsafe[].upper_bound <= self.upper_bound)
                                                                                   ~~
") is not equal to ("

If there's something not supported in the source code we should issue a "not supported" diagnostic.

dabrahams avatar Mar 06 '24 17:03 dabrahams