Skip to content

Fix class hierarchy diagram and docs for explicit nulls #7760

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
bishabosha opened this issue Dec 14, 2019 · 7 comments · Fixed by #7763
Closed

Fix class hierarchy diagram and docs for explicit nulls #7760

bishabosha opened this issue Dec 14, 2019 · 7 comments · Fixed by #7763
Assignees

Comments

@bishabosha
Copy link
Member

http://dotty.epfl.ch/docs/reference/other-new-features/explicit-nulls.html

currently the link for the class hierarchy image is broken, and there are no links in the sidebar

@bishabosha bishabosha changed the title Fix documentation for explicit nulls Improve visibility of documentation for explicit nulls Dec 14, 2019
@odersky
Copy link
Contributor

odersky commented Dec 14, 2019

Actually, the type hierarchy image still does not show.

@odersky odersky reopened this Dec 14, 2019
@odersky odersky changed the title Improve visibility of documentation for explicit nulls Fix link to class hierarchy diagram for explicit nulls Dec 15, 2019
@odersky odersky changed the title Fix link to class hierarchy diagram for explicit nulls Fix class hierarchy diagram and docs for explicit nulls Dec 15, 2019
@odersky
Copy link
Contributor

odersky commented Dec 15, 2019

In fact the diagram is outdated, and the surrounding text as well. Null is now a value type, not a subtype of Any. The docs and the diagram need to be fixed.

@odersky odersky reopened this Dec 15, 2019
@odersky
Copy link
Contributor

odersky commented Dec 15, 2019

The link is good now, but the text and diagram need to be fixed.

@noti0na1
Copy link
Member

@odersky Currently, Null is still a subtype of Any.

I tried to simply change the parent of NullClass to AnyValType, but this doesn't work. There are some errors in the Erasure phase.

Should we also add it to ScalaValueTypes?

@milessabin
Copy link
Contributor

I'm a little concerned that code which matches against AnyVal scrutinees now has to be prepared to handle null. Granted, AnyVal isn't sealed, and yes, Null is no different from any other non-primitive subtype of AnyVal, which also need to be handled, but I can see this causing some surprises.

@sjrd
Copy link
Member

sjrd commented Dec 16, 2019

@milessabin Honestly that sounds like a totally made up concern to me. I've never seen any code trying to exhaustively match on an AnyVal. And if there was, either it was already broken because it didn't handle custom value classes; or it was in fact correct because only some specific subtypes reached that match, but in that case there would be no new null reaching such code and hence it would stay correct.

@bishabosha
Copy link
Member Author

bishabosha commented Apr 5, 2020

This issue was about the diagram not showing, and maybe not being consistent with the implemented solution. However the diagram does show and it is consistent with the current state of things. Another issue should be opened for the status of where Null should go in the type hierarchy

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

Successfully merging a pull request may close this issue.

6 participants