Skip to content

Commit 9dae0de

Browse files
author
Adriaan Moors
committed
Merge pull request scala#592 from retronym/ticket/4975
Consider method-scoped companions in the implicit scope.
2 parents 7248c07 + 03e6d92 commit 9dae0de

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/compiler/scala/tools/nsc/typechecker/Implicits.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ trait Implicits {
933933
}
934934
case None =>
935935
if (pre.isStable) {
936-
val companion = sym.companionModule
936+
val companion = companionSymbolOf(sym, context)
937937
companion.moduleClass match {
938938
case mc: ModuleClassSymbol =>
939939
val infos =

test/files/pos/t4975.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
object ImplicitScope {
2+
class A[T]
3+
4+
def foo {
5+
trait B
6+
object B {
7+
implicit def ab = new A[B]
8+
}
9+
10+
implicitly[A[B]] // Error
11+
}
12+
}

0 commit comments

Comments
 (0)