You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get "warning: imported `Foo' is permanently hidden by definition of class Foo in package b".
I also get this error if I replace "object Foo" with "class Foo" in A.scala.
I guess this is supposed to succeed, since objects are values, not types, and so live in a different namespaces? But in that case it should also succeed when the files are compiled separately.
The text was updated successfully, but these errors were encountered:
@som-snytt said:
This is probably obvious to those who have looked at separate compilation, but under separate compilation you see the companion class a.Foo with static forwarders; that is the basis for the warning. I'm not sure about the use case where there is nothing to forward.
Create the following source files:
A.scala:
package a
object Foo
B.scala:
package b
import a.Foo
class Foo
Then run
scalac -d ./classes A.scala B.scala
The compilation succeeds.
But if I compile A and B separately:
scalac -d ./classes1 A.scala
scalac -d ./classes2 -cp ./classes1 B.scala
I get "warning: imported `Foo' is permanently hidden by definition of class Foo in package b".
I also get this error if I replace "object Foo" with "class Foo" in A.scala.
I guess this is supposed to succeed, since objects are values, not types, and so live in a different namespaces? But in that case it should also succeed when the files are compiled separately.
The text was updated successfully, but these errors were encountered: