Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in implicit scope search of singleton type of term-owned object #10154

Closed
scabug opened this issue Jan 19, 2017 · 3 comments
Closed
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Jan 19, 2017

This is a regression introduced by this PR relating to the detection of term-owned companions. It looks as though it inadvertently broke the case where the type is the singleton type of an object, and so the companion is the object itself. The "object is the companion of its own singleton type" property is exploited by shapeless's Poly's, and so the result is that this breaks all method-local examples in the shapeless tests.

The following is a standalone reproduction of the issue,

trait Bar2[T]

object Test2 {
  def wrap {
    object Foo {
      implicit def fooBar: Bar2[Foo.type] = ???
    }

    implicitly[Bar2[Foo.type]]
  }
}

This compiles with 2.12.1, but fails with 2.12.2 ("could not find implicit value for parameter e: shapeless.Bar2[Foo.type]"). If the definition of object Foo is moved out of wrap then the code compiles with 2.12.2.

@scabug
Copy link
Author

scabug commented Jan 19, 2017

Imported From: https://issues.scala-lang.org/browse/SI-10154?orig=1
Reporter: @milessabin
Affected Versions: 2.12.2

@scabug
Copy link
Author

scabug commented Jan 20, 2017

@retronym said:
scala/scala#5654

@scabug
Copy link
Author

scabug commented Jan 20, 2017

@milessabin said:
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants