Let's see what happens if I take String
and try to transfer it to someFunc[T >: MyType]
:
Definition:
trait MyType
def someFunc[T <: MyType](value: T = new MyType { }): T = value
Vocation:
someFunc("hello")
Productivity
hello
How is this possible? Since you indicated MyType
as the lower bound for T
, that is, we have MyType >: T <: Any
. How does it work for String
? If we consider the type T
as a AnyRef
supertype String
, then the relationship type is MyType >: AnyRef <: Any
checked.
To answer your question: No, they are not identical because I cannot pass to the String
first method that accepts MyType
.
If you want to ask:
def someFunc[T <: MyType]
and
def someFunc(value: MyType)
, , T
, , MyType
, , MyType
, , .