File tree 1 file changed +24
-0
lines changed
src/dotty/tools/dotc/core 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,30 @@ extends TyperState(r) {
140
140
}
141
141
for (poly <- toCollect)
142
142
constraint = constraint.remove(poly)
143
+
144
+ lazy val keptLambdas : collection.Set [TypeLambda ] = {
145
+ val toKeep = mutable.Set .empty[TypeLambda ]
146
+ def keep (p : PolyParam ) = p.binder match {
147
+ case tl : TypeLambda => toKeep += tl
148
+ case _ =>
149
+ }
150
+ for (poly <- constraint.domainPolys)
151
+ if (poly.isInstanceOf [PolyType ])
152
+ for (param <- poly.paramRefs) {
153
+ constraint.lower(param).foreach(keep)
154
+ constraint.upper(param).foreach(keep)
155
+ constraint.entry(param).foreachPart {
156
+ case p : PolyParam if constraint contains p => keep(p)
157
+ case _ =>
158
+ }
159
+ }
160
+ toKeep
161
+ }
162
+ constraint.domainPolys.foreach {
163
+ case tl : TypeLambda if ! keptLambdas.contains(tl) =>
164
+ constraint = constraint.remove(tl)
165
+ case _ =>
166
+ }
143
167
}
144
168
145
169
/** Try operation `op`; if it produces errors, execute `fallback` with constraint and
You can’t perform that action at this time.
0 commit comments