File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
src/reflect/scala/reflect/internal Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -4848,11 +4848,20 @@ trait Types
4848
4848
// sides of a subtyping/equality judgement, which can lead to recursive types
4849
4849
// being constructed. See pos/t0851 for a situation where this happens.
4850
4850
@ inline final def suspendingTypeVars [T ](tvs : List [TypeVar ])(op : => T ): T = {
4851
- val saved = tvs map (_.suspended)
4851
+ val saved = bitSetByPredicate( tvs) (_.suspended)
4852
4852
tvs foreach (_.suspended = true )
4853
4853
4854
4854
try op
4855
- finally foreach2(tvs, saved)(_.suspended = _)
4855
+ finally {
4856
+ var index = 0
4857
+ var sss = tvs
4858
+ while (sss != Nil ) {
4859
+ val tv = sss.head
4860
+ tv.suspended = saved(index)
4861
+ index += 1
4862
+ sss = sss.tail
4863
+ }
4864
+ }
4856
4865
}
4857
4866
4858
4867
final def stripExistentialsAndTypeVars (ts : List [Type ], expandLazyBaseType : Boolean = false ): (List [Type ], List [Symbol ]) = {
Original file line number Diff line number Diff line change @@ -301,6 +301,19 @@ trait Collections {
301
301
}
302
302
}
303
303
304
+ final def bitSetByPredicate [A ](xs : List [A ])(pred : A => Boolean ): mutable.BitSet = {
305
+ val bs = new mutable.BitSet ()
306
+ var ys = xs
307
+ var i : Int = 0
308
+ while (! ys.isEmpty){
309
+ if (pred(ys.head))
310
+ bs.add(i)
311
+ ys = ys.tail
312
+ i += 1
313
+ }
314
+ bs
315
+ }
316
+
304
317
final def sequence [A ](as : List [Option [A ]]): Option [List [A ]] = {
305
318
if (as.exists (_.isEmpty)) None
306
319
else Some (as.flatten)
You can’t perform that action at this time.
0 commit comments