Closed
Description
The following code snippet compiles with scalac but not with dotc
package squants
trait Quantity[A <: Quantity[A]] { self: A => }
trait TimeDerivative[A <: Quantity[A]] { self: Quantity[_] => }
Dotty reports the error message
-- Error: tests/pos/missing-requirement/Quantity.scala -------------------------
3 |trait TimeDerivative[A <: Quantity[A]] { self: Quantity[_] => }
| ^
|missing requirement: self type squants.Quantity[_] & squants.TimeDerivative[A] of trait TimeDerivative does not conform to self type A' of required trait Quantity
|
|where: A is a type in trait TimeDerivative with bounds <: squants.Quantity[LazyRef(A)]
| A' is a type in trait Quantity with bounds <: squants.Quantity[LazyRef(A)]
Removing the self: Quantity[_]
annotation on TimeDerivative
removes the error, and makes the rest of the squants
project compile with Dotty 🎉