Commit dcf5f9d
authored
Better comparisons for type projections (#17092)
We already implemented in essence the rule suggested in
lampepfl/dotty-feature-requests#14:
```
Γ ⊨ p : T
------------------------ (Sel-<:-Proj)
Γ ⊨ p.A <: T#A
```
This rule is implemented in `isSubPrefix`. But we did not get to check
that since we concluded prematurely that an alias type would never
match. The alias type in question in i17064.scala was
```scala
Outer#Inner
```
Since `Outer` is not a path, the asSeenFrom to recover the info of
`Outer#Inner` got approximated with a `Nothing` argument and therefore
the alias failed. It is important in this case that we could still
succeed with a `isSubPrefix` test, which comes later. So we should not
return `false` when the prefix is not a singleton.
Fixes #17064File tree
3 files changed
+25
-4
lines changed- compiler/src/dotty/tools/dotc/core
- tests
- neg
- pos
3 files changed
+25
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
286 | 295 | | |
287 | 296 | | |
288 | 297 | | |
289 | | - | |
| 298 | + | |
| 299 | + | |
290 | 300 | | |
291 | 301 | | |
292 | 302 | | |
293 | 303 | | |
294 | 304 | | |
295 | 305 | | |
296 | | - | |
| 306 | + | |
| 307 | + | |
297 | 308 | | |
298 | 309 | | |
299 | 310 | | |
| |||
302 | 313 | | |
303 | 314 | | |
304 | 315 | | |
305 | | - | |
| 316 | + | |
306 | 317 | | |
307 | 318 | | |
308 | 319 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
0 commit comments