summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala2
-rw-r--r--test/files/pos/t4975.scala12
2 files changed, 13 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index b2d373593f..a671b8d6b5 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -933,7 +933,7 @@ trait Implicits {
}
case None =>
if (pre.isStable) {
- val companion = sym.companionModule
+ val companion = companionSymbolOf(sym, context)
companion.moduleClass match {
case mc: ModuleClassSymbol =>
val infos =
diff --git a/test/files/pos/t4975.scala b/test/files/pos/t4975.scala
new file mode 100644
index 0000000000..12d889c0d5
--- /dev/null
+++ b/test/files/pos/t4975.scala
@@ -0,0 +1,12 @@
+object ImplicitScope {
+ class A[T]
+
+ def foo {
+ trait B
+ object B {
+ implicit def ab = new A[B]
+ }
+
+ implicitly[A[B]] // Error
+ }
+}