From 03e6d929ee639de292daa778dde514e1b7014eac Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Mon, 21 May 2012 00:04:52 +0200 Subject: Consider method-scoped companions in the implicit scope. Fixes SI-4975. I'll reproduce a relevant snippet of dialogue from Namers#companionSymbolOf: /** The companion class or companion module of `original`. * Calling .companionModule does not work for classes defined inside methods. * * !!! Then why don't we fix companionModule? Does the presence of these * methods imply all the places in the compiler calling sym.companionModule are * bugs waiting to be reported? If not, why not? When exactly do we need to * call this method? */ def companionSymbolOf(original: Symbol, ctx: Context): Symbol = { This was one such bug. --- test/files/pos/t4975.scala | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 test/files/pos/t4975.scala (limited to 'test') 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 + } +} -- cgit v1.2.3