@@ -15,7 +15,6 @@ import util.Spans._
15
15
import util .Property
16
16
import collection .mutable
17
17
import tpd .ListOfTreeDecorator
18
- import Variances .alwaysInvariant
19
18
import config .{Config , Feature }
20
19
import config .Printers .typr
21
20
import Annotations ._
@@ -969,10 +968,7 @@ class Namer { typer: Typer =>
969
968
override final def typeSig (sym : Symbol ): Type =
970
969
val tparamSyms = completerTypeParams(sym)(ictx)
971
970
given ctx as Context = nestedCtx
972
-
973
- def abstracted (tp : TypeBounds ): TypeBounds =
974
- HKTypeLambda .boundsFromParams(tparamSyms, tp)
975
-
971
+ def abstracted (tp : TypeBounds ): TypeBounds = HKTypeLambda .boundsFromParams(tparamSyms, tp)
976
972
val dummyInfo1 = abstracted(TypeBounds .empty)
977
973
sym.info = dummyInfo1
978
974
sym.setFlag(Provisional )
@@ -1002,22 +998,8 @@ class Namer { typer: Typer =>
1002
998
}
1003
999
sym.info = dummyInfo2
1004
1000
1005
- // Treat the parameters of an upper type lambda bound on the RHS as non-variant.
1006
- // E.g. type F <: [X] =>> G and type F[X] <: G
1007
- // are treated alike.
1008
- def addVariances (tp : Type ): Type = tp match
1009
- case tp : TypeBounds =>
1010
- def recur (tp : Type ): Type = tp match
1011
- case tp : HKTypeLambda if ! tp.isDeclaredVarianceLambda =>
1012
- tp.withVariances(tp.paramNames.map(alwaysInvariant))
1013
- .derivedLambdaType(resType = recur(tp.resType))
1014
- case tp => tp
1015
- tp.derivedTypeBounds(tp.lo, recur(tp.hi))
1016
- case _ =>
1017
- tp
1018
-
1019
1001
val rhs1 = typedAheadType(rhs)
1020
- val rhsBodyType : TypeBounds = addVariances( rhs1.tpe) .toBounds
1002
+ val rhsBodyType : TypeBounds = rhs1.tpe.toBounds
1021
1003
val unsafeInfo = if (isDerived) rhsBodyType else abstracted(rhsBodyType)
1022
1004
1023
1005
def opaqueToBounds (info : Type ): Type =
0 commit comments