dart-lang / co19

A Dart language and library conformance test suite
BSD 3-Clause "New" or "Revised" License
37 stars 28 forks source link

co19/LanguageFeatures/nnbd/null_aware_operator_A17_t01 #553

Closed scheglov closed 4 years ago

scheglov commented 4 years ago

It is a warning to use ?.. when the target is strictly non-nullable. See the spec. It is a warning to use a null aware operator (?., ?[], ?.., ??, ??=, or ...?) on an expression of type T if T is strictly non-nullable.

There are also analyzer bugs for this test case.

--- Command "dart2analyzer" (took 237ms):
DART_CONFIGURATION=ReleaseX64NNBD out/ReleaseX64NNBD/dart-sdk/bin/dartanalyzer --enable-experiment=non-nullable --ignore-unrecognized-flags --packages=/b/s/w/ir/cache/builder/sdk/.packages --format=machine --no-hints /b/s/w/ir/cache/builder/sdk/tests/co19/src/LanguageFeatures/nnbd/null_aware_operator_A17_t01.dart

exit code:
1

stderr:
WARNING|STATIC_WARNING|INVALID_NULL_AWARE_OPERATOR|/b/s/w/ir/cache/builder/sdk/tests/co19/src/LanguageFeatures/nnbd/null_aware_operator_A17_t01.dart|40|20|3|The target expression can't be null, so the null-aware operator '?..' can't be used.
ERROR|STATIC_WARNING|USE_OF_NULLABLE_VALUE|/b/s/w/ir/cache/builder/sdk/tests/co19/src/LanguageFeatures/nnbd/null_aware_operator_A17_t01.dart|77|17|2|The expression is nullable and must be null-checked before it can be used.
ERROR|STATIC_WARNING|USE_OF_NULLABLE_VALUE|/b/s/w/ir/cache/builder/sdk/tests/co19/src/LanguageFeatures/nnbd/null_aware_operator_A17_t01.dart|62|17|2|The expression is nullable and must be null-checked before it can be used.
WARNING|STATIC_WARNING|INVALID_NULL_AWARE_OPERATOR|/b/s/w/ir/cache/builder/sdk/tests/co19/src/LanguageFeatures/nnbd/null_aware_operator_A17_t01.dart|45|20|3|The target expression can't be null, so the null-aware operator '?..' can't be used.
WARNING|STATIC_WARNING|INVALID_NULL_AWARE_OPERATOR|/b/s/w/ir/cache/builder/sdk/tests/co19/src/LanguageFeatures/nnbd/null_aware_operator_A17_t01.dart|50|5|3|The target expression can't be null, so the null-aware operator '?..' can't be used.

--- Re-run this test:
python tools/test.py -n analyzer-asserts-strong-linux co19/LanguageFeatures/nnbd/null_aware_operator_A17_t01
scheglov commented 4 years ago

https://github.com/dart-lang/sdk/issues/40959 for analyzer

scheglov commented 4 years ago

Also co19/LanguageFeatures/nnbd/null_aware_operator_A17_t03

scheglov commented 4 years ago

Also co19/LanguageFeatures/nnbd/null_aware_operator_A17_t06

scheglov commented 4 years ago

Also co19/LanguageFeatures/nnbd/null_aware_operator_A17_t07