Commit Graph

6105 Commits

Author SHA1 Message Date
Mike Fairhurst 48c6180b46 [nnbd_migration] Hide hint insertion links after the migration is applied.
Change-Id: If89b16ec1c4e26e4aa1fb03fc262075c75eac526
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138389
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-03-05 19:26:44 +00:00
Mike Fairhurst 123a1ea517 [nnbd_migration] Fix 'apply edit' links.
Previously we would do a POST, but not prevent the default action of
clicking on the link, which is to navigate the browser.

Also, the URLs we generate begin with 'http' and therefore the
absolutePath call is not needed, and in fact, breaks the URL.

Change-Id: Iff0c2820ee0cdc951f82807f9535900a1e0e7ae1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138383
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-03-05 19:26:44 +00:00
Mike Fairhurst 3629658722 [nnbd_migration] Handle POST requests
Change-Id: I4e609c249e99366177f5e35861986eef4b683eee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138332
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-03-05 19:26:44 +00:00
Mike Fairhurst 5b0e439503 Fix windows path test/bots
Change-Id: Ia0f983fb14915bf1c6b331c5d5b68b30ffeaec04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138482
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-03-05 19:19:39 +00:00
Brian Wilkerson bf5171cfd1 Add support for reporting how an accessed member related to the context type and extract feature computation
Change-Id: Id5cd64ac5aaa8b5f502f978e4dab5f9502efb47c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138560
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-03-05 18:42:49 +00:00
Paul Berry a74253987b Migration: add trace functionality to the preview tool.
This establishes the base functionality.  A lot of follow-up work is
needed from here:

- Each trace should have an entry at the top of it pointing to the
  thing that was made nullable.

- The source code links in traces don't include lengths, so we can't
  highlight whole identifiers when the user clicks on a link.

- Description strings are currently generated by running toString() on
  the individual nullability nodes and edges, resulting in long-winded
  and useless descriptions.

Change-Id: Ibb370bae6bedc7a8c86092462785023002a48ac3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138481
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-03-05 17:21:54 +00:00
Devon Carew c2fc5f9756 [dart migrate] tweak the verbiage for dart migrate
Bug: https://github.com/dart-lang/sdk/issues/40881
Change-Id: Ie5b63410a926462352858f8d4341e79a8c332be5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138480
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2020-03-05 16:51:04 +00:00
pq 2a13c38ca7 corpus support
Basic support for running metrics over a corpus (e.g., directory containing n packages).

Change-Id: Ie92fc6d035edbe57c1581ccb2bee9b60ea9594d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2020-03-04 20:36:36 +00:00
Konstantin Shcheglov d3fd44182d Fix crash in declaredParameterElement().
R=brianwilkerson@google.com

Bug: b/150742402
Change-Id: Ia72179f934579f1eb6861bf8b6cc955168e10136
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-03-04 19:42:16 +00:00
Mike Fairhurst d83efc38f9 [nnbd_migration] Apply the changes to disk on apply-migration request
This integrates fairly well with the new dartdev ux. We may be able to
improve the wording, etc., but given the fact that it has to be rerun
with --apply-edits, there is no need to notify anyone that the edits
occurred (currently). I'll take another look at potential wording
improvements in a follow-up CL.

In the dartfix ux, the dartfix driver doesn't get notified of the
changes and will ask if you want to apply, and this is not as good :) If
you say yes, you will apply the edits twice. Given that there is already
a CL to delete that code, I didn't change this in dartfix and don't plan
to.

Change-Id: Ie822a5761d05b3dd08b5a793f812a331d4657598
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138203
Reviewed-by: Paul Berry <paulberry@google.com>
2020-03-04 18:42:56 +00:00
Mike Fairhurst 9eb655ee66 [nnbd_migration] Preserve "migration applied" state across reload.
Change-Id: I30e0dd282b4d50ad416cd1ac9aa3d1c0bc58037f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138202
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-03-04 18:42:56 +00:00
Mike Fairhurst 28a607c598 [nnbd_migration] Send request to server from apply migration button.
There are existing TODOs about how we should only handle POST and not
GET. In my tests, it looks like POST is not currently wired up at all.
This will make the apply migration button work, and from what I can tell
will also  make the "add hint" buttons work (they likely aren't working
right now).

I'll revisit this and switch it to POST in a later CL. It requires a bit
of rewiring in the preview server.

Change-Id: Ie8541d29b3b9cbcc151c4b57b26b36e8a7a92246
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138201
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-03-04 18:42:56 +00:00
Mike Fairhurst 99d02a1ef8 [nnbd_migration] "Apply migration" button ux/styles
Change-Id: I28d474bf07f66cb5f582e8a190046fea78e7d7b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138107
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-03-04 18:42:56 +00:00
Paul Berry bb40d68956 quote fix
In accordance w/ `prefer_single_quotes`.

Change-Id: I2df4522c437a305ae5e43814295e507388de3027
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138320
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-03-04 18:20:36 +00:00
Brian Wilkerson ed1091af3e Add two fixes for avoid_returning_null_for_future
Change-Id: I6ece892025233fe3dd51ececb7b92368be9669ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138321
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-03-04 17:26:45 +00:00
Brian Wilkerson c01417a00f Add more data and improve output
Change-Id: Ib99336a26a83c9d502f1e7d1873151387e68c364
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138263
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-03-03 23:02:13 +00:00
pq af9d78555e make git clone recursive
Change-Id: I967bc82d2b9dece0e3f60b8ea30ff76365e91540
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138261
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2020-03-03 21:36:23 +00:00
pq b774160615 handle null exception params
(This occurs if there is no catch keyword.)



Change-Id: I3d8d561f33f7d626b590d78be44d5cce2ec73ad0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138108
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2020-03-03 19:31:31 +00:00
pq 258cb9f0ae fix pub get
Change-Id: I2328e683d0838b777b03183aa04b07e4d7f02246
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138200
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2020-03-03 19:05:44 +00:00
Brian Wilkerson 027f9588e1 Fix replace_null_with_closure when the parameter type has no parameter names (issue 40578)
Change-Id: Ie85294e1925a1d3880416ef4ceed86052e1534e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138140
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-03-03 18:51:23 +00:00
Janice Collins 48ae192635 Prevent a crash when we have a -1 offset.
Bug: https://github.com/dart-lang/sdk/issues/40827
Change-Id: I1d76655410945bb0e8f7a58f71cc00aaf97d375e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138047
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-03-03 17:46:01 +00:00
Paul Berry 8fa6e9d20e Migration: separate EditLink and TargetLink models for preview tool.
The preview tool's "edit details" box handles two kinds of links:
links allowing the user to request a change to the source file
(i.e. adding/removing hints), and links allowing the user to navigate
to a target.  Use separate data structures for these two kinds of
links, because they store different data.

Change-Id: I41bdf7fc9c94fc28e703da34d67d8c20f6f86108
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138012
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-03-03 16:42:51 +00:00
Paul Berry 179f2caf14 Migration: update region_renderer_test to use new EditDetails data structure.
Change-Id: I4103eb63f752b91fb679d024b27ed63b5fca4551
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138048
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-03-03 16:42:51 +00:00
Paul Berry aaa63b511c Make migration codegen traverse directories in a stable order.
Fixes #40505.

Bug: https://github.com/dart-lang/sdk/issues/40505
Change-Id: I846c4262845a30417ae2cac91997a65692473e42
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138060
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
2020-03-03 16:42:51 +00:00
Paul Berry 6bd202e4d4 Sort declarations in generate_resources.dart
Change-Id: If4222c778226bf20d143991d0fd3ad03a4d6c6a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138040
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-03-03 16:42:51 +00:00
Paul Berry 33b2df4600 Migration: create object model for edit details.
We still exchange information between the client and server in JSON
format, but on the server side, we build the object and then serialize
it (rather than build the JSON directly); conversely, on the client
side we deserialize the JSON back into objects and then use them.
This makes the data interchange format easier to understand because it
is captured in class declarations.

Change-Id: Ia20293ce2713aa1793baf6e7ca8141da5615ab4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138011
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-03-03 16:42:51 +00:00
Mike Fairhurst ca3ad264a6 [nnbd_migration] Report info building exceptions to server adapter
Change-Id: I4e3eef0d3e404bd090f36f8b2516abb97cc6c311
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137520
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-03-02 23:33:06 +00:00
Mike Fairhurst 1cb188e2a1 [nnbd_migration] Add assertions that we produced good explanations.
Change-Id: Id09c64304eb1ffce51ccfde33403dec5f8498072
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137122
Reviewed-by: Paul Berry <paulberry@google.com>
2020-03-02 23:33:06 +00:00
Brian Wilkerson 581bfee7a9 Convert AssistProcessor to use new contributor methods
Also use `List<Object>` rather than `List<dynamic>`.

Change-Id: Iba95b09cc7c468b67194f53d30cffbcdeaf10671
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138016
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-03-02 23:22:47 +00:00
Brian Wilkerson dda9290461 Add a fix for use_full_hex_values_for_flutter_colors
I also extended the framework to allow arguments to be returned so that
the fix messages can be parameterized. I'm not super thrilled with the
extra return statements everywhere, so if you have suggestions for an
alternate approach I'm happy to hear them.

Change-Id: Ie7c7133d83df4aa54b198125477fcbbc0ab8f5ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137940
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-03-02 22:04:26 +00:00
Paul Berry 1c590fd8cd Migration: Sort declarations in migration.dart
Change-Id: Iff9fbf1fcd7b94aa4b71099274aec4d6356d9149
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138005
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-03-02 20:24:42 +00:00
Brian Wilkerson 1c34d8ce57 Add a new command-line flag for server to enable the new relevance computations
Change-Id: If4c9e95a6e5e804fe480cf8a061ff95ec37651e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138002
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-03-02 18:55:32 +00:00
Mike Fairhurst 3ae91fc8c5 [nnbd_migration] Add an edge origin for return;
Change-Id: I94e56933c4fb8d8c8b80ca0c427fc34c56674d04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137841
Reviewed-by: Paul Berry <paulberry@google.com>
2020-02-28 23:26:22 +00:00
Mike Fairhurst 1d1f3a5049 [nnbd_migration] Origin for inferred instance creation bounds
Change-Id: Ice51e241833e4eb70f7b41accc3908717ca8bd72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137659
Reviewed-by: Paul Berry <paulberry@google.com>
2020-02-28 23:26:22 +00:00
Mike Fairhurst e9df1ee07a [nnbd_migration] Add an edge origin for inferred parameter substitution
Change-Id: I37ce933e05a6b7ad7b8fdcc26f44968ae92516be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137658
Reviewed-by: Paul Berry <paulberry@google.com>
2020-02-28 23:26:22 +00:00
Mike Fairhurst 42d0c8245d [nnbd_migration] Add edge origin for explicit instantiation params
Change-Id: I9feebb693d8e97027019b5ff2e936ce0fd69bd3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137655
Reviewed-by: Paul Berry <paulberry@google.com>
2020-02-28 23:26:22 +00:00
Mike Fairhurst 18814410a4 [nnbd_migration] Record edge origin for explicit call parameters
Change-Id: I33ccf611d1998478c84c4b3e0576ab2e3db906bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137651
Reviewed-by: Paul Berry <paulberry@google.com>
2020-02-28 23:26:22 +00:00
Mike Fairhurst c0bcfb7d0c [nnbd_migration] Add a description for type parameter instantiation
Change-Id: Id8e3c4c98f3569b794e90d8a7a74d245f6f89504
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137648
Reviewed-by: Janice Collins <jcollins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-02-28 23:26:22 +00:00
Konstantin Shcheglov 34fcc56458 Fix for renaming named formal parameters from invocations, when synthetic.
R=brianwilkerson@google.com

Change-Id: I4dc57cfc2a941229f2ba8b8b262ed49ecdd6b170
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137825
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-02-28 23:11:00 +00:00
Konstantin Shcheglov f1e60ccf03 Fix REMOVE_UNUSED_ELEMENT crash when not the only variable.
R=brianwilkerson@google.com, pquitslund@google.com

Change-Id: I5201d957f59aa9f81478ab51db5870ec57ad6868
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137845
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-02-28 21:54:40 +00:00
Konstantin Shcheglov 3cf8c3d4b6 Issue 40243. Flush Flutter widget descriptions on a file change.
R=brianwilkerson@google.com, paulberry@google.com

Bug: https://github.com/dart-lang/sdk/issues/40243
Change-Id: Iecd2a0bd4053588dfb93445918656df65bf4b60e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137738
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-02-28 21:08:30 +00:00
Konstantin Shcheglov 3852fe2d79 Fix for cast exception in LintNames.empty_catches fix.
R=brianwilkerson@google.com, pquitslund@google.com

Change-Id: I965ec72d98f3bc3edb9d04c7d1d254603e2e3f13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137842
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-02-28 20:24:00 +00:00
Devon Carew 289c5db588 [dartfix] update the readme for trying out the migration tooling
Change-Id: I30b12213deb4f85a25f5a0fd91c3756b0c69cbb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137644
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2020-02-28 18:54:05 +00:00
pq 8c06eb107d relevance computer fixes && corpus support
* addresses memory issues
* prints stacktraces
* fixes an unsafe cast and adds a null check

This is ripe for refactoring if you want to tweak how we're clearing inheritanceManager or generally address hygiene.

It's better enough to be useful as is though and if anyone wants to analyze a corpus, they'll want these fixes...



Change-Id: Ic3b623cb3915c26f4ba691e5c2ee979d1e41d51c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137683
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2020-02-27 21:45:14 +00:00
Brian Wilkerson 2d3b8fd0a7 Add completion metrics table of distance by depth
Change-Id: I22d62dada840476f786952c69b4371ed1bc4b080
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137660
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-02-27 21:27:43 +00:00
pq a54d4eb149 recurse to install corpus dependencies
Change-Id: I5d4f27bcd8d57212e3b11faf1a8e6feeba4f308d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137620
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2020-02-27 17:10:13 +00:00
Brian Wilkerson b46f993f84 Add a fix for non-type-in-catch-clause (issue 40778)
Change-Id: Iebbdf639c76f6cdd061c94673319c2f6c89aec76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137423
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-02-26 23:33:27 +00:00
pq 8fb0e62bab corpus index updates
removed "bad" repos.

Change-Id: Iaa17a3134468c57f6c158b5ef5af9a1cd854b7f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137424
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2020-02-26 23:19:11 +00:00
Brian Wilkerson ede57f9ed4 Add some finer grained analysis around arguments
Change-Id: I1eb106a8a28a3de4fc6160794b098afb46d8aef1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137400
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-02-26 22:27:11 +00:00
Konstantin Shcheglov c9884ccf52 Analyze SDK with non-nullable experiment enabled, update MockSdk.
Initial:  https://dart-review.googlesource.com/c/sdk/+/134401
Reverted: https://dart-review.googlesource.com/c/sdk/+/134802

Internal presubmit is green.
https://test.corp.google.com/ui#id=OCL:294345942:BASE:297377939:1582738004318:fb4ae9fe

Change-Id: I25e6445bd0241a89850dff3d88ece0edd768053a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135241
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-02-26 21:08:21 +00:00