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
1602
1602
val guard1 = typedExpr(tree.guard, defn.BooleanType )
1603
1603
var body1 = ensureNoLocalRefs(typedExpr(tree.body, pt1), pt1, ctx.scope.toList)
1604
1604
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.
1605
1610
pat1.putAttachment(InferredGadtConstraints , ctx.gadt)
1606
1611
if (pt1.isValueType) // insert a cast if body does not conform to expected type if we disregard gadt bounds
1607
1612
body1 = body1.ensureConforms(pt1)(using originalCtx)
You can’t perform that action at this time.
0 commit comments