@@ -204,25 +204,27 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
204
204
/** Pull out an embedded capture set from a part of `tp` */
205
205
def normalizeCaptures (tp : Type )(using Context ): Type = tp match
206
206
case tp @ RefinedType (parent @ CapturingType (parent1, refs), rname, rinfo) =>
207
- CapturingType (tp.derivedRefinedType(parent1, rname, rinfo), refs, parent.isBoxed)
207
+ CapturingType (tp.derivedRefinedType(parent1, rname, rinfo), refs, parent.isBoxed).withOrigin(parent)
208
208
case tp : RecType =>
209
209
tp.parent match
210
210
case parent @ CapturingType (parent1, refs) =>
211
- CapturingType (tp.derivedRecType(parent1), refs, parent.isBoxed)
211
+ CapturingType (tp.derivedRecType(parent1), refs, parent.isBoxed).withOrigin(parent)
212
212
case _ =>
213
213
tp // can return `tp` here since unlike RefinedTypes, RecTypes are never created
214
214
// by `mapInferred`. Hence if the underlying type admits capture variables
215
215
// a variable was already added, and the first case above would apply.
216
216
case AndType (tp1 @ CapturingType (parent1, refs1), tp2 @ CapturingType (parent2, refs2)) =>
217
217
assert(tp1.isBoxed == tp2.isBoxed)
218
218
CapturingType (AndType (parent1, parent2), refs1 ** refs2, tp1.isBoxed)
219
+ .withOrigins(Set (tp1, tp2))
219
220
case tp @ OrType (tp1 @ CapturingType (parent1, refs1), tp2 @ CapturingType (parent2, refs2)) =>
220
221
assert(tp1.isBoxed == tp2.isBoxed)
221
222
CapturingType (OrType (parent1, parent2, tp.isSoft), refs1 ++ refs2, tp1.isBoxed)
223
+ .withOrigins(Set (tp1, tp2))
222
224
case tp @ OrType (tp1 @ CapturingType (parent1, refs1), tp2) =>
223
- CapturingType (OrType (parent1, tp2, tp.isSoft), refs1, tp1.isBoxed)
225
+ CapturingType (OrType (parent1, tp2, tp.isSoft), refs1, tp1.isBoxed).withOrigin(tp1)
224
226
case tp @ OrType (tp1, tp2 @ CapturingType (parent2, refs2)) =>
225
- CapturingType (OrType (tp1, parent2, tp.isSoft), refs2, tp2.isBoxed)
227
+ CapturingType (OrType (tp1, parent2, tp.isSoft), refs2, tp2.isBoxed).withOrigin(tp2)
226
228
case tp @ AppliedType (tycon, args)
227
229
if ! defn.isFunctionClass(tp.dealias.typeSymbol) && (tp.dealias eq tp) =>
228
230
tp.derivedAppliedType(tycon, args.mapConserve(_.boxDeeply))
@@ -266,7 +268,6 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
266
268
tp.typeSymbol match
267
269
case cls : ClassSymbol
268
270
if ! defn.isFunctionClass(cls) && cls.is(CaptureChecked ) =>
269
- RecType : _ =>
270
271
cls.paramGetters.foldLeft(tp): (core, getter) =>
271
272
if atPhase(thisPhase.next)(getter.hasTrackedParts)
272
273
&& getter.isRefiningParamAccessor
0 commit comments