Skip to content

Commit cef5116

Browse files
committed
Undo AvoidMap changes + patch CaptureRef.subsumes
The underlying cause for the divergence in cc-poly-varargs is that we could not conclude that the capture variable `Cap^` subsumes `left` through `src1`, i.e., `left` reaches `Cap^`. That caused `left` to appear circularly in its own capture set and subsequently avoidance to loop forever.
1 parent 692fdb3 commit cef5116

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

compiler/src/dotty/tools/dotc/cc/CaptureRef.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ trait CaptureRef extends TypeProxy, ValueType:
108108
* TODO: Document cases with more comments.
109109
*/
110110
final def subsumes(y: CaptureRef)(using Context): Boolean =
111-
112111
def subsumingRefs(x: Type, y: Type): Boolean = x match
113112
case x: CaptureRef => y match
114113
case y: CaptureRef => x.subsumes(y)
@@ -119,6 +118,7 @@ trait CaptureRef extends TypeProxy, ValueType:
119118
case info: SingletonCaptureRef => test(info)
120119
case info: AndType => viaInfo(info.tp1)(test) || viaInfo(info.tp2)(test)
121120
case info: OrType => viaInfo(info.tp1)(test) && viaInfo(info.tp2)(test)
121+
case info @ CapturingType(_,_) if this.derivesFrom(defn.Caps_CapSet) => test(info)
122122
case _ => false
123123

124124
(this eq y)
@@ -149,7 +149,7 @@ trait CaptureRef extends TypeProxy, ValueType:
149149
y.info match
150150
case TypeBounds(_, hi: CaptureRef) => this.subsumes(hi)
151151
case _ => y.captureSetOfInfo.elems.forall(this.subsumes)
152-
case CapturingType(parent, refs) if parent.derivesFrom(defn.Caps_CapSet) =>
152+
case CapturingType(parent, refs) if parent.derivesFrom(defn.Caps_CapSet) || this.derivesFrom(defn.Caps_CapSet) =>
153153
refs.elems.forall(this.subsumes)
154154
case _ => false
155155
|| this.match

compiler/src/dotty/tools/dotc/cc/CaptureSet.scala

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -298,15 +298,6 @@ sealed abstract class CaptureSet extends Showable:
298298
else BiMapped(asVar, tm, mappedElems)
299299
case tm: IdentityCaptRefMap =>
300300
this
301-
case av: AvoidMap =>
302-
val mapped = mapRefs(elems, ref => ref match
303-
case n: NamedType if av.toAvoid(n) => empty //TODO what about variance?
304-
case r => extrapolateCaptureRef(r, av, av.variance)
305-
)
306-
if isConst then
307-
if mapped.isConst && mapped.elems == elems && !mapped.keepAlways then this
308-
else mapped
309-
else Mapped(asVar, av, av.variance, mapped)
310301
case _ =>
311302
val mapped = mapRefs(elems, tm, tm.variance)
312303
if isConst then

0 commit comments

Comments
 (0)