Commit Graph

36991 Commits

Author SHA1 Message Date
Paul Berry 65d157b5bb Fix type of receiverTypeObject in AssignmentVerifier.verify.
It was not necessary for this argument to support both `String` and
`DartType`; we can ensure that we always pass in a `DartType` by
calling `ClassElement.thisType`.

Change-Id: I94ac2fed7495b8267edea003d1fd088649c2d4a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217620
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-11-01 15:32:50 +00:00
Sam Rawlins 930697a158 Improve messaging of invalid yield type
Fixes https://github.com/dart-lang/sdk/issues/47379

We use a separate message for yield expressions, so that the yielded
type can be used. In checking against the yielded type, we also stop
reporting in some cases, which removes duplicate errors.

Change-Id: I2ce036086ca06d5ff32531afd4b1812f17b908ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218745
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-11-01 15:28:51 +00:00
Sam Rawlins 243fb5c383 analyzer: Support non-proper rename type alias constructor tear-offs
An alternative to https://dart-review.googlesource.com/c/sdk/+/218582

In the case of a constructor tear-off through a non-proper rename type
alias, we store the type alias on the FunctionState in constant
evaluation.

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

Change-Id: I3bcbc11fceafc3a688eb956cf0459ad1dbde6307
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218746
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-11-01 04:29:01 +00:00
Konstantin Shcheglov 2f66c077c9 Extract CompletionSuggestion.copyWith() into an extension.
Change-Id: I7cc391f91f74b5f9d37435a78d04c773f3672fcd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218744
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-31 22:02:20 +00:00
Konstantin Shcheglov 0d74a3e436 A few renames of TypeName to NamedType.
Change-Id: Ie0eae6906457a28665855eb16371ad2230d1104a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218743
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-31 21:51:00 +00:00
Konstantin Shcheglov 56bb1d56e1 Rename AstTestFactory methods that return NamedType.
Change-Id: I2546ca0352b4149509d80ad6dde97b2eb686491b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218741
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-31 19:33:00 +00:00
Konstantin Shcheglov a4ebee9438 Use NamedType in ResolvedAstPrinter.
Change-Id: I8241a175a851cc1fe97a0daebd065f2a1ec75656
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218740
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-31 19:32:40 +00:00
Brian Wilkerson cd59d39fe3 Remove some unused code from the fix support
Change-Id: Ia5f04d51e92d0dea0f1b44878a3f268f1f629f96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218670
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-10-29 21:02:39 +00:00
Konstantin Shcheglov 0908835478 Tests for extension members completion, support not yet imported.
Change-Id: Idd0d2ad814f2365fa724b246f8d84e56e7dedd25
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218669
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-29 20:54:09 +00:00
Konstantin Shcheglov 19661d7f72 Fix errors in mock SDK.
Change-Id: I27263ddbad45881d92a98ec237851dbed37cc4da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218666
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-29 20:17:50 +00:00
Konstantin Shcheglov 4f495fa6bd Use CompletionTarget.dotTarget in TypeMemberContributor.
Change-Id: Ie39d6030f1b52f42c5ae579b43ef65f88ef71914
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218667
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-29 20:17:30 +00:00
Konstantin Shcheglov f706631f63 Move dotTarget to CompletionTarget.
Change-Id: Idaf40cdedcb90fd68f00fd3ab994ac53c7fe1ae2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218665
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-29 18:34:15 +00:00
Konstantin Shcheglov c1b3d96e97 Enable named_arguments_anywhere in analyzer unit tests.
Change-Id: Ie83d07dd3c2fe16459abcd2b534440078c66a4b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218660
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-10-29 18:16:09 +00:00
pq aad6da844e respect awaited used results
Fixes: https://github.com/dart-lang/sdk/issues/47569

Change-Id: If5391899603ad6ee4295d1d3a8fabba9a26a958f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218661
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2021-10-29 18:09:23 +00:00
Konstantin Shcheglov 9e5d26a31a Fix cast to Expression when completion in a comment token.
By some reason we started getting many of these recently,
showing in crash log.

Change-Id: I6373e8d4b56a32c7d66cc835f1ff6aefb4cd186c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218662
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-29 17:33:19 +00:00
Sam Rawlins 8f756bf96b Add CommentReferableExpression, for expressions which can be used in a CommentReference
* Replace `identifier` field with `expression`, which means deprecating
  `identifier`, redirecting users to `expression`. For now, `expression`
  always returns an Identifier. In a future breaking release, it will
  return other CommentReferableExpressions.
* SimpleIdentifier, PrefixedIdentifier, PropertyAccess,
  ConstructorReference, FunctionReference, and TypeLiteral are all
  CommentReferableExpressions, but support is not implemented yet to
  parse CommentReferences with those contained expressions.

Bug: https://github.com/dart-lang/sdk/issues/47444
Change-Id: I1905afecf3878cd7dca6e275ef0a2ab80500eb4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216320
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
2021-10-29 16:38:09 +00:00
Sigurd Meldgaard 3c5e2a0d7b Bump pub to 0035a40f25d027130c0314571da53ffafc6d973b
Changes:
```
> git log --format="%C(auto) %h %s" 78bc50c..0035a40
 https://dart.googlesource.com/pub.git/+/0035a40f Fix echo mode crash on `token add` (#3194)
 https://dart.googlesource.com/pub.git/+/a75a8c17 Don't warn against discontinued transitive dependencies (#3195)
 https://dart.googlesource.com/pub.git/+/cf2ed105 Fix analytics code (#3197)
 https://dart.googlesource.com/pub.git/+/08e13f7b Remove unused golden files (#3189)
 https://dart.googlesource.com/pub.git/+/b6293b80 Fix log message related to `pub global activate`  (#3187)
 https://dart.googlesource.com/pub.git/+/94f6b477 Introducing command-line interface tests (#3161)
 https://dart.googlesource.com/pub.git/+/3ba8134f More details from getExecutableForCommand (#3186)
 https://dart.googlesource.com/pub.git/+/a2dbcfff Shorthand syntax for hosted dependencies (#3133)
 https://dart.googlesource.com/pub.git/+/435e4e3f Shuffle analytics (#3185)

```

Diff: https://dart.googlesource.com/pub.git/+/78bc50c7833451c24e531713362e46fd50621ff0~..0035a40f25d027130c0314571da53ffafc6d973b/
Change-Id: Idfd7c382985d1ad3e3ad87a621dc79d3b74e898e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218620
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2021-10-29 13:05:39 +00:00
Sam Rawlins 6d276f9fd6 analyzer: Fix instantiated type parameter in function reference error
This fixes language/const/instantiated_function_constant_test

Change-Id: I06f42480f8a55de1c6d75b2b5845bcefb769fa78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218540
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-10-29 05:12:02 +00:00
Konstantin Shcheglov 132f16b3b0 Implement completion.getSuggestionDetails2
Change-Id: Ic4b39c723d0cf90936a1db3ad3716533e6e8ca79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218542
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-28 20:55:48 +00:00
Konstantin Shcheglov 61e60eefd2 Abort not-yet-imported suggestions on a new completion request.
Change-Id: Id08b7ca328253ea5190038d2204cbfb2015aac01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218541
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-28 20:23:31 +00:00
Johnni Winther 44e35b1daa [cfe] Check for misplaced type arguments on implicit creation expression
Change-Id: Ic3436f2bce0369d0efad9946cbbdae7c6bf334b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218400
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2021-10-28 19:21:39 +00:00
Konstantin Shcheglov ec1118ead7 Use CompletionBudget.defaultDuration
Change-Id: Ic4da5ac8b5d8dc9911feecdfa4a8ab4e2e4da778
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218524
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-28 18:17:48 +00:00
Konstantin Shcheglov 294aaab9c1 Use time budget in NotImportedContributor.
Change-Id: Ief0ef8185accd68c7b99132393fa0a4db6be31c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-28 17:37:18 +00:00
Konstantin Shcheglov e153f412cb Revert RemoveArgumentBulkTest changes.
Initial: https://dart-review.googlesource.com/c/sdk/+/217287

These changes require https://dart-review.googlesource.com/c/sdk/+/217280
which was reverted.

Change-Id: Ibd8b317f117f2d7e4bda694759d7cd10f537e9b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218523
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-28 17:29:48 +00:00
Konstantin Shcheglov 35d8514d01 Make --flutter-repository a required option for Flutter based benchmarks.
We can change FlutterAnalyzeBenchmark because it is not actually
run now, the benchmarking framework calls `flutter analyze` directly.
This class is just FYI.

Flutter completion benchmarks are not used yet, so we can change
them as well.

Change-Id: I1426df572b6c37160076785f9a5a4b742ce36221
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218521
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-28 17:26:28 +00:00
Konstantin Shcheglov 2cdaf7cf52 Fix completion tests on Windows.
Change-Id: Ie0dd2e1a2457fa64254c6fadb5308001eaf357dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218522
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-28 17:18:38 +00:00
Ben Konyi 7d3d835bc9 Reland "[ VM / Service ] Add lookupResolvedPackageUri and lookupPackageUri RPCs"
This reverts commit 711fdcc0de.

TEST=uri_mappings_lookup_test.dart

Change-Id: I0a548ef0b5f1f0f6bc23ec72e0fe7dafc244c5d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218520
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-10-28 17:16:49 +00:00
Kevin Moore 632f3428f3 Update dependencies in unpublished packages
TEST=No SDK affect. Just helping our outdated package tracking

Change-Id: I0d392694e9eb926f60667508b55094ffa208db18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218381
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2021-10-28 15:46:08 +00:00
Konstantin Shcheglov 5135547aad Use Duration for waitForResponses() from plugins.
Change-Id: I5cf1203559f601c0f5458e278a89b1fd83750ee7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-28 15:24:12 +00:00
Konstantin Shcheglov 9243b20dcf Remove TODO for replacementOffset/Length, use them.
Change-Id: I44c6e3f30ad29e3de7ab9a66ae2d18310a6315c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218328
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-28 15:20:28 +00:00
Danny Tuppeny 810dbd7fb2 [analysis_server] Fix dynamic registrations not occurring when onlyAnalyzeProjectsWithOpenFiles=true
Fixes https://github.com/Dart-Code/Dart-Code/issues/3638.

Change-Id: I2749210a209fb0321f4833cf39c4d5fea55b579b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218441
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-10-28 15:16:08 +00:00
Chloe Stefantsova ed0131bc7c [cfe] Change the order of hoisted initializers insertions
Change-Id: I61db6b57fffc11d62267b8648b4741a74d0a9f83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218440
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2021-10-28 12:35:28 +00:00
Chloe Stefantsova 7fb17818f7 [cfe] Handle argument hoisting in redirecting initializers
Part of https://github.com/dart-lang/sdk/issues/47451.

Change-Id: Ic3564833cf87d5ccfb8b43f589c241104ce6df61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217602
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2021-10-28 08:41:00 +00:00
Daco Harkes cb29cd3af9 [test/ffi] rename ffinative_test to ffi_test
It runs tests from the pkg/vm/testcases/transformations/ffi, where I'd
like to add ffi, but non-ffinative tests.

TEST=renames a test

Change-Id: I2c4128fd5ded154ab483b05d9002afdbb3dc33a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217642
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-10-28 06:53:39 +00:00
Siva Annamalai 711fdcc0de Revert "Reland "[ VM / Service ] Add lookupResolvedPackageUri and lookupPackageUri RPCs""
This reverts commit 6c6dd13b14.

Reason for revert: Still seeing test failures in some configurations

Original change's description:
> Reland "[ VM / Service ] Add lookupResolvedPackageUri and lookupPackageUri RPCs"
>
> This reverts commit aa25975644.
>
> TEST=uri_mappings_lookup_test.dart
>
> Change-Id: I311e3130bc14a392cfc4b5d81afb137505c5c202
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218324
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=bkonyi@google.com,asiva@google.com

Change-Id: Ia69d9cfd7b395f692679fdfd185ef757550104bf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218360
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-10-27 23:48:49 +00:00
Kevin Moore cc7fcb5f70 dev_compiler: migrate to pkg:lints
Change-Id: I0111e74d312f6d3aeebb80f017a4f48fc6186109
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218220
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2021-10-27 23:15:56 +00:00
Kevin Moore 83286de2a8 Allow pub get/upgrade to run on a number of packages in pkg/
Zero runtime affect to these unpublished packages
Allows using standard tools such as dart test, etc
Also allows better checking of dependency constraints

TEST=no effect on SDK build process

Change-Id: Ic6fbe6ce8f57724a87c058eccad64ce8e7473af1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218180
Auto-Submit: Kevin Moore <kevmoo@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2021-10-27 23:15:56 +00:00
Ben Konyi 6c6dd13b14 Reland "[ VM / Service ] Add lookupResolvedPackageUri and lookupPackageUri RPCs"
This reverts commit aa25975644.

TEST=uri_mappings_lookup_test.dart

Change-Id: I311e3130bc14a392cfc4b5d81afb137505c5c202
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218324
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-10-27 23:15:51 +00:00
Konstantin Shcheglov 0adfe513c0 Wait for completions from plugins with the remaining budget.
If we wait for a fixed time, then we would spend any time we have
already spent, plus this fixed time. We probably want to restrict
how much we spend in total.

Change-Id: I457774456d7bac7d9d110784afd087f4a3d540eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218323
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-10-27 22:11:38 +00:00
Konstantin Shcheglov 931121ee2e Create DartCompletionRequest using factory constructor.
Change-Id: I05d7b444329c0bae6d3cd259ed015746963bf737
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218327
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-27 22:10:07 +00:00
Konstantin Shcheglov afc0ff2048 Discover available files, filter by target and dependencies.
Change-Id: Iad72c1e8c4d1d9cd8482ecdaebb0e2d17e74b0d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218321
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-27 22:00:07 +00:00
Ben Konyi aa25975644 Revert "[ VM / Service ] Add lookupResolvedPackageUri and lookupPackageUri RPCs"
This reverts commit 3d0f937569.

Reason for revert: Failing AOT bots

Original change's description:
> [ VM / Service ] Add lookupResolvedPackageUri and lookupPackageUri RPCs
>
> Adds RPCs that allow for service clients to convert URIs from absolute
> paths to unresolved package URIs and vice-versa.
>
> Fixes https://github.com/dart-lang/sdk/issues/46631
>
> TEST=uri_mappings_lookup_test.dart
>
> Change-Id: I06e56e37dc0d4fe505527f8fb246c07caef5e058
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217744
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Jacob Richman <jacobr@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

TBR=jacobr@google.com,bkonyi@google.com,rmacnak@google.com,asiva@google.com

Change-Id: If36248efe05cb6ee96b4b07b246dbbbd3d1b3368
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218322
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-10-27 20:21:52 +00:00
Sam Rawlins 0da6894247 Implement Generic Function Instantiation via wrapping node
This is a re-land for https://dart-review.googlesource.com/c/sdk/+/217880.

The primary difference is the call-sites of
insertGenericFunctionInstantiation. There are more, and many more test
cases.

This is a non-breaking change (when analyzing code at language version
2.14 and earlier). If constructor-tearoffs is enabled (language version
2.15), then FunctionReference nodes are inserted, to represent generic
function instantiation. Constant evaluation can then use the
`typeArgumentTypes` to instantiate arbitrary function-typed
expressions.

If constructor-tearoffs is not enabled, generic function instantiation
continues to take place at a SimpleIdentifier, PrefixedIdentifier, or
PropertyAccess only, with constant evaluation using
SimpleIdentifier.tearOffTypeArgumentTypes.


Bug: https://github.com/dart-lang/sdk/issues/46020
Change-Id: Icf876cb6866bc1030e0cefaaafe221757d5b5639
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218221
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-10-27 19:25:35 +00:00
Ben Konyi 3d0f937569 [ VM / Service ] Add lookupResolvedPackageUri and lookupPackageUri RPCs
Adds RPCs that allow for service clients to convert URIs from absolute
paths to unresolved package URIs and vice-versa.

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

TEST=uri_mappings_lookup_test.dart

Change-Id: I06e56e37dc0d4fe505527f8fb246c07caef5e058
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217744
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jacob Richman <jacobr@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-10-27 18:59:17 +00:00
Kevin Moore 5e866bf841 Improve HTTP docs in dart:io
Recommend folks use pkg:shelf and/or pkg:http
Use async/await in code examples
Remove unneeded `new`

Change-Id: I87d192799cebd88fc0d11c03a7147848bc45efa2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217502
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Kathy Walrath <kathyw@google.com>
2021-10-27 18:55:17 +00:00
Konstantin Shcheglov d7718a934d Issue 47073. Inherit covariant-by-declaration from any candidate.
Initial: https://dart-review.googlesource.com/c/sdk/+/217081
Reverted: https://dart-review.googlesource.com/c/sdk/+/217288

Presubmit:
https://fusion2.corp.google.com/presubmit/tap/405776629/OCL:405776629:BASE:405789171:1635310230957:629680d7

Bug: https://github.com/dart-lang/sdk/issues/47073
Change-Id: I5458d60d0bf5cb88488ebd3fb21b0e45ab4ccfde
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218200
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-27 16:35:58 +00:00
Ben Konyi 4de9e805ed [ CLI ] Don't resolve paths as URIs for known SDK artifacts
Handles cases where the SDK is installed on a path which includes
percent encoded characters. The OS doesn't decode these characters, so
decoding them before trying to load a snapshot with said characters in
their path will result in files not being found.

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

TEST=pkg/dartdev/test/regress_46364_test.dart

Change-Id: I5f78e8a2049cc0c83555528fcc8f41be946141f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218082
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-10-27 16:34:00 +00:00
Konstantin Shcheglov 90f4b41eb0 Initial support for not yet imported libraries in getSuggestions2()
Change-Id: I0d1a4ab68be0e9a50cd67defffef85fae79f4971
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218183
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-27 15:25:27 +00:00
Clement Skau 0c0a72e3ae [vm/ffi] Adds unsafeCast to FfiNative return values.
This change replaces a `r as T` with `unsafeCast<T>(r)` to avoid
unnecessary type checking.
It is the responsibility of the native function to return the
expected type.

See discussion on https://dart-review.googlesource.com/c/sdk/+/218101

TEST=Updated expect file.

Change-Id: Ic6f0a642a4ffe60c421b1af1127cc1450dc93eec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218261
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2021-10-27 13:20:47 +00:00
Clement Skau 933055b142 [vm/ffi] Adds nullability to FfiNative closure.
This change makes the FfiNative closure inherit the nullability
of the associated Dart function.
Example:

  @FfiNative<Handle Function()>('MaybeStr')
  external String? maybeStr();

Generates a closure of type `() →  core::Object?`.

This enables @FfiNatives to return nullable types where they
previously would be forced non-nullable.

TEST=Updated expect file.

Change-Id: I85cf9f2f43749e97ab97779f911789034e6b9ab1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218101
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2021-10-27 10:25:38 +00:00