Commit fc89087
committed
Properly recover from nested ambiguous implicit search failures
From
http://dotty.epfl.ch/docs/reference/changed-features/implicit-resolution.html:
> The treatment of ambiguity errors has changed. If an ambiguity is
> encountered in some recursive step of an implicit search, the ambiguity
> is propagated to the caller.
This is supposed to be handled by `healAmbiguous` but the implementation
was incorrect: it compared pending candidates against the two ambiguous
results from the search, but this doesn't make sense when the failure
happened in a nested search: for example in `i9793`, the failure is:
Applied.bazApplied[F](/* ambiguous: both value baz and value bar match type Foo[F] */summon[Foo[F])
We should be able to recover from this failure because `barApplied` is
more specific than `bazApplied`, but before this commit we ended up
comparing `barApplied` to `baz` and `bar` which isn't meaningful.
Fixes #9793.1 parent d873ae5 commit fc89087
File tree
2 files changed
+40
-15
lines changed- compiler/src/dotty/tools/dotc/typer
- tests/pos
2 files changed
+40
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1169 | 1169 | | |
1170 | 1170 | | |
1171 | 1171 | | |
1172 | | - | |
1173 | | - | |
1174 | | - | |
1175 | | - | |
1176 | | - | |
1177 | | - | |
1178 | | - | |
1179 | | - | |
1180 | | - | |
1181 | | - | |
1182 | | - | |
1183 | | - | |
1184 | 1172 | | |
1185 | 1173 | | |
1186 | 1174 | | |
| |||
1194 | 1182 | | |
1195 | 1183 | | |
1196 | 1184 | | |
1197 | | - | |
| 1185 | + | |
1198 | 1186 | | |
1199 | 1187 | | |
1200 | 1188 | | |
1201 | 1189 | | |
1202 | 1190 | | |
1203 | 1191 | | |
1204 | 1192 | | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
1205 | 1201 | | |
1206 | 1202 | | |
1207 | 1203 | | |
| |||
1210 | 1206 | | |
1211 | 1207 | | |
1212 | 1208 | | |
1213 | | - | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
1214 | 1214 | | |
1215 | 1215 | | |
1216 | 1216 | | |
| |||
1223 | 1223 | | |
1224 | 1224 | | |
1225 | 1225 | | |
1226 | | - | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
1227 | 1232 | | |
1228 | 1233 | | |
1229 | 1234 | | |
| |||
| 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 | + | |
0 commit comments