Commit 6acd7bf
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 9fa1f48 commit 6acd7bf
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 | |
|---|---|---|---|
| |||
3304 | 3304 | | |
3305 | 3305 | | |
3306 | 3306 | | |
3307 | | - | |
3308 | | - | |
3309 | | - | |
3310 | | - | |
3311 | | - | |
3312 | | - | |
3313 | | - | |
3314 | | - | |
3315 | | - | |
3316 | | - | |
3317 | | - | |
3318 | | - | |
3319 | | - | |
3320 | | - | |
3321 | | - | |
3322 | | - | |
3323 | | - | |
3324 | | - | |
3325 | | - | |
| 3307 | + | |
| 3308 | + | |
| 3309 | + | |
| 3310 | + | |
| 3311 | + | |
| 3312 | + | |
| 3313 | + | |
| 3314 | + | |
| 3315 | + | |
| 3316 | + | |
| 3317 | + | |
| 3318 | + | |
| 3319 | + | |
| 3320 | + | |
| 3321 | + | |
| 3322 | + | |
| 3323 | + | |
3326 | 3324 | | |
3327 | 3325 | | |
3328 | 3326 | | |
| |||
| 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