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

isCaseClass returns true for case object's module class #8295

Closed
scabug opened this issue Feb 16, 2014 · 6 comments
Closed

isCaseClass returns true for case object's module class #8295

scabug opened this issue Feb 16, 2014 · 6 comments
Milestone

Comments

@scabug
Copy link

scabug commented Feb 16, 2014

This doesn't make much sense, to be honest.

@scabug
Copy link
Author

scabug commented Feb 16, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8295?orig=1
Reporter: @xeno-by
Affected Versions: 2.10.0, 2.11.0
See #8063

@scabug
Copy link
Author

scabug commented Feb 16, 2014

@gkossakowski said:
Depends how you define isCaseClass, if you define it as "has case modifier and is a class" then object's module class satisfies that definition.

@scabug
Copy link
Author

scabug commented Feb 16, 2014

@xeno-by said (edited on Feb 16, 2014 9:10:44 PM UTC):
I don't think this definition is a good fit for a public API, because it doesn't quite map on the surface of the language we're reflecting upon.

@scabug
Copy link
Author

scabug commented Feb 16, 2014

@xeno-by said:
This brings up a general problem of module classes being a very confusing part of the API (I remember having a lot of troubles grokking them when I was just starting with scalac), but that's a story for a different ticket.

@scabug
Copy link
Author

scabug commented Feb 16, 2014

@xeno-by said:
Unfortunately, I don't think we can fix this in 2.11.0.

First, the change is too risky to be applied in the last minute (even though in the compiler noone uses isCaseClass in its weird sense).

Second, immediate application of the required change (having separate isCaseClass and isCaseObject) leads to significant uglification of typical sealed case analysis (e.g. as in shapeless), because knownDirectSubclasses returns module classes for objects, which makes what currently is a simple isCaseClass check non-trivial.

@SethTisue
Copy link
Member

stability wins here, I think

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

3 participants