Without covariance (In presence of Invarinace )
class Test[T]
var x:Test[Any] = new Test[Nothing] //error
doom ,what you see
Nothing <: Any, but class Test is invariant in type T.
Verbose : Nothing is subclass of Any but Test class is invariant .
Means we have not define any hierarchy on Test for T
To fix this .Define type hierarchy on Test for T
Now Using covariant –
you can define covariance on C for T : C[Tsub] is a subclass of C[T]
class Test[+T]
and then
var x:Test[Any] = new Test[Nothing] // works