Skip to content

Compilation error with parameterised case class in a non-root package named 'scala' #430

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

Closed
scabug opened this issue Feb 2, 2008 · 6 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Feb 2, 2008

Attempting to compile the following file:

package a.b.scala
case class Test[T](t : T)

gives this error:

test.scala:2: error: type Nothing is not a member of package a.b.scala
case class Test[T](t : T)
                ^
one error found

Also occurs if the case class is in package a.b and package a.b.scala is defined.

Tested against rev 13855

@scabug
Copy link
Author

scabug commented Feb 2, 2008

Imported From: https://issues.scala-lang.org/browse/SI-430?orig=1
Reporter: Andrew Foggin (andyfoggin)

@scabug
Copy link
Author

scabug commented Feb 9, 2008

@richdougherty said:
More information:

// Compiles
package a {
  case class A[T]
}

// Compiles
package b.scala {
  class B[T]
}

// Doesn't compile: type Nothing is not a member of c.scala
package c.scala {
  case class C[T]
}

// Doesn't compile: type Nothing is not a member of d.scala 
package d.scala.d {
  case class D[T]
}

// Doesn't compile: type Any is not a member of e.scala 
package e.scala {
  case class E[T >: Nothing]
}

// Compiles
package f.scala {
  case class F[T >: Nothing <: Any]
}

@scabug
Copy link
Author

scabug commented Feb 22, 2008

@richdougherty said:
FYI, this bug occurs in 2.7.0 rc1 and rc2. However, there is a workaround: explicitly giving Any and Nothing as type bounds.

@scabug
Copy link
Author

scabug commented Dec 26, 2008

Michael (michid) said:
This might be related:

// Doesn't compile: type <byname> is not a member of package h.scala
package h.scala {
  case class H(s: String)(t: =>String)
}

@scabug
Copy link
Author

scabug commented Jan 14, 2009

@odersky said:
Milestone next_bugfix deleted

@scabug
Copy link
Author

scabug commented Feb 22, 2009

@paulp said:
Due to the less than consistent way package qualifying is handled inside the compiler, it's hard to be sure I got all the manifestations of this, nor to have much confidence another one won't be reintroduced down the road; but I think the current issues are fixed in r17172.

Barring an unlikely change in package resolution semantics I'd strongly recommend against using "scala" (or "java") as a package segment name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants