I'm trying to migrate a library from Scala 2.13 to Scala 3, but the existing code does not compile.
Here is a snippet
trait Identity
trait Authenticator
trait Env {
type I <: Identity
type A <: Authenticator
}
trait IdentityService[T <: Identity]
trait AuthenticatorService[T <: Authenticator]
trait Environment[E <: Env] {
def identityService[T <: Identity]: IdentityService[E#I]
def authenticatorService: AuthenticatorService[E#A]
}
The Scala 3 compiler fails with:
error] 14 | def identityService[T <: Identity]: IdentityService[E#I]
[error] | ^
[error] | E is not a legal path
[error] | since it is not a concrete type
[error] -- Error:
[error] 15 | def authenticatorService: AuthenticatorService[E#A]
[error] | ^
[error] | E is not a legal path
[error] | since it is not a concrete type
[error] two errors found
You can try directly at https://scastie.scala-lang.org/GuqSqC9yQS6uMiw9wyKdQg