Monomorphization can't locate default implementations in generic context
kyouko-taiga opened this issue · comments
This program causes the compiler to crash during monomorphization:
public type A: Deinitializable, Strideable {
public var n: Int
public memberwise init
public typealias Stride = Int
fun offset(to other: Self) -> Stride {
other.n - self.n
}
fun advance(by offset: Stride) -> Self {
A(n: n + offset)
}
}
public fun main() {
let a1 = A(n: 1)
let a2 = A(n: 2)
precondition(a1 == a1)
precondition(a1 != a2) // <- Cause of the crash
precondition(a1 < a2)
}
Replacing a1 != a2
by !(a1 == a2)
silences the problem.