Commit b009f42
committed
Don't ignore expected types of
A problem arises if we typecheck an expression like `new C()` with expected type
`C[U]` where `C` is
defined like this
```scala
class C[X](using X)()
```
In this case, we'd like to propagate `U` as the type instance of `X` before we
resolve the using clause. To do this, we have to keep the expected result
type `C[X]` for typechecking the function part `new C`. Previously, that type was wrapped
in an IgnoredProto.
The problem was detected now since a class C with just the using clause and
no empty parameter clause was previously expanded to
```scala
class C[X]()(using X)
```
but is now expanded to
```scala
class C[X](using X)()
```
Under the previous expansion, we type checked and `new C()` before looking
for an argument of the using clause, so the problem did not arise.New.1 parent 56e9a93 commit b009f42
File tree
3 files changed
+52
-20
lines changed- compiler/src/dotty/tools/dotc/typer
- tests/pos
3 files changed
+52
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
892 | 892 | | |
893 | 893 | | |
894 | 894 | | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
895 | 904 | | |
896 | | - | |
| 905 | + | |
897 | 906 | | |
898 | 907 | | |
899 | 908 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3346 | 3346 | | |
3347 | 3347 | | |
3348 | 3348 | | |
3349 | | - | |
3350 | | - | |
3351 | | - | |
3352 | | - | |
3353 | | - | |
3354 | | - | |
3355 | | - | |
3356 | | - | |
3357 | | - | |
3358 | | - | |
3359 | | - | |
3360 | | - | |
3361 | | - | |
3362 | | - | |
3363 | | - | |
3364 | | - | |
3365 | | - | |
3366 | | - | |
3367 | | - | |
| 3349 | + | |
| 3350 | + | |
| 3351 | + | |
| 3352 | + | |
| 3353 | + | |
| 3354 | + | |
| 3355 | + | |
| 3356 | + | |
| 3357 | + | |
| 3358 | + | |
| 3359 | + | |
| 3360 | + | |
| 3361 | + | |
| 3362 | + | |
| 3363 | + | |
| 3364 | + | |
| 3365 | + | |
3368 | 3366 | | |
3369 | 3367 | | |
3370 | 3368 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
0 commit comments