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
type alias and object with the same name cause type mismatch #7139
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7139?orig=1 |
@rjolly said: // A.scala
package test {
object A {
def apply(n: A) = n
}
}
package object test {
type A = Int
} scala> import test._
import test._
scala> A(0)
res0: test.A = 0
scala> A(0)
<console>:11: error: test.A.type does not take parameters
A(0)
^ |
Jed Wesley-Smith (jedws) said:
|
@retronym said: package test {
object A0
}
package object test {
type A = Int
val A: A0.type = A0
} |
@retronym said: % scalac sandbox/test.scala
% scalac -Xresident
nsc> sandbox/test2.scala
nsc> sandbox/test2.scala
sandbox/test2.scala:2: error: type mismatch;
found : p.X.type
required: AnyRef
Note that X extends Any, not AnyRef.
Such types can participate in value classes, but instances
cannot appear in singleton types or in reference comparisons.
private[this] val res1 = (null: p.X.type)
^ |
@retronym said: |
@lrytz said: |
The text was updated successfully, but these errors were encountered: