Commit 73b935c
authored
Refine implicit search fallbacks for better ClassTag handling (#23532)
1. Don't use FullyDefinedType when synthesizing ClassTags
It's not necessary to instantiate all type variables, deeply, since we
are only interested in the outermost shape. Also, that way we do not
instantiate to Nothing, which is something difficult to recover from.
This step is necessary to enable (2)
2. Constrain by deepening expected result types in more implicit
searches
We used to look at the deep expected type when the result of an implicit
was ambiguous.
This could add more constraints which could resolve the ambiguity.
We now do the same also if the search type has uninstantiated type
variables. In that
case, consulting more context might further constrain type variables,
which might in
turn enlarge the implicit scope so that a solution can be found.
Fixes #23526File tree
5 files changed
+45
-17
lines changed- compiler/src/dotty/tools/dotc/typer
- tests
- neg
- pos
5 files changed
+45
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
445 | 445 | | |
446 | 446 | | |
447 | 447 | | |
448 | | - | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
449 | 451 | | |
450 | 452 | | |
451 | 453 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 32 | + | |
38 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
40 | 45 | | |
41 | | - | |
42 | | - | |
| 46 | + | |
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4358 | 4358 | | |
4359 | 4359 | | |
4360 | 4360 | | |
| 4361 | + | |
| 4362 | + | |
| 4363 | + | |
| 4364 | + | |
| 4365 | + | |
| 4366 | + | |
| 4367 | + | |
4361 | 4368 | | |
4362 | | - | |
| 4369 | + | |
4363 | 4370 | | |
4364 | 4371 | | |
4365 | | - | |
4366 | | - | |
| 4372 | + | |
| 4373 | + | |
| 4374 | + | |
| 4375 | + | |
| 4376 | + | |
| 4377 | + | |
4367 | 4378 | | |
4368 | 4379 | | |
4369 | 4380 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | 13 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
0 commit comments