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 report bogus error message about companion objects #5031
Comments
Imported From: https://issues.scala-lang.org/browse/SI-5031?orig=1
|
@okomok said:
Then, it works well to define a value alias? package scalaz {
val Id = Ident
} |
@paulp said:
Which sounds like the right error to me, although at a glance the spec doesn't say much about the companionship of type aliases. If I do that, it compiles fine: package object npe {
type ID = Int
}
package npe {
trait N[X]
trait IDs {
val id = new N[ID] {}
}
object ID extends IDs
} Going to call this fixed, reopen if you disagree. |
@retronym said (edited on Jan 16, 2012 12:18:13 PM UTC): The workaround suggested by Shunsuke Sogame works well enough us, so this isn't pressing. But I'll reopen. |
@paulp said: |
@axel22 said: |
@VladUreche said: |
@paulp said: I know you don't mean "type aliases can't share a name with a term" because that would break the standard library in a hundred places. So I take it you mean "type aliases and terms of the same name have no special relationship." |
@VladUreche said: For the implementation feasibility: can you elaborate on that? |
@paulp said: |
@Blaisorblade said: I'm currently modifying my source (and others') to workaround this, but I'd like to understand if this is going to be fixed before 2.10 or not - if it's going to be fixed, then I could undo the changes or not push them. |
@hubertp said: |
@Blaisorblade said: |
@hubertp said (edited on Jul 27, 2012 8:46:29 AM UTC): package t5031
object ID package.scala: package object t5031 {
type ID = Int
} |
@hubertp said: |
@jrudolph said: See this case: https://gist.github.com/3916794 The problem is that the non-companion object can't be accessed at all from code not compiled at the same time as with the type-alias/object code. The workaround of putting the object into the package object still works. |
@hubertp said: |
Attached is a three-file reproduction with instructions to reproduce with either scalac or sbt.
The bug persists with
-no-specialization
; and appears in at least 2.8.1 and 2.9.1.Workaround is to choose a different name for the object.
The text was updated successfully, but these errors were encountered: