From 44953dcb08fc5dd92e423a56bd42bcc32757aaef Mon Sep 17 00:00:00 2001 From: Viktor Klang Date: Fri, 10 Oct 2014 01:52:26 +0200 Subject: SI-8849 Makes `ExecutionContext.Implicits.global` ambiguous There was an unfortunate side-effect from having `Implicits.global` be of type `ExecutionContextExecutor`; it is more specific than `ExecutionContext`, as such it would be picked over other `ExecutionContexts` in the implicit scope. --- test/files/neg/t8849.check | 7 +++++++ test/files/neg/t8849.scala | 10 ++++++++++ 2 files changed, 17 insertions(+) create mode 100644 test/files/neg/t8849.check create mode 100644 test/files/neg/t8849.scala (limited to 'test/files/neg') diff --git a/test/files/neg/t8849.check b/test/files/neg/t8849.check new file mode 100644 index 0000000000..15b00aee8b --- /dev/null +++ b/test/files/neg/t8849.check @@ -0,0 +1,7 @@ +t8849.scala:8: error: ambiguous implicit values: + both value global in object Implicits of type => scala.concurrent.ExecutionContext + and value dummy of type scala.concurrent.ExecutionContext + match expected type scala.concurrent.ExecutionContext + require(implicitly[ExecutionContext] eq dummy) + ^ +one error found diff --git a/test/files/neg/t8849.scala b/test/files/neg/t8849.scala new file mode 100644 index 0000000000..336f16b40f --- /dev/null +++ b/test/files/neg/t8849.scala @@ -0,0 +1,10 @@ +import scala.concurrent.ExecutionContext +import ExecutionContext.Implicits.global + +object Test { + def main(args: Array[String]): Unit = { + implicit val dummy: ExecutionContext = null + require(scala.concurrent.ExecutionContext.Implicits.global ne null) + require(implicitly[ExecutionContext] eq dummy) + } +} \ No newline at end of file -- cgit v1.2.3