Commit Graph

24 Commits

Author SHA1 Message Date
Paul Berry 5f6d30da26 Add a verify_tests_test.dart to pkg/nnbd_migration.
This would have caught the need for
https://dart-review.googlesource.com/c/sdk/+/168462 and
https://dart-review.googlesource.com/c/sdk/+/171261.

Change-Id: I8da1f24cac5eb9df36ae1ca7299c0aeddbd80149
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171301
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-11-11 18:09:18 +00:00
Sam Rawlins 151292572c Migrator: Check analysis results before re-running.
* Refactor MigrationCliRunner, mostly simplification.
* Add AnalysisResult class to track analysis errors.
* MigrationState now contains an AnalysisResult, and the previewUrls.
* Add logic in the UI to display analysis results.
* Add logic to the backend to display analysis results.


Fixes https://github.com/dart-lang/sdk/issues/41712
Fixes https://github.com/dart-lang/sdk/issues/43138

Change-Id: I3304467955cfa81820f0010d32e17931b3c68b08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162400
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-09-10 20:55:14 +00:00
Paul Berry bf30eb53e2 Migration: Remove "fantasy land" functionality
We're not currently working on this, and it has some dependencies that
interfere with publishing the migration tool.  If we wind up needing
it again, we can always revert.

Change-Id: Ia6219ac376cef77bda7470777eaf2bebf38769b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149343
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
2020-05-28 22:05:05 +00:00
Paul Berry e589f5f76b Migration: remove isolate_server.dart.
This code was necessary when the NNBD migration engine was part of the
analysis server, to allow migration to be run in-process.  Now that
it's been separated to its own library, it always runs in process, so
this code is not needed anymore.

Change-Id: Id9e497dca6700ad804f2410cb3b20107be3a4bd2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148503
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-05-19 17:08:00 +00:00
Paul Berry eab774c255 Move much of migration tool UI code into pkg/nnbd_migration
Change-Id: Ia3b388b274c908dcc6f9cb9ee4bf004b82681c43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144320
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-23 23:43:42 +00:00
Paul Berry 46b49d23ec Migration: track multiple fix reasons for expressions with complex types.
Change-Id: I1a1f78377ed64504e5315b5096914219dc625e78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143188
Reviewed-by: Janice Collins <jcollins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-14 23:33:46 +00:00
Janice Collins 40b4389891 Add AnalysisServer client implementation for isolates.
Change-Id: I1b4a9394a996cdc9907273689d2c9dc0c900de55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142556
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
2020-04-07 20:02:16 +00:00
Paul Berry b01eb17669 Migration: remove test file containing no tests
Change-Id: Ib15940732ccd9e4f36de12cbe10a2ce631a4a24c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134145
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-02-03 23:10:21 +00:00
Janice Collins fe59e25492 Add ports of the tables in steamroll_ecosystem.sh.
Shifted some minor things around in the design as well -- particularly
the symlink is moved to being owned by the workspace as not all
workspace implementation will create symlinks in the original directory.

I've also dropped most of the public interface to FantasyWorkspace.
Will add that back in when I'm more sure what it will be.

Change-Id: I19d1b1c8ad4063868ff7c10869c4561d4db64bf2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133435
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-01-28 18:29:28 +00:00
Paul Berry 5a7bb50905 Migration: generalize creation of unique IDs for source spans
Previously, we used the offset of an AST node as a unique ID to
represent it, with a special hack to make sure we can distinguish a
generic function type from its return type (which has the same
offset).  But in an upcoming CL, I will need to start associating
unique IDs with expressions, so that will bring up a whole bunch more
ambiguity.

This CL switches to a technique where we combine the offset and the
end of any source span into a single unique identifier.  The algorithm
produces an output that is no larger than the square of either input.
Since we have 64-bit integers in Dart, this should be adequate for any
reasonable input file size.

Change-Id: I68ce27533eb485cc824e1080326d02de98bff1e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132404
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-01-21 15:58:02 +00:00
Paul Berry da2a3aee27 Migration: Add tests for the algorithm used by EditPlaner.passThrough.
Change-Id: Ie405bb95d735f96eb4605558a9ed22d4877f150a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131484
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-01-14 20:41:23 +00:00
Paul Berry 0456e99838 Migration: add new test files to test_all.dart
Change-Id: Ibcb7644cfc44d558de022f0579b29c96a35c84cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129327
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-12-27 14:23:15 +00:00
Paul Berry 9f8caeaf4c Migration: begin creating a third visitor class.
This visitor, once completed, will visit code after migration is
complete, determining the post-migration type of each expression, and
deciding where null checks are needed.

See #38472 for more information about why this is necessary.

Change-Id: I8c7dece643cf5417dbb66d5290fcdbad68d3e690
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119400
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-30 20:21:44 +00:00
Paul Berry 605384dbe7 Migration: Add nullability_migration_impl_test.dart to test_all
Change-Id: I8fb3d642744bf3a7c7889e2cfa71733db6c489ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118060
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-19 16:02:16 +00:00
Paul Berry 4ae145e173 Migration: Introduce an instrumentation interface.
This interface is a callback interface that allows the client to
receive detailed information about the decisions made by the migration
tool, and the source code locations associated with those decisions.
The idea is that a client of this interface can put together a report
to the user to help them understand the behavior of the migration
tool.

The instrumentation interface mostly exposes internals of the
migration engine through some safe, non-destructive interfaces.  The
interface itself is documented in the new file
pkg/nnbd_migration/lib/instrumentation.dart.  For examples of what
information the client can expect to receive through the
instrumentation interface, see the new file
pkg/nnbd_migration/test/instrumentation_test.dart.

Change-Id: I079551922bff75e0e8d290819f31533c29d7b62f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117285
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-09-16 20:57:41 +00:00
Paul Berry 3f5f9831d8 Migration: move edge builder flow analysis tests to their own file.
Change-Id: I984cfe6a041753cdefefaa2ad12cfaf00e120b6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-08-15 17:07:40 +00:00
Paul Berry 70e31c18a8 Migration: add tests for AlreadyMigratedCodeDecorator.
Change-Id: I60c582affb5c08b88221d7aa73c73b7a85e1f603
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113040
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-08-14 13:36:43 +00:00
Mike Fairhurst e627d8b852 [nnbd_migration] use postdominators to do hard edge detection in most cases
Change-Id: I6af934b4a4795a0cfd74519985b24ae171485880
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111941
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2019-08-09 07:12:00 +00:00
Paul Berry 0c6b3d1277 Migration: do better function type formatting in DecoratedType.toString.
We now wrap named argument types in `{}` and optional positional
argument types in `[]`.

A few unit tests have been added to verify this functionality; I
didn't exhaustively test the implementation of DecoratedType though.

Change-Id: I1e3135adc3abc966f8a41d90c1c6e95e9c7c1eda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107747
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-07-01 15:36:14 +00:00
Paul Berry 8b523e8efb Migration: rename GraphBuilder to EdgeBuilder.
Nomenclature is more consistent now; the graph is built by a
combination of NodeBuilder (which builds the nodes) and EdgeBuilder
(which builds the edges).

Change-Id: Id162467eab2b3b3cc17ea9f72a0f291665b1a7d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107022
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-22 16:03:02 +00:00
Paul Berry e2bc5513f0 Migration: add a data structure for tracking class hierarchy information.
The new data structure, called `DecoratedClassHierarchy`, computes and
caches the variable substitutions necessary to relate a class to one
of its superclasses.  In future CLs, we'll use this information to
create the appropriate contraints for override relationships, and to
compute the correct types when a method dispatch resolves to a method
declared in a superclass.

Note that the analyzer uses `InhertanceManager2` both to determine
what a method call resolves to and to record the appropriate
substitutions.  We can take advantage of its determination of what a
method call resolves to (that information is stored in the resolved
AST), but we need to cmopute the substitutions separately because the
substitutions need to be decorated with nullability nodes.

Change-Id: Ifb334972e509b77151d41f7e0700cd590d7b5417
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106800
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-06-21 22:42:01 +00:00
Paul Berry d622fa010b Migration: Split up migration_visitor_test.dart.
This will make it easier to re-use the test infrastructure for some
other tests I plan to introduce in a follow-up CL.

Change-Id: I0a243f00f342674fe38274eb46e7c1e943817785
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106442
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-06-18 17:43:05 +00:00
Paul Berry b385528fee Migration: Write unit tests for NullabilityGraph.
Change-Id: I7d3ab1bde98ff28203dc73d61ecdc77e8fed25f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105682
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-06-12 13:34:57 +00:00
Paul Berry 51046368c5 Move NNBD migration tool to a fresh package.
This gives us more flexibility for how we want to publish and deploy
the tool.  We now have the option, for example, of making a command
line app that invokes the tool and does not depend on analysis_server.

Note that some testing infrastructure had to be duplicated.  I plan to
consolidate this infrastructure in follow-up CLs.

Change-Id: I046506bc2bb5c3e467e15885f198ee0632351ee9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105463
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-09 17:45:35 +00:00