Commit Graph

18 Commits

Author SHA1 Message Date
Johnni Winther 024052f367 [cfe+dart2js+analyzer] Remove support for libs in id testing
We now have support for a test as a directory instead.

Change-Id: I3c43e2e57ecda8e3c9d97aa8842be7093c1df5ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113035
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-08-15 07:31:50 +00:00
Paul Berry 612825900e Only create FlowAnalysisResult data structure when running internal tests.
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>
2019-08-05 21:12:43 +00:00
Jens Johansen d49de8b68f succinct option for id testing
Add a "-s" (succinct) option to have a more dense output.
Meant for use together with "-a" so one can get a quick overview of how
many tests fail, e.g.
out/ReleaseX64/dart pkg/front_end/test/id_testing/id_testing_test.dart -a -s

Change-Id: I9e1d91694be76e6c66bf0f3c9168783f920a5bf4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110914
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-01 09:25:28 +00:00
Paul Berry 973a236558 Fail analyzer ID tests if errors are found.
This ensures that we don't accidentally create a test case containing
errors.

Change-Id: I9b6220e15e70640833877f75a08a5a219574be34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110342
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-07-31 13:55:54 +00:00
Paul Berry bf4bde6ea2 Move test cases from flow_analysis_test.dart into front end.
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>
2019-07-24 20:20:09 +00:00
Paul Berry 6c43390cd8 Begin running the shared "ID tests" for constants on the analyzer.
This exposed an analyzer bug--see #37608.

Change-Id: I96af785ce81ebb7b142b4f71cb43942b2b15f879
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110123
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-07-23 22:08:12 +00:00
Johnni Winther 4cd16d3954 [analyzer+cfe] Use more shared code for annotated code testing.
Change-Id: Id1d234beed0059c84375bbeefb4755fac23d72c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108817
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-07-16 05:41:11 +00:00
Paul Berry ebbfb48e15 Followups to https://dart-review.googlesource.com/c/sdk/+/108265
Change-Id: I38cdf22aff3bb89f2f05001f878da334793c18f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108270
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-07-13 07:17:33 +00:00
Brian Wilkerson 2048e0a064 Rewrite extension overrides, improve resolution, remove unused method
Change-Id: I2b11e0213250ffa01d7a186c7265af45d6a30301
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108945
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-07-12 21:42:11 +00:00
Brian Wilkerson 97587b554f Update the element model to support extension methods
Change-Id: Ia3bd6a19514368b3e046fead2eed0a4d0bfb133d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108504
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-07-11 13:28:37 +00:00
Paul Berry c0932a8af6 Move annotated_code_helper.dart into front_end.
This avoids the need for the analyzer to depend on the unpublished
package sourcemap_testing.

Change-Id: I7632df2028d4f3557d2c5c4a3a75510cda968efd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108268
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-07-05 11:40:25 +00:00
Paul Berry ee696f2c35 In flow analysis tests, annotate doesNotComplete on functions rather than bodies.
Change-Id: I40476db016fd153ea4a013bcaa452775bcd960d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108266
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-07-05 09:08:40 +00:00
Paul Berry c1ca599353 Adapt flow and promotion tests to make use of CFE testing framework.
This CL reworks the tests flow_analysis_test.dart and
type_promotion_test.dart to make use of the framework recently
introduced into pkg/front_end/lib/src/testing/id.dart.  The long term
goal is to move these tests into a common location so that they can
exercise both the front end and the analyzer.

Change-Id: Iad95065e995b0fe3c6e4990d2ea015215895743a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108265
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-07-05 09:08:40 +00:00
Paul Berry 7d277c4a32 Introduce methods and classes to replace "2" variants left over from "UI as code" work.
The AST refactor for "UI as code" left behind a few things whose names
ended in "2".  This CL deprecates those things and creates
replacements that don't end in "2", so that we keep the API clean.  In
a future breaking change release of the analyzer we'll remove the
deprecated things.

The following methods and classes are added:
- ForStatement and ForStatementImpl
- ListLiteral.elements
- SetOrMapLiteral.elements
- AstVisitor.visitForStatement
- AstFactory.forStatement
- NodeLintRegistry.addForStatement

The following methods and classes are deprecated:
- ForStatement2 and ForStatement2Impl
- ListLiteral.elements2
- SetOrMapLiteral.elements2
- AstVisitor.visitForStatement2
- AstFactory.forStatement2
- NodeLintRegistry.addForStatement2

In a similar way to how we did the previous stage of AST migration,
the existing visitors have been modified so that the default
implementation of visitForStatement2 redirects to visitForStatement;
this allows clients to change their overrides of visitForStatement2 to
override visitForStatement instead.  Once all clients have been
migrated we will be able to delete the visitForStatement2 method.

Change-Id: Ife5949071fe4cb50791cd4f2f4b99a1bfaad54c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97360
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-03-20 22:58:55 +00:00
Paul Berry 68c9909ef8 Re-apply workaround for bug fixed by closures containing type promotions in variables with inferred types.
ba5644b76c fixed an analyzer bug causing
a crash when a top level variable requiring type inference contained a
closure involving type promotion, and removed some explicit types that
were present in the analyzer to work around the bug.

Although the bug has been fixed now, the fix hasn't rolled out in a
release of the SDK.  So to avoid people seeing analysis server crashes
when editing the analyzer, I'm re-introducing the workaround.

Change-Id: I5e61345021cd33cb9ad1f017a7619815a38c6a1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95667
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-03-06 20:12:07 +00:00
Paul Berry ba5644b76c Fix handling of closures containing type promotions in variables with inferred types.
Promotion analysis requires the localVariableInfo data structures to
be set; these are set by the VariableResolverVisitor.  So we need to
ensure that this visitor runs prior to type inference.

Change-Id: I579301beb101f32a1965f9eb8f07b1196d232b8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95422
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-03-06 17:16:19 +00:00
Paul Berry 1abcbe1318 Eliminate uses of old AST node types from parts of the analyzer
This CL covers the following subdirectories:
- pkg/analyzer/test/util
- pkg/analyzer/test/src/summary
- pkg/analyzer/test/src/dart/resolution
- pkg/analyzer/test/src/dart/ast
- pkg/analyzer/test/src/dart/analysis

Change-Id: I2a04f348906501ef99ba6a3162d04efcbb64c235
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95262
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-03-04 21:21:24 +00:00
Konstantin Shcheglov d09c1265e9 Issue 35467. Move ast_type_matchers/element_type_matchers into test/util/.
R=brianwilkerson@google.com, paulberry@google.com

Fixes https://github.com/dart-lang/sdk/issues/35467
Change-Id: I2aab476e2e88f5bdbf5e62a2104ff7d271a73209
Reviewed-on: https://dart-review.googlesource.com/c/88780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-01-09 04:46:39 +00:00