Commit a648468
committed
Fix reachability by retaining spaces of Prod params
When intersecting a product type space with a type space, if the two
types aren't related, we must retain the spaces of the parameters,
otherwise the intersection will represent a bigger space of values that
it should (leading to a false positive unreachability warning).
I actually think that the first condition, `isSubType(tp1, tp2)`, should
be true, because `Bar` is a subtype of `Foo[X]`, provided `X` is
instantiated to `Nothing`. Maybe that's not isSubType but something
else (because we want forSome X, not forAll X). But, either way, fixing
that the intersection doesn't overpromise (i.e. lie) is a good fix
anyways.1 parent 5ed0586 commit a648468
File tree
3 files changed
+24
-3
lines changed- compiler/src/dotty/tools/dotc/transform/patmat
- tests/patmat
3 files changed
+24
-3
lines changedLines changed: 9 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
215 | | - | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
216 | 218 | | |
217 | 219 | | |
218 | 220 | | |
219 | 221 | | |
220 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
221 | 225 | | |
222 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
223 | 229 | | |
224 | 230 | | |
225 | 231 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
0 commit comments