Closed
Description
Minimized code
// A.scala
case class A(x: Int)
private object A
// B.scala
object B {
val f: Int => A = A
f(0)
}
Output
Compile successfully with a warning
> scalac A.scala B.scala
[info] running (fork) dotty.tools.dotc.Main -classpath /home/piquerez/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.4/scala-library-2.13.4.jar:/home/piquerez/lampepfl/dotty/library/../out/bootstrap/scala3-library-bootstrapped/scala-3.0.0-M3/scala3-library_3.0.0-M3-3.0.0-M3-bin-SNAPSHOT.jar B.scala A.scal
-- Warning: B.scala:2:20 -------------------------------------------------------
2 | val f: Int => A = A
| ^
|The method `apply` is inserted. The auto insertion will be deprecated, please write `A.apply` explicitly.
1 warning found
[success] Total time: 63 s (01:03), completed Dec 9, 2020, 10:35:11 PM
Expectation
It should not compile because the apply method of the private companion object should not exist