Commit ddd986b
committed
Better function return type inference
If the function prototype is a type variable, its upper bound might
contain useful information for inferring the return type of the
function. Before this PR, the added testcases failed because `() => 4`
was typed as `() => Int` and `() => new Inv` as `() => Inv[Nothing]`,
even though the expected types of the functions give enough information
to correctly infer them.1 parent 6ac9d10 commit ddd986b
File tree
2 files changed
+10
-1
lines changed- compiler/src/dotty/tools/dotc/typer
- tests/pos
2 files changed
+10
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
697 | 697 | | |
698 | 698 | | |
699 | 699 | | |
700 | | - | |
| 700 | + | |
701 | 701 | | |
702 | 702 | | |
703 | 703 | | |
| |||
711 | 711 | | |
712 | 712 | | |
713 | 713 | | |
| 714 | + | |
| 715 | + | |
714 | 716 | | |
715 | 717 | | |
716 | 718 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
36 | 43 | | |
0 commit comments