summaryrefslogtreecommitdiff
path: root/test/files/pos/t9086.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2015-01-15 11:16:05 +1000
committerJason Zaugg <jzaugg@gmail.com>2015-01-29 12:27:00 +1000
commit3c97888ab896e7ffc63e44515902aba1c5022072 (patch)
tree53cf40f2e390b219ebb83bbf8d549e028054a946 /test/files/pos/t9086.scala
parent7b5998a0592ee707c02a13859fe1520687c76c38 (diff)
downloadscala-3c97888ab896e7ffc63e44515902aba1c5022072.tar.gz
scala-3c97888ab896e7ffc63e44515902aba1c5022072.tar.bz2
scala-3c97888ab896e7ffc63e44515902aba1c5022072.zip
SI-9086 Fix regression in implicit search
Implicit search declines to force the info of candidate implicits that either a) are defined beyond the position of the implicit search site, or b) enclose the implicit search site. The second criterion used to prevent consideration of `O` in the super constructor call: implicit object O extends C( { implicitly[X] }) However, after https://github.com/scala/scala/pull/4043, the block containing the implicit search is typechecked in a context owned by a local dummy symbol rather than by `O`. (The dummy and `O` share an owner.) This led to `O` being considered as a candidate for this implicit search. This search is undertaken during completion of the info of `O`, which leads to it being excluded on account of the LOCKED flag. Unfortunately, this also excludes it from use in implicit search sites subsequent to `O`, as `ImplicitInfo` caches `isCyclicOrErroneous`. This commit adjusts the position of the local dummy to be identical to that of the object. This serves to exclude `O` as a candidate during the super call on account of criterion a).
Diffstat (limited to 'test/files/pos/t9086.scala')
-rw-r--r--test/files/pos/t9086.scala8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/files/pos/t9086.scala b/test/files/pos/t9086.scala
new file mode 100644
index 0000000000..fba34ee226
--- /dev/null
+++ b/test/files/pos/t9086.scala
@@ -0,0 +1,8 @@
+class X[A](a: A)
+object Test {
+ implicit val ImplicitBoolean: Boolean = true
+ def local = {
+ implicit object X extends X({ implicitly[Boolean] ; "" })
+ implicitly[X[String]] // failed in 2.11.5
+ }
+}