File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -102,14 +102,19 @@ final class ProperGadtConstraint private(
102
102
else addLess(boundTvar.origin, symTvar.origin)
103
103
case bound =>
104
104
val oldUpperBound = bounds(symTvar.origin)
105
- // If we already have bounds `F >: [t] => List[t] <: [t] => Any`
106
- // and we want to record that `F <: [+A] => List[A]`, we need to adapt
107
- // type parameter variances of the bound. Consider that the following is valid:
105
+ // If we have bounds:
106
+ // F >: [t] => List[t] <: [t] => Any
107
+ // and we want to record that:
108
+ // F <: [+A] => List[A]
109
+ // we need to adapt the variance and instead record that:
110
+ // F <: [A] => List[A]
111
+ // We cannot record the original bound, since it is false that:
112
+ // [t] => List[t] <: [+A] => List[A]
108
113
//
109
- // class Foo[F[t] >: List[t]]
110
- // type T = Foo[List]
111
- //
112
- // precisely because ` Foo[List]` is desugared to ` Foo[[A] => List[A]]` .
114
+ // Note that the following code is accepted:
115
+ // class Foo[F[t] >: List[t] ]
116
+ // type T = Foo[List]
117
+ // precisely because Foo[List] is desugared to Foo[[A] => List[A]].
113
118
val bound1 = bound.adaptHkVariances(oldUpperBound)
114
119
if (isUpper) addUpperBound(symTvar.origin, bound1)
115
120
else addLowerBound(symTvar.origin, bound1)
You can’t perform that action at this time.
0 commit comments