This code does not compile in Scala 3 since type projection on an abstract type is now invalid:
trait Entity:
type Key
type Dictionary[T <: Entity] = Map[T#Key, T]
The compiler complains that T is abstract and type projection is therefore no more available:
T is not a legal path
since it is not a concrete type
How could you define the above Dictionary type in Scala 3?
I had to introduce
Aux-type because match types seem not to work with refined typesBeware that on value level match types can work not so well as type projections: Scala 3: typed tuple zipping
What does Dotty offer to replace type projections?
https://users.scala-lang.org/t/converting-code-using-simple-type-projections-to-dotty/6516
Dotty cannot infer result type of generic Scala function taking type parameter trait with abstract type