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

case classes extending each other #4109

Closed
scabug opened this issue Dec 23, 2010 · 13 comments
Closed

case classes extending each other #4109

scabug opened this issue Dec 23, 2010 · 13 comments
Assignees

Comments

@scabug
Copy link

scabug commented Dec 23, 2010

If a case class is declared as a child of another case class, the compiler usually gives warnings. But in certain cases the compiler crashes with the following exception:

scala.tools.nsc.symtab.Types$$TypeError: not enough arguments for method body%3: (val cond: lazabs.ast.Tree.Expression,val conseq: lazabs.ast.Tree.Expression,val rest: List[lazabs.ast.Tree.Tree])List[lazabs.ast.Tree.Tree].
Unspecified value parameters conseq, rest.
	at scala.tools.nsc.typechecker.Contexts$$Context.error(Contexts.scala:274)
	at scala.tools.nsc.typechecker.Infer$$Inferencer.error(Infer.scala:205)
	at scala.tools.nsc.typechecker.Infer$$Inferencer.errorTree(Infer.scala:209)
	at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$tryNamesDefaults$$1$$4.apply(Typers.scala:2410)
	at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$tryNamesDefaults$$1$$4.apply(Typers.scala:2402)
	at scala.Option.getOrElse(Option.scala:104)
// several more lines

I am not sure how this is reproducible. If I don't declare the ancestor class as a case class then the complier does not crash.
I am using Scala 2.8.1.final.

@scabug
Copy link
Author

scabug commented Dec 23, 2010

Imported From: https://issues.scala-lang.org/browse/SI-4109?orig=1
Reporter: Hossein (hossein)

@scabug
Copy link
Author

scabug commented Jan 4, 2011

@hubertp said:
I think we should make it a compiler error in 2.9, but lets see what people on the meeting say.

@scabug
Copy link
Author

scabug commented Jan 4, 2011

@hubertp said:
We need to remove deprecated things for 2.9 anyway, so this will be included in it.

@scabug
Copy link
Author

scabug commented Feb 20, 2011

@paulp said:
Setting priority to "high" to flag that it remains undecided whether we will turn case class inheritance into an error for 2.9. Argument in favor is that it's really buggy and we'd generally be doing people a favor; argument against is that it hasn't been deprecated for as long as we'd like (although it has been long enough according to the official policy on deprecations.)

@scabug
Copy link
Author

scabug commented Feb 21, 2011

@hubertp said:
I will bring it up again on the next meeting.

@scabug
Copy link
Author

scabug commented Mar 3, 2011

@paulp said:
Martin and I decided not to make it a compile error yet, but to turn the message scariness knob all the way to the right.

@scabug
Copy link
Author

scabug commented Mar 3, 2011

@hubertp said:
Yes, it is on my todo list. I will make the message more scary, as agreed ;)

@scabug
Copy link
Author

scabug commented Mar 7, 2011

@paulp said:
(In r24398) Raised the scariness of the case class deprecation message.
(I hope you don't mind, hubert, I like writing scary messages.)
Closes #4109 I suppose, no review.

@scabug
Copy link
Author

scabug commented Mar 7, 2011

@hubertp said:
I was actually going to push my thing, but you were quicker.

btw. shouldn't we keep this bug open until after 2.9, so that at that point I make it an error?

@scabug
Copy link
Author

scabug commented Mar 7, 2011

@paulp said:
Replying to [comment:13 plocinic]:

btw. shouldn't we keep this bug open until after 2.9, so that at that point I make it an error?

Probably, although I wish there was some chance I could forget about it. Just trying to clear brush away so I can see more of the snakes. If you want to reopen it I won't make a peep.

@scabug
Copy link
Author

scabug commented Mar 7, 2011

@SethTisue said:
There is a persistent misconception that it's always wrong to inherit from a case class, when the real prohibition is actually narrower. So I suggest the error message say "Case-to-case inheritance" instead of the present "Case inheritance".

Also, I think the error message should include some sound effects.

@scabug
Copy link
Author

scabug commented Mar 7, 2011

@hubertp said:
Yes, I would rather keep it open since then I still know it is on my radar.

@scabug
Copy link
Author

scabug commented Mar 7, 2011

@hubertp said:
Actually, I created another ticket (#4319).

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

2 participants