- Notifications
You must be signed in to change notification settings - Fork1.1k
Commit73b935c
authored
Refine implicit search fallbacks for better ClassTag handling (#23532)
1. Don't use FullyDefinedType when synthesizing ClassTagsIt's not necessary to instantiate all type variables, deeply, since weare only interested in the outermost shape. Also, that way we do notinstantiate 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 implicitsearchesWe used to look at the deep expected type when the result of an implicitwas ambiguous. This could add more constraints which could resolve the ambiguity.We now do the same also if the search type has uninstantiated typevariables. In thatcase, 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 changedLines changed: 3 additions & 1 deletion
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 |
| |
|
Lines changed: 12 additions & 8 deletions
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 |
| |
|
Lines changed: 14 additions & 3 deletions
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 |
| |
|
Lines changed: 2 additions & 5 deletions
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 |
|
Lines changed: 14 additions & 0 deletions
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
Comments
(0)