Skip to content

Commit 3c9d209

Browse files
committed
Wrap inferred class types in RecTypes
1 parent 02c7048 commit 3c9d209

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -266,19 +266,19 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
266266
tp.typeSymbol match
267267
case cls: ClassSymbol
268268
if !defn.isFunctionClass(cls) && cls.is(CaptureChecked) =>
269-
cls.paramGetters.foldLeft(tp) { (core, getter) =>
270-
if atPhase(thisPhase.next)(getter.hasTrackedParts)
271-
&& getter.isRefiningParamAccessor
272-
&& !refiningNames.contains(getter.name) // Don't add a refinement if we have already an explicit one for the same name
273-
then
274-
val getterType =
275-
mapInferred(refine = false)(tp.memberInfo(getter)).strippedDealias
276-
RefinedType(core, getter.name,
277-
CapturingType(getterType, new CaptureSet.RefiningVar(ctx.owner)))
278-
.showing(i"add capture refinement $tp --> $result", capt)
279-
else
280-
core
281-
}
269+
RecType: _ =>
270+
cls.paramGetters.foldLeft(tp): (core, getter) =>
271+
if atPhase(thisPhase.next)(getter.hasTrackedParts)
272+
&& getter.isRefiningParamAccessor
273+
&& !refiningNames.contains(getter.name) // Don't add a refinement if we have already an explicit one for the same name
274+
then
275+
val getterType =
276+
mapInferred(refine = false)(tp.memberInfo(getter)).strippedDealias
277+
RefinedType(core, getter.name,
278+
CapturingType(getterType, new CaptureSet.RefiningVar(ctx.owner)))
279+
.showing(i"add capture refinement $tp --> $result", capt)
280+
else
281+
core
282282
case _ => tp
283283
case _ => tp
284284

0 commit comments

Comments
 (0)