diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2015-02-05 15:28:16 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2015-02-05 15:28:16 +1000 |
commit | 73986e673e029d8d320cc830751b455cc30f2704 (patch) | |
tree | 6295cf2a39dddb9c8747c41f64e1640da6979ed1 | |
parent | 67fd6557af837b19ff68f9292790bd293ce8009b (diff) | |
parent | 3c97888ab896e7ffc63e44515902aba1c5022072 (diff) | |
download | scala-73986e673e029d8d320cc830751b455cc30f2704.tar.gz scala-73986e673e029d8d320cc830751b455cc30f2704.tar.bz2 scala-73986e673e029d8d320cc830751b455cc30f2704.zip |
Merge pull request #4248 from retronym/ticket/9086
SI-9086 Fix regression in implicit search
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 6 | ||||
-rw-r--r-- | test/files/pos/t9086.scala | 8 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 9773028b76..6e5f61db1a 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1536,7 +1536,11 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper val cbody1 = treeCopy.Block(cbody, preSuperStats, superCall1) val clazz = context.owner assert(clazz != NoSymbol, templ) - val dummy = context.outer.owner.newLocalDummy(templ.pos) + // SI-9086 The position of this symbol is material: implicit search will avoid triggering + // cyclic errors in an implicit search in argument to the super constructor call on + // account of the "ignore symbols without complete info that succeed the implicit search" + // in this source file. See `ImplicitSearch#isValid` and `ImplicitInfo#isCyclicOrErroneous`. + val dummy = context.outer.owner.newLocalDummy(context.owner.pos) val cscope = context.outer.makeNewScope(ctor, dummy) if (dummy.isTopLevel) currentRun.symSource(dummy) = currentUnit.source.file val cbody2 = { // called both during completion AND typing. 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 + } +} |