Closed
Description
See #27141 for details.
The analyzer should accept an assert
"expression" (like an assert statement without a trailing ;
) as an element in initializer lists.
To enable: add the flag enableAssertInitializer
in the language
section of the .analysis_options
file. Here is an example:
analyzer:
language:
enableAssertInitializer: true
As an initial implementation, the analyzer can skip analyzing the assertion completely.
It would be great if it could also evaluate any assert in a const context (in an initializer of a const constructor which is used to create a compile-time constant value). This would enable earlier errors for the team that is experimenting with the feature.