-
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
Support generalized void #30176
Comments
Note that an important test for this feature has been adjusted in this commit: The commit fixes this problem: A new function |
Support has landed in Fasta with 9bdf248 and dart2js will get it for free. All that's left is to update the language specification. |
The rules about generalized void have been added to the language specification a long time ago. |
The reserved word
void
denotes a type, but it has received special treatment in Dart 1.x: it was allowed only as a function return type in the grammar.void
will now be allowed in several other locations, e.g., as a type annotation and as an actual type argument in a generic type or an invocation of a generic function. Note that it is still not allowed to usevoid
in certain other contexts; for instance, it can not be used inimplements void
,with void
, norint foo<T extends void>(T t) {..};
.Note that the generalized void feature contains two phases: In the first phase, it is allowed to use
void
in many locations where it is currently not allowed, but direct usage of the value of a void expression is prohibited in most situations. That is, when an expression of typevoid
is evaluated, the result must generally be discarded.In the second phase, support for detecting that an implicit cast can cause the static analysis of a certain expression to "forget" voidness is added. This issue is only concerned with the first phase.
For more details, please consult the feature specification (which is also only concerned with the first phase).
Tracking issues
For many tools, the common front end Fasta will provide support for most or all of this feature. Hence, support in Fasta is a core step in the implementation of this feature. Tool teams are therefore encouraged to coordinate the efforts with the work on Fasta.
The text was updated successfully, but these errors were encountered: