File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -2179,7 +2179,7 @@ object SymDenotations {
21792179 Stats .record(" basetype cache entries" )
21802180 if (! baseTp.exists) Stats .record(" basetype cache NoTypes" )
21812181 }
2182- if ( ! tp.isProvisional && ! CapturingType .isUncachable(tp))
2182+ if ! ( tp.isProvisional || CapturingType .isUncachable(tp) || ctx.gadt.isNarrowing) then
21832183 btrCache(tp) = baseTp
21842184 else
21852185 btrCache.remove(tp) // Remove any potential sentinel value
Original file line number Diff line number Diff line change 1+
2+ final abstract class PLet
3+
4+ sealed trait Expr [+ P ]
5+ case class ELet [+ A ](name : String , expr : Expr [A ]) extends Expr [A | PLet ]
6+
7+ def go [P ](e : Expr [P ]): P = e match
8+ case ELet (_, _) =>
9+ val x : Expr [P ] | ELet [P ] = ???
10+ val y : Expr [P ] = x // conforms iff using gadt constraints
11+ // error before changes: cast from gadt reasoning was not inserted because
12+ // `Expr[P]` was erronously cached as a baseType of `Expr[P] | ELet[P]` (only true with gadt constraints)
13+ ???
You can’t perform that action at this time.
0 commit comments