You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Don't try default args when there are ambiguous implicits
Before this commit, the logic in `class Typer` / `def adapt1` / `def addImplicitArgs` was to try default arguments if *any* argument had an implicit search error that was not an ambiguous implicits error.
This commit changes the logic to try default arguments only if *all* arguments' implicit search errors are not ambiguous implicits error.
The rational is that if there is any ambiguous implicits error, it's not worth trying default arguments because this cannot solve the ambiguity. Instead, we report the first ambiguous implicits error directly.
-- [E172] Type Error: tests/neg/19414-desugared.scala:34:34 ------------------------------------------------------------
2
+
34 | summon[BodySerializer[JsObject]] // error: Ambiguous given instances
3
+
| ^
4
+
|Ambiguous given instances: both given instance given_Writer_JsValue and given instance given_Writer_JsObject match type Writer[B] of parameter x of method summon in object Predef
-- [E172] Type Error: tests/neg/19414.scala:27:34 ----------------------------------------------------------------------
2
+
27 | summon[BodySerializer[JsObject]] // error: Ambiguous given instances
3
+
| ^
4
+
|Ambiguous given instances: both given instance given_Writer_JsValue and given instance given_Writer_JsObject match type Writer[B] of parameter x of method summon in object Predef
0 commit comments