Commit 0a416d8
committed
Add an adaptation step in Inliner
We sometimes face a problem that we inline a reference `x: T` which upon further inlining
is adapted to an expected type `x`. It only seems to occur in complicated scenarios. I could
not completely narrow it down. But in any case it's safe to drop the widening cast in order
to avoid a type error here. We do that in a last-effort adaptation step that's only enabled
in the Inliner: Faced with an expression `x: T` and a singleton expected type `y.type` where
`x.type <: y.type`, rewrite to `x`.1 parent 2eb52e4 commit 0a416d8
File tree
3 files changed
+17
-1
lines changed- compiler/src/dotty/tools/dotc
- inlines
- typer
- tests/pos
3 files changed
+17
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
957 | 957 | | |
958 | 958 | | |
959 | 959 | | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
960 | 966 | | |
961 | 967 | | |
962 | 968 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4602 | 4602 | | |
4603 | 4603 | | |
4604 | 4604 | | |
4605 | | - | |
| 4605 | + | |
| 4606 | + | |
| 4607 | + | |
| 4608 | + | |
4606 | 4609 | | |
4607 | 4610 | | |
4608 | 4611 | | |
| |||
4751 | 4754 | | |
4752 | 4755 | | |
4753 | 4756 | | |
| 4757 | + | |
| 4758 | + | |
| 4759 | + | |
| 4760 | + | |
| 4761 | + | |
4754 | 4762 | | |
4755 | 4763 | | |
4756 | 4764 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
0 commit comments