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 @@ -2179,7 +2179,7 @@ object SymDenotations {
2179
2179
Stats .record(" basetype cache entries" )
2180
2180
if (! baseTp.exists) Stats .record(" basetype cache NoTypes" )
2181
2181
}
2182
- if ( ! tp.isProvisional && ! CapturingType .isUncachable(tp))
2182
+ if ! ( tp.isProvisional || CapturingType .isUncachable(tp) || ctx.gadt.isNarrowing) then
2183
2183
btrCache(tp) = baseTp
2184
2184
else
2185
2185
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