-
Notifications
You must be signed in to change notification settings - Fork 47
Infer return types of literals rather than requiring explicit ascription #438
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
Comments
The optimisation thing is specifically because |
So Rsc can already infer for |
Incredibly, adding |
As far as I know, the types of all literals are (or are effectively) final, right? i.e. nothing extends |
Yes, I believe we can do what you're describing, at least for objects which don't extend anything. Though in this case it wouldn't be helping with the "subvert optimizations" since the compiler isn't making optimizations. |
The parser should hopefully not require type ascription in the following cases where it currently does. Both because it looks messy, and because @ShaneDelmore tells me that requiring ascriptions may subvert some optimisations.
Currently these all produce errors:
The text was updated successfully, but these errors were encountered: