question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ambiguous implicits for ExecutionContext

See original GitHub issue

Hi,

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:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
agourlaycommented, Nov 5, 2021

fixed in 0.20.1

0reactions
agourlaycommented, Oct 26, 2021

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/190

I 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found