Closed dabrahams closed 7 months ago
@kyouko-taiga Seems to work; I think we can close this?
Oh wow. I didn't expect monomorphization would be able to pick up definitions in extensions. We can close if we have a test that runs this code.
Would this be ok as a suitable end-to-end test? If so, what would be a good filename to describe this test?
I've checked it compiles and runs.
//- compileAndRun expecting: success
public trait Equatable {
fun infix== (_ other: Self) -> Bool
}
extension Equatable {
public fun infix!= (_ other: Self) -> Bool { !(self == other) }
}
type A: Deinitializable, Equatable {
public let x: Int
public memberwise init
fun infix== (_ other: Self) -> Bool { self.x == other.x }
}
public fun main() {
let a = A(x: 1)
let b = A(x: 1)
let c = A(x: 2)
precondition(a == b)
precondition(a != c)
precondition(b != c)
}
Compile this: