-
Notifications
You must be signed in to change notification settings - Fork 21
Bogus Compile error on implicit ambiguity #9861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9861?orig=1 |
@som-snytt said: |
Akos Vandra (axos88) said: Explicitly stating the type of the quxFormat fixes the compilation error. Now this is AGAIN something that seems unrelated to the line for which the implicitnot found error is thrown. I hope you agree that this is not expected behaviour, and that the raise error does not help at all identifying the issue. |
Akos Vandra (axos88) said: |
Akos Vandra (axos88) said: The implicits whose order is changed in the file are NOT related, and have nothing in common with the implicit that is NOT being found. |
@som-snytt said (edited on Jul 16, 2016 7:48:21 PM UTC): Sorry for the edit noise. Just following typer-debug output. |
@SethTisue said: |
@som-snytt said: import JsonProtocol.{ stringFormat, barFormat, bazFormat } suffices to break it. barFormat uses stringFormat, baz uses formatter for Foo, Bar. |
Code located here: https://github.com/axos88/scala-bug-implicit-ambiguity
Unfortunately I did not find an easy way to reduce it further, or remove the dependency on spray-json.
Compiler currently errs with:
Take a look at the file: https://github.com/axos88/scala-bug-implicit-ambiguity/blob/master/src/main/scala/example/json/JsonProtocol.scala
The following things fix the error:
def stringFormat[T]
)The fact that #1 fixes it suggests it is a compiler bug, or an undetected undefined behaviour.
Expected Behaviour:
Compilation should succeed, and fooFormatHighPrio should take precedence over fooFormatLowPrio and FooFormatLowestPrio when one has JsonProtocol._ in scope.
OR
Error with ambigous implicits for JsonFormat[Foo]
Current Behaviour:
Misterious error message about NOT finding an implicit, whereas there are multiple candidates with different priorities.
The text was updated successfully, but these errors were encountered: