File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -1602,6 +1602,11 @@ class Typer extends Namer
16021602 val guard1 = typedExpr(tree.guard, defn.BooleanType )
16031603 var body1 = ensureNoLocalRefs(typedExpr(tree.body, pt1), pt1, ctx.scope.toList)
16041604 if ctx.gadt.nonEmpty then
1605+ // Store GADT constraint to later retrieve it (in PostTyper, for now).
1606+ // GADT constraints are necessary to correctly check bounds of type app,
1607+ // see tests/pos/i12226 and issue #12226. It might be possible that this
1608+ // will end up taking too much memory. If it does, we should just limit
1609+ // how much GADT constraints we infer - it's always sound to infer less.
16051610 pat1.putAttachment(InferredGadtConstraints , ctx.gadt)
16061611 if (pt1.isValueType) // insert a cast if body does not conform to expected type if we disregard gadt bounds
16071612 body1 = body1.ensureConforms(pt1)(using originalCtx)
You can’t perform that action at this time.
0 commit comments