The data structure isn't optimized (recording data into it takes
O(n^2) time, where n is the number of unreachable nodes in the file),
and we don't need it for normal execution anyhow.
Following the model used by CFE and dart2js, the analysis driver has a
new flag `retainDataForTesting` to control whether the test data is
gathered, so that under normal execution there is no overhead. The
testing data is stored in a new class `TestingData`; we can expand
this class in the future if we need to record other intermediate
analysis results for testing.
Change-Id: I7e79d31b9f3c9c45121dceb49094be802e4d286f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111481
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
The test cases are based on
pkg/analyzer/test/src/dart/resolution/definite_assignment_test.dart,
however those tests are removed because they exercise the old definite
assignment logic (which was never hooked up to the rest of the
analyzer, and was abandoned in favor of flow analysis). This CL also
removes the old definite assignment logic itself.
There are two behavioral regressions compared to the old definite
assignment logic:
- Assignments inside assert bodies are erroneously assumed to always
execute (they don't, because assertions may be disabled).
- Flow analysis does not yet understand that a function may be known
to never return (with NNBD, such a function would have a return type
of Never).
These regressions have been flagged with TODO comments (in the test
files assert.dart and if.dart respectively), and will be addressed in
later CLs.
Change-Id: I4a3923f667b151fe31cdcca69373ee1f8fb85607
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110400
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
We still verify that the analyzer passes these tests, but we now do
the verification using the "ID test" mechanism that's shared with the
CFE. This will allow the front end to run these tests as soon as its
integration with flow analysis is complete.
Change-Id: I1a7e5ef9698ebac72a72d992f4d765723224fc95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110343
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
We still verify that the analyzer passes these tests, but we now do
the verification using the "ID test" mechanism that's shared with the
CFE. This will allow the front end to run these tests as soon as its
integration with flow analysis is complete.
Still to do: migrate tests of type promotion and definite assignment
so that they can be shared by the front end.
Change-Id: I3c2ac6ff8b66e3a27110dcdb1f1d2dece447c18d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110260
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>