This moves the five test suites for flow analysis along with the
constants test suite.
Note that a few files have formatting errors. I'll fix those in a
follow-up CL.
Change-Id: Ie9bba74c7d91e49ac6c9d3c64a96be007b6a94c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123680
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Previously such shared code was in the front_end package, but that
created problems because there is a lot of code in front_end that
isn't intended to be shared with the analyzer (including, notably, the
dependency on kernel).
This CL just moves over the flow_analysis logic to the new shared
package. Follow-up CLs will move over other shared logic and tests.
The end goal is that the analyzer package will no longer have a
dependency on front_end.
Change-Id: I5642d6565204422d79808ca47648462db85e442a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123624
Reviewed-by: Jens Johansen <jensj@google.com>
The goal is to stop implementing FunctionTypedElement in
FunctionTypeAliasElement, and keep only TypeParameterizedElement.
For some time we will have to keep implementing TypeDefiningElement, it
is used currently as a marker for top-level declarations.
Change-Id: I0062aaa66861a4d7dd5337eb9a44338ad49f5901
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123545
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This will help with invalid cases like `typedef F = int;`.
I plan for FunctionTypeAliasElement to stop implementing FunctionTypedElement,
so stop implementing `parameters` and `returnType`, which currently
do the correspoding workaround. Instead clients will ask
`function.returnType`, and I'd not like to make null-aware in many places.
Change-Id: I3ae9abe4778e530fb02e66f32e4d52f7b57ffeb4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123484
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This avoids the need to special case test expectations for CFE in
pkg/front_end/test/flow_analysis/reachability/data/never_return_type.dart.
Change-Id: Ib754a76c96e73c8183b5ff10a2e7d2908e653a31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123420
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
https://github.com/dart-lang/language/blob/master/resources/type-system/subtyping.md#rules
This includes subtyping tests ported from CFE.
Performance is on par with the performance before this changes.
On package:flutter, when each isSubtypeOf() is executed 100 times,
timings are 35292 ms vs. 33838 ms spent on isSubtypeOf() itself
(not the whole analysis times). So, the difference is about 5%,
but because it is 100x, it should result in less than 0.05% of total
analysis time difference.
There are other optimizations that we can make in this area, though.
For example checking for `Object?` could be done using identical() to
avoid expensive megamorphic (I think) `isDartCoreObject`. Similarly
for checks for `Null` and `FutureOr`.
Google3 presubmit looks green.
https://test.corp.google.com/ui#id=OCL:276348418:BASE:276562990:1571960231050:ff94b8d8
Change-Id: I0b7e5baba82908e1123783c4a9494b1dfc74ea99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122682
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This should make it easier to verify that the CFE implementation is
correct.
Note that this effort encountered a few bugs in the analyzer
implementation, which are marked with TODOs. I will fix them in
follow-up CLs.
Change-Id: Ic164a1cf214b5730f848b17db2838c29d25b00d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122850
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
These data structures are only used for testing (and are not even
created in normal production use). Add "ForTesting" to their names so
that we are less likely to use them by accident.
Change-Id: Ic719d66089a692362957e257c9bbb2f632bfd174
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122980
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Remove markdown from diagnostic messages,
Format messages to fit in 80 lines,
Sort unsorted file,
Move diagnostic tests to the correct test classes,
Remove diagnostic that is no longer being generated.
Change-Id: I1dbd6a141a4ef31eb89d9ea5edfd17512cbb261a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122821
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Previously, we were using `DartType.toString` to check test
expectations, but `DartType.toString` currently doesn't show
nullabilities. This isn't currently a problem because at the moment
all the type promotion tests use non-nullable types, but I will soon
be adding type promotion tests that use nullable types.
This CL fixes the problem by using `TypeImpl.toString` and passing in
`true` for the optional argument `withNullability`.
Change-Id: I6a2c6057c27c9205657143aa56088cc30a6510d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122822
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>