-
Notifications
You must be signed in to change notification settings - Fork 1k
WIP Fix SIP-23 (Literal Types) #1599
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
Conversation
I think the example use of scala> def foo[T](t: T): t.type = t
foo: [T](t: T)t.type
scala> final val bar = foo(23)
bar: 23 = 23 Otherwise LGTM. |
Hi @milessabin, thanks for the comment.
In each case I am seeing the widened type. |
Oh how embarrassing, look how that dreaded
Although it is perhaps interesting to note that the type gets widened for a I'll restore the example with |
This reverts commit c0d730d.
A remaining question is whether we should update the history section of the SIP or not. |
I don't think the history section needs updating; that section's purpose is to alert the SIP committee to design changes in the proposal. we have the git history for those interested in full details thanks @valencik for tackling this! |
This PR cleans up some incorrect code examples in the SIP-23 document.
Additional commentary
This PR better addresses the issues discussed in #1570
I do not think this addresses all the confusion one could run into when playing with literal types.
I think we need to improve the spec and write some documentation elsewhere, perhaps an overview or section in the tour.
However, hopefully this PR serves as an incremental improvement over the current state.