summaryrefslogtreecommitdiff
path: root/test/files/pos/t10154.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2017-01-20 07:45:14 +1100
committerJason Zaugg <jzaugg@gmail.com>2017-01-20 08:28:45 +1100
commit1d41aef53506a4e697f848e790e03f204d05885d (patch)
treef08aff51af34f9bd7e55fd56013912cf8221f229 /test/files/pos/t10154.scala
parent82b2470ff681a4dfe4aed5c2ce6c27bd1ad0c71a (diff)
downloadscala-1d41aef53506a4e697f848e790e03f204d05885d.tar.gz
scala-1d41aef53506a4e697f848e790e03f204d05885d.tar.bz2
scala-1d41aef53506a4e697f848e790e03f204d05885d.zip
SI-10154 Fix implicit search regression for term-owned objects
A recent change to fix lookup of companion implicits of term-owned classes (#5550) caused a regression in the enclosed test case. The previous approach of calling `Scope#lookup(companionName)` was replaced by a lookup of the scope entry of the original name followed by a narrower search lookup for the companion name, to ensure that it was a true companion, and not just a same-named module from defined at a different nested scope. However, module class symbols are not themselves entered into scopes, so the first part of the new scheme fails. We need to add a special case modules here. I've chosen to just call `.sourceModule` on module classes. For module classes in the current run (all term owned symbols will fall into this category), this amounts to using the value of the field `ModuleClassSymbol#module`.
Diffstat (limited to 'test/files/pos/t10154.scala')
-rw-r--r--test/files/pos/t10154.scala11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/files/pos/t10154.scala b/test/files/pos/t10154.scala
new file mode 100644
index 0000000000..51616b71d6
--- /dev/null
+++ b/test/files/pos/t10154.scala
@@ -0,0 +1,11 @@
+trait Bar2[T]
+
+object Test2 {
+ def wrap {
+ object Foo {
+ implicit def fooBar: Bar2[Foo.type] = ???
+ }
+
+ implicitly[Bar2[Foo.type]]
+ }
+}