While I was experimenting with self-based type classes, I found an inconsistency. Givens cannot be written in “the shortest form”. The code will be more verbose
trait A[T]:
extension(t: T) def foo: T
trait B:
type Self
extension(t: Self) def foo: Self
given A[Int] = x => x
given Int is B = x => x
The first given compiles as intended, but the second one returns
error overriding method foo in trait B of type (t: Self): Self;
method foo of type (x: Int): Int is a normal method, cannot override an extension method
This error message doesn’t seem to be true, since the first one compile