Skip to content

Commit 22d125f

Browse files
committed
Trying to fix sdt core build.
1 parent 5852fd0 commit 22d125f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/compiler/scala/tools/nsc/typechecker/Typers.scala

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2823,6 +2823,17 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser {
28232823
res
28242824
}
28252825

2826+
def isCapturedExistential(sym: Symbol) =
2827+
((sym hasFlag EXISTENTIAL) && (sym hasFlag CAPTURED)) // todo refine this
2828+
2829+
def packCaptured(tpe: Type): Type = {
2830+
val captured = mutable.Set[Symbol]()
2831+
for (tp <- tpe)
2832+
if (isCapturedExistential(tp.typeSymbol))
2833+
captured += tp.typeSymbol
2834+
existentialAbstraction(captured.toList, tpe)
2835+
}
2836+
28262837
/** convert skolems to existentials */
28272838
def packedType(tree: Tree, owner: Symbol): Type = {
28282839
def defines(tree: Tree, sym: Symbol) =
@@ -2841,7 +2852,7 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser {
28412852
def isLocal(sym: Symbol): Boolean =
28422853
if (sym == NoSymbol || sym.isRefinementClass || sym.isLocalDummy) false
28432854
else if (owner == NoSymbol) tree exists (defines(_, sym))
2844-
else containsDef(owner, sym) || isRawParameter(sym) || ((sym hasFlag EXISTENTIAL) && (sym hasFlag CAPTURED)) // todo refine this
2855+
else containsDef(owner, sym) || isRawParameter(sym) || isCapturedExistential(sym)
28452856
def containsLocal(tp: Type): Boolean =
28462857
tp exists (t => isLocal(t.typeSymbol) || isLocal(t.termSymbol))
28472858
val normalizeLocals = new TypeMap {
@@ -3198,7 +3209,7 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser {
31983209
typed1(atPos(tree.pos) { Function(params, body) }, mode, pt)
31993210
} else {
32003211
val selector1 = checkDead(typed(selector, EXPRmode | BYVALmode, WildcardType))
3201-
var cases1 = typedCases(tree, cases, selector1.tpe.widen, pt)
3212+
var cases1 = typedCases(tree, cases, packCaptured(selector1.tpe.widen), pt)
32023213

32033214
if (isPastTyper || !opt.virtPatmat) {
32043215
val (owntype, needAdapt) = ptOrLub(cases1 map (_.tpe))

0 commit comments

Comments
 (0)