-
Notifications
You must be signed in to change notification settings - Fork 1.1k
test_sbt broken in CI: Synthetic apply in private companion object #10728
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
Comments
Private on a top-level definition means package-private in both Scala 2 and 3, so I don't think there is a bug here. |
Then I don't understand how this test is supposed to work: https://github.com/lampepfl/dotty/tree/master/sbt-dotty/sbt-test/source-dependencies/synthetic-companion |
I guess there is an issue that is badly formulated in my previous description |
I assume this was broken by #7207 /cc @liufengyun |
The method |
Weird indeed. Anyway we can fix the test to actually directly check the subtyping relationship so it won't be influenced by whether or not A is expanded to A.apply: object B {
summon[A.type <:< (Int => A)]
} |
It seems it's Scala 2 behavior is inconsistent, the following code type checks in Scala 2: // A.scala
case class A(x: Int)
private object A
// B.scala
object B {
val f: Int => A = x => A(x) // instead of `A`
f(0)
} The only difference is eta-expansion of |
Minimized code
Output
Compile successfully with a warning
Expectation
It should not compile because the apply method of the private companion object should not exist
The text was updated successfully, but these errors were encountered: