Skip to content

Private types should not be exposed by non-private members #997

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
odersky opened this issue Dec 10, 2015 · 2 comments
Closed

Private types should not be exposed by non-private members #997

odersky opened this issue Dec 10, 2015 · 2 comments

Comments

@odersky
Copy link
Contributor

odersky commented Dec 10, 2015

We should not allow a private type to appear in the signature of a non-private member.
The private type is not accessible outside the scope of the member. In a "by-name" based
system for resolving types this can lead to crashes.

Example: collection.mutable.IndexedSeqView crashes when the accessibility of the This type
is restricted from protected[this] to private[this]. The crash happens in mixin when we try to refer
to This computing the signature of filter in AbstractTransformedX, which is an inner subclass
of IndexedSeqView. It can't work because This is not visible as an inherited member of AbstractTransformedX. To prevent crashes like these we have to be stricter in the frontend.

@SethTisue
Copy link
Member

@odersky
Copy link
Contributor Author

odersky commented Dec 11, 2015

@SethTisue Thanks for the pointer. Yes, this is the same issue. For dotc it is imperative that we fix this though, as a type is given only by its name/structure, with the info recomputed as needed. In general we cannot get the info of a private member outside its scope.

odersky added a commit to dotty-staging/dotty that referenced this issue Feb 8, 2016
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