aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2016-01-12 22:40:51 +0100
committerGuillaume Martres <smarter@ubuntu.com>2016-05-31 16:53:25 +0200
commit088902cb6d86a5546f3f3aaf317ba78a51c0c604 (patch)
tree4110ad8fd86dfb41d9cadc62068f53242860fbde
parent818bf0b2aa3ec7544bb328aaad2b2bd75e724787 (diff)
downloaddotty-088902cb6d86a5546f3f3aaf317ba78a51c0c604.tar.gz
dotty-088902cb6d86a5546f3f3aaf317ba78a51c0c604.tar.bz2
dotty-088902cb6d86a5546f3f3aaf317ba78a51c0c604.zip
Do not miss implicits in type parameters of parents
This did not work before because we incorrectly looked for their value in the prefix of the type instead of the type itself.
-rw-r--r--src/dotty/tools/dotc/typer/Implicits.scala2
-rw-r--r--tests/pos/implicit_tparam.scala12
2 files changed, 13 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala
index 44689d758..6314ce8c9 100644
--- a/src/dotty/tools/dotc/typer/Implicits.scala
+++ b/src/dotty/tools/dotc/typer/Implicits.scala
@@ -323,7 +323,7 @@ trait ImplicitRunInfo { self: RunInfo =>
def addParentScope(parent: TypeRef): Unit = {
iscopeRefs(parent) foreach addRef
for (param <- parent.typeParams)
- comps ++= iscopeRefs(pre.member(param.name).info)
+ comps ++= iscopeRefs(tp.member(param.name).info)
}
val companion = cls.companionModule
if (companion.exists) addRef(companion.valRef)
diff --git a/tests/pos/implicit_tparam.scala b/tests/pos/implicit_tparam.scala
new file mode 100644
index 000000000..3b7cf9113
--- /dev/null
+++ b/tests/pos/implicit_tparam.scala
@@ -0,0 +1,12 @@
+class Foo[T]
+class Bar extends Foo[A]
+
+class A
+object A {
+ implicit val bar: Bar = new Bar
+}
+
+object Test {
+ def getBar(implicit bar: Bar) = bar
+ getBar
+}