File tree 2 files changed +14
-1
lines changed
compiler/src/dotty/tools/dotc/core
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -2192,7 +2192,7 @@ object SymDenotations {
2192
2192
Stats .record(" basetype cache entries" )
2193
2193
if (! baseTp.exists) Stats .record(" basetype cache NoTypes" )
2194
2194
}
2195
- if ( ! tp.isProvisional && ! CapturingType .isUncachable(tp))
2195
+ if ! ( tp.isProvisional || CapturingType .isUncachable(tp) || ctx.gadt.isNarrowing) then
2196
2196
btrCache(tp) = baseTp
2197
2197
else
2198
2198
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