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
[error] 11 | printMsg("Hi")
[error] | ^^^^^^^^
[error] |Ambiguous overload. The overloaded alternatives of method printMsg with types
[error] | (msg: String)(body: (Context) ?=> Unit): Unit
[error] | (msg: String)(body: (Context) ?=> Unit)(using context: Context): Unit
[error] |both match arguments (("Hi" : String))
[error] |
[error] | longer explanation available when compiling with `-explain`
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
Expectation
There is two problems with outputs:
In the first example, the logical output looks like:
A
A and B
A and B
because the implicit argument is available in the third usage of printMsg, the compiler should infer it and add it there.
2. When a normal argument is added, the printMsg usage becomes ambiguous, which I don't think it should be (I am not an implicit expert). But even if we consider (=>A, ?=>B) the same argument list as (=>A), then why the first example is not ambiguous and compiled successfully?
The text was updated successfully, but these errors were encountered:
Compiler version
3.6.3
Minimized code
Consider two following code examples:
First example:
Second example:
Output
First example's output:
Second example's output:
Expectation
There is two problems with outputs:
because the implicit argument is available in the third usage of
printMsg
, the compiler should infer it and add it there.2. When a normal argument is added, the
printMsg
usage becomes ambiguous, which I don't think it should be (I am not an implicit expert). But even if we consider(=>A, ?=>B)
the same argument list as(=>A)
, then why the first example is not ambiguous and compiled successfully?The text was updated successfully, but these errors were encountered: