Scala 3.7.2
Notice that MyOutputAlias2[MyType] is not compiled when put inside MyType.
I am not 100% sure it's against some part of specification, but it feels off.
I noticed this inconsistency while playing around with example from SCL-22391
trait MyOutput[T]
final type MyOutputAlias1[T] = MyOutput[T]
final type MyOutputAlias2 = MyOutput
trait MyType
object MyType {
val value1: MyOutput[MyType] = ???
val value2: MyOutputAlias1[MyType] = ???
val value3: MyOutputAlias2[MyType] = ??? // COMPILATION ERROR
}
val value1: MyOutput[MyType] = ???
val value2: MyOutputAlias1[MyType] = ???
val value3: MyOutputAlias2[MyType] = ???
Note, all is fine if you wrap the code (making the type alias non-top-level)
object wrapper {
trait MyOutput[T]
final type MyOutputAlias1[T] = MyOutput[T]
final type MyOutputAlias2 = MyOutput
trait MyType
object MyType {
val value1: MyOutput[MyType] = ???
val value2: MyOutputAlias1[MyType] = ???
val value3: MyOutputAlias2[MyType] = ???
}
val value1: MyOutput[MyType] = ???
val value2: MyOutputAlias1[MyType] = ???
val value3: MyOutputAlias2[MyType] = ???
}
