Skip to content
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

secondary parameter list on case class does not generate automatic fields #5118

Closed
scabug opened this issue Oct 26, 2011 · 2 comments
Closed

Comments

@scabug
Copy link

scabug commented Oct 26, 2011

trait A { 
  def foo: Int
  def bar: Int
}
case class B( foo: Int )( bar: Int ) extends A 

fails with compiler error: "class B needs to be abstract, since method bar in trait A of type => Int is not defined"

Explicitly adding a 'val' for the 'bar' field makes the code compilable:

case class B( foo: Int )( val bar: Int ) extends A 

Not sure if this is by design. I discovered this when trying to store the element type of an array into a case class using a secondary parameter list with an implicit ClassManifest[T]. Having automatic field generation for the secondary parameter list seems to be useful for such cases.

@scabug
Copy link
Author

scabug commented Oct 26, 2011

Imported From: https://issues.scala-lang.org/browse/SI-5118?orig=1
Reporter: Gregor Scheidt (gregor)
See #5009

@scabug
Copy link
Author

scabug commented Oct 26, 2011

@retronym said:
As designed.

See #5009, a bug related to this behaviour, for more background.

BTW, It's best to ask on the mailing list if you're not sure whether something is a bug.

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

No branches or pull requests

1 participant