-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Analyzer support for Dart 1.50 non strong mode generic methods. #27641
Comments
Can the linked document be publicly shared? |
Here's a public version of the informal specification of generic method syntax that Leaf mentioned. Note that we do not commit to the contents of this file, things may still change! Update Nov 2nd: We are now implementing this feature, and the informal specification is not expected to change any more. |
I believe that https://codereview.chromium.org/2487583002/ correctly converts errors to hints in the non-strong-mode case. As far as I know the only remaining step is to remove the flag, so please let me know when doing so is appropriate. |
At some point there should be a non-strong mode error when a generic method parameter is used directly in an This error is just transitional, to ensure that users do not rely on instance check behavior that will differ between strong mode and non-strong mode. |
Error, warning, or hint? |
It is an error. |
Also note, the error is only in an 'is' check, not in a cast expression ('x as T'). |
I think it makes sense to make the motivation for this treatment of With these syntax-only generic methods there is no runtime representation for type arguments declared in the signature of a function or method. So when We could easily compile these expressions to always return The situation is different for |
I believe that https://codereview.chromium.org/2479293004/ adds the required error. As far as I know, that's everything except for removing the flag. Please let me know if you know differently. |
Sounds good! I'll return with more info when we have a robust plan for how to remove the flag in a way that doesn't disrupt our internal users. |
We've got the CLs now, for enabling this feature by default (see #27501). |
Does that mean that I should commit the CL now, or are we still waiting? |
Keep it back a little bit: We had a lot of things going on today and I haven't yet done the global pre-submit test run. I'll give a heads up when it's done, which should be tomorrow. |
@eernstg can you provide an update? |
Please check #27501 for the current status. |
The language group discussed the situation and agreed that it is OK to proceed to land the analyzer CL and then handle the error-to-hint adjustments afterwards. |
@bwilkerson when can the CL for this be landed? cc @kevmoo |
Committed |
We have an informal specification for Dart 1.50 generic methods here:
https://docs.google.com/document/d/1nccOSkdSyB9ls7TD8gUqIu6Wl2J_9bTSOoMCEIoAiQI/edit#heading=h.dnanv15dn1me
The analyzer should remove the partial support for error checking on generic methods (or make them into hints as warranted).
The only static errors for Dart 1.5 non strong mode generic methods are syntax errors, and errors for using a generic method parameter for an
is
check as inx is T
, or as a type literal.The text was updated successfully, but these errors were encountered: