Ambiguous implicits for ExecutionContext
See original GitHub issueHi,
Trying to upgrade from 0.19.9 to 0.20.0, I face the following compile error in some of our features extending CornichonFeature and calling a method requiring an implicit ExecutionContext:
... ambiguous implicit values:
[error] both lazy value ec in trait BaseFeature of type scala.concurrent.ExecutionContext
[error] and method executionContext in trait AsyncTestSuite of type scala.concurrent.ExecutionContext
[error] match expected type scala.concurrent.ExecutionContext
Example:
package my.feature.test
import com.github.agourlay.cornichon.CornichonFeature
import scala.concurrent.duration._
import scala.concurrent.{Await, Future}
class TestFeature extends CornichonFeature {
// implicit val _ec: ExecutionContext = executionContext
beforeFeature {
Await.result(Future.apply(()), 10.seconds)
}
//...
}
This is probably due to this commit
I could define a local implicit to work around this, but as both implicits are defined in the parent traits of CornichonFeature, I though I might be considered as a bug, also I’m not a specialist. Please confirm.
Thanks a lot ! Benoit
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
[2.5.6 Scala] ambiguous implicit values if using execution ...
You have an implicit execution context that is passed in both as a parameter, and as an import, and it does not know...
Read more >Implicit ExecutionContext priority in Scala 2.12 - Stack Overflow
error: ambiguous implicit values: both lazy value global in object Implicits of type => scala.concurrent.ExecutionContext and value ec in ...
Read more >DockerKit's implicit ExecutionContext conflicts with Scalatest's ...
Error:(27, 55) ambiguous implicit values: both method executionContext in trait AsyncTestSuite of type => scala.concurrent.
Read more >Futures and blocking in Scala - Ambiguous Implicits
At cost of exhausting precious resource of threads in default ExecutionContext . How many threads are there? The answer can be found in...
Read more >ExecutionContext - Scala 3 - EPFL
An ExecutionContext can execute program logic asynchronously, typically but not necessarily on a thread pool. A general purpose ExecutionContext must be ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
fixed in 0.20.1
Thanks for trying 👍
I am well aware that some users prefer to run tests within an IDE, I have been trying to deprecate
cornichon-scalatest
for a while https://github.com/agourlay/cornichon/issues/190I have other priorities right now so an Intellij plugin would need to be an external contribution.
Anyway I understand that this current issue still needs to be resolved.