Commit Graph

9512 Commits

Author SHA1 Message Date
Samuel Rawlins 5050f31b29 Revert "analyzer: Mark implicit-casts and implicit-dynamic as deprecated"
This reverts commit 6a54fdd46e.

Reason for revert: broke flutter-analyze

Original change's description:
> analyzer: Mark implicit-casts and implicit-dynamic as deprecated
>
> Also add a fix which replaces 'implicit-casts' with 'strict-casts' and
> a fix which replaces 'implicit-dynamic' with 'strict-raw-types'.
>
> Fixes https://github.com/dart-lang/sdk/issues/47902
>
> Change-Id: I293c3c1fd671ac85c12f9c050465b4d77632f241
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224800
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Reviewed-by: Samuel Rawlins <srawlins@google.com>
> Commit-Queue: Samuel Rawlins <srawlins@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Ib2e9492716d3ff6da4fa4e1c64fd658451b16d88
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239008
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-03-27 16:56:01 +00:00
Daco Harkes 532c116cd2 [vm] Implement NativeFinalizer
This CL implements `NativeFinalizer` in the GC.

`FinalizerEntry`s are extended to track `external_size` and in which
`Heap::Space` the finalizable value is.

On attaching a native finalizer, the external size is added to the
relevant heap. When the finalizable value is promoted from new to old
space, the external size is promoted as well. And when a native
finalizer is run or is detached, the external size is removed from the
relevant heap again.

In contrast to Dart `Finalizer`s, `NativeFinalizer`s are run on isolate
shutdown.

When the `NativeFinalizer`s themselves are collected, the finalizers are
not run. Users should stick the native finalizer in a global variable to
ensure finalization. We will revisit this design when we add send and
exit support, because there is a design space to explore what to do in
that case. This current solution promises the least to users.

In this implementation native finalizers have a Dart entry to clean up
the entries from the `all_entries` field of the finalizer. We should
consider using another data structure that avoids the need for this Dart
entry. See the TODO left in the code.

Bug: https://github.com/dart-lang/sdk/issues/47777

TEST=runtime/tests/vm/dart(_2)/isolates/fast_object_copy_test.dart
TEST=runtime/vm/object_test.cc
TEST=tests/ffi(_2)/vmspecific_native_finalizer_*

Change-Id: I8f594c80c3c344ad83e1f2de10de028eb8456121
Cq-Include-Trybots: luci.dart.try:vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-ffi-android-debug-arm64c-try,dart-sdk-mac-arm64-try,vm-kernel-mac-release-arm64-try,pkg-mac-release-arm64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-win-debug-x64c-try,vm-kernel-win-debug-x64-try,vm-kernel-precomp-win-debug-x64c-try,vm-kernel-nnbd-win-release-ia32-try,vm-ffi-android-debug-arm-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-mac-debug-x64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,benchmark-linux-try,flutter-frontend-try,pkg-linux-debug-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-gcc-linux-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236320
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-03-26 09:41:21 +00:00
Brian Wilkerson 3b9906d048 Remove unneeded ignore comments in analyzer
Change-Id: I4e9ccbc2f45d8b547d63b607da11c1b96366f84a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238981
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-03-26 00:06:50 +00:00
Paul Berry 83bea5cfbb Do an extra round of type inference before resolving deferred closures.
The order of operations for type inference of a generic invocation is
now:

1. Create some constraints on type parameters by trying to match the
   return type of the invocation target as a subtype of the incoming
   type context.  (For a constructor invocation, the return type of
   the invocation target is considered the raw uninstantiated type of
   the class enclosing the constructor declaration.)

2. Downwards inference: partially solve the set of type constraints
   accumulated in step 1, to produce a preliminary mapping of type
   parameters to type schemas.

3. Recursively infer all arguments to the invocation, except that if
   experimental feature `inference-update-1` is enabled, skip any
   arguments that are function literals (a.k.a. "closures").  Obtain
   the type contexts for the recursive inference by substituting the
   preliminary mapping (from step 2) into the corresponding parameter
   types of the invocation target.  For each argument that is
   recursively inferred, create additional constraints on type
   parameters using the resulting static type.

4. If no arguments were skipped during step 3, go to step 7 (this
   always happens if `inference-update-1` is disabled).

5. Horizontal inference: partially solve the set of type constraints
   accumulated so far, to produce an updated preliminary mapping of
   type parameters to type schemas.

6. Recursively infer all of the invocation arguments that were
   previously skipped.  As in step 3, obtain the type contexts for the
   recursive inference by substituting the preliminary mapping (this
   time from step 5) into the corresponding parameter types of the
   invocation target.  Again, for each argument that is recursively
   inferred, create additional constraints on type parameters using
   the resulting static type.

7. Upwards inference: solve the set of type constraints accumulated so
   far, to produce a final mapping of type parameters to types.  Check
   that each type is a subtype of the bound of its corresponding type
   parameter.

8. Check that the static type of each argument is assignable to the
   type obtained by substituting the final mapping (from step 7) into
   the corresponding parameter type of the invocation target.

9. Finally, obtain the static type of the invocation by substituting
   the final mapping (from step 7) into the return type of the
   invocation target.

This addresses simpler cases of
https://github.com/dart-lang/language/issues/731.  Note that if
experimental flag `inference-update-1` is disabled, the behavior is
unchanged.

Note that steps 2 and 5 use the same algorithm as each other (they
only differ in how many type constraints have been accumulated so
far), so I've renamed the function that performs it from
`downwardsInfer` to `partialInfer`.

Change-Id: I10d3288d4f4ba9e2b6bc18409186ddc67ca2ee9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238881
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-03-25 22:07:50 +00:00
Brian Wilkerson 5a542ce2b1 Enable links to newly published documentation
Change-Id: Iace45474f783b833d7095d55259a9e285bf554b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238460
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-03-25 18:18:00 +00:00
Paul Berry 5c0e0922d0 Defer analysis of closure arguments when inference-update-1 is enabled.
In order to address https://github.com/dart-lang/language/issues/731
(improved type inference for `fold` etc.) we're going to need to
sometimes defer analysis of invocation arguments that are closures, so
that closure parameters can have their types inferred based on other
parameters.  To avoid annoying the user with inconsistent behaviors,
we defer analysis of closures in all circumstances, even if it's not
necessary to do so for type inference purposes.

This has a minor user-visible effect: if an invocation contains some
closures and some non-closures, any demotions that happen due to write
captures in the closures are postponed until the end of the
invocation; this means that the write-captured variables remain
promoted for other invocation arguments, even if those arguments
appear after the closure.  This is safe because there is no way for
the closure to be called until after all of the other invocation
arguments are evaluated.  See the language tests in this CL for
details.

Note that this change only has an effect when the experimental feature
`inference-update-1` is enabled.

Change-Id: I283fc5eb07af2aeca0a06d523011d8c4617fbad7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237720
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-03-25 16:40:10 +00:00
Sam Rawlins 6a54fdd46e analyzer: Mark implicit-casts and implicit-dynamic as deprecated
Also add a fix which replaces 'implicit-casts' with 'strict-casts' and
a fix which replaces 'implicit-dynamic' with 'strict-raw-types'.

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

Change-Id: I293c3c1fd671ac85c12f9c050465b4d77632f241
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224800
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-03-25 14:58:50 +00:00
Brian Wilkerson 61954676ea Add code style options for code generation
Change-Id: Ibc5087aeb88965488502cca74923df6d7a2b185e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238761
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-03-25 04:47:31 +00:00
Konstantin Shcheglov 143fe67673 Make fields in CompilationUnitElementImpl final and/or non-nullable.
Change-Id: I604ad776196fa90bccf2ba06fa282fa0e7979d18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238740
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-25 01:20:19 +00:00
Paul Berry b07c7798ca Push logic for constraining argument types into InvocationInferrer._visitArguments.
This allows us to avoid some redundant computation (we don't have to
match up arguments to the corresponding parameters twice).  It also
paves the way for supporting improved type inference of `fold`
(https://github.com/dart-lang/language/issues/731) because it will
allow us to resolve some arguments (gathering more constraints), then
compute a new set of inferred types, then resolve more arguments, and
so on, rather than forcing us to do all the constraint gathering at
the end.

Change-Id: I67d8b8228390ced14281145a4614f66c8e3c7e73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238622
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-03-24 20:51:21 +00:00
Brian Wilkerson 7be81a875a Move AnalysisOptions out of src
In the process, I removed 'useFastaParser' from both the public API and
the implementation class. I also removed 'enableTiming' from the public
API.

The other getters were left because they seem like reasonable options
for plugins to want to query. If you disagree, we can address them in a
future CL.

Change-Id: Ia5630b71190dd68bcd66199baa0c05846fcc37b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238661
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-03-24 20:43:19 +00:00
Konstantin Shcheglov 0952bcc9c3 Set placeholder LineInfo when to informative data.
Bug: https://buganizer.corp.google.com/issues/226516358
Change-Id: I3e99819d78b3904602b61fa9e498ae14e8e04a5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238623
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-03-24 20:11:12 +00:00
Ahmed Ashour 539e14296d FINAL_NOT_INITIALIZED_CONSTRUCTOR not to be reported for static fields.
Fixes #48180

Change-Id: I3c296fb6e307b5dd6cf0dd53cbc7297a88146e81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238358
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-03-24 19:12:21 +00:00
Konstantin Shcheglov cbcbf898cf Prepare to publish analyzer 3.4.1 and _fe_analyzer_shared 38.0.0
Bug: https://github.com/dart-lang/sdk/issues/48658
Change-Id: I1d3d531cf3550a657a1cdd9d7a29467e4c92df0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238620
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-24 17:44:29 +00:00
Paul Berry f3494f07e5 Remove unnecessary call to _recordIdenticalInfo.
We don't need to call this method from
`InvocationInferrer.resolveInvocation`, because resolution of a call
to `identical` always uses the derived class
`MethodInvocationInferrer`, which inherits proper handling of
`identicalInfo` from `FullInvocationInferrer.FullInvocationInferrer`.

Change-Id: Ic511befee498bd241d2d33240b4b388a0ed74be4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238601
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-03-24 16:06:32 +00:00
Paul Berry 3897cd0157 Push substitution logic down into _visitArguments.
Rather than compute a preliminary `invokeType` prior to calling
`_visitArguments`, we just compute the necessary substitution to go
from `rawType` to `invokeType`, and let `_visitArguments` apply it
when needed.  This will improve efficiency when I add support for
better type inference of `fold` (see
https://github.com/dart-lang/language/issues/731), because it will
allow multiple passes of type inference without having to recompute
`invokeType` each time.  Also, it gives `_visitArguments` access to
the `rawType`, which I will take advantage of in a follow-up CL to
make constraint generation happen at a more reasonable time.

Change-Id: I2ecabac10c0ec91fc994b4cf2d8f33a5b532a99e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238600
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-03-24 16:02:13 +00:00
Paul Berry 2dbafcc40c Split InvocationInferrer.resolveInvocation into two methods.
`_visitArguments` handles walking through the argument list,
recursively performing type inference on each argument.
`_recordIdenticalInfo` handles the necessary integration with flow
analysis to support type promotion via `identical(variable, null)`
tests.

We no longer call `super.resolveInvocation` from the overriden method
`FullInvocationInferrer.resolveInvocation`, but instead call
`_visitArguments` and `recordIdenticalInfo` directly.

This is part of a larger arc of work to enable better type inference
of `fold` and similar methods (see
https://github.com/dart-lang/language/issues/731).  It will allow me
to add some additional parameters to `_visitArguments` that relate to
type inference, without complicating the API of `resolveInvocation`.

Change-Id: I6d8ac1af4cfbadf86d5fbfd4ba1b4652707ecfdf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238505
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-03-24 15:57:32 +00:00
Konstantin Shcheglov e773e6e713 Issue 48546. Copy the same ElementAnnotation instances for multiple local variables.
Bug: https://github.com/dart-lang/sdk/issues/48546
Change-Id: Ib03c66a38e15dfc537ba992b2f636a32cfa24330
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238464
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-24 04:49:01 +00:00
Sam Rawlins 434e1b70e8 Add many cases for valid @useResult uses
All of the changes here should be non-breaking; they should only result
in _fewer_ diagnostics.

New cases of "check the parent": parent is
* BinaryExpression
* ForElement
* IfElement
* IndexedExpression
* PostfixExpression
* SpreadElement

New cases of a "real use": parent is
* AssertInitializer
* AssertStatement
* ConstructorFieldInitializer
* ForEachParts
* ForEachPartsWithDeclaration
* ForLoopParts
* IfStatement
* ThrowExpression
* WhileStatement
* YieldStatement

Bug: https://github.com/dart-lang/sdk/issues/47685
Change-Id: Ib3fa216d45d01a728f73795b32b52f204eb140e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238264
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-03-23 22:54:01 +00:00
Paul Berry 42339a228b Simplify InvocationInferrer by passing in argumentList as a parameter.
This means we no longer need the _getArgumentList method, which in
turn means we can remove three derived classes whose only purpose was
to provide implementations of it.

Change-Id: Ia2fc14fdd27871cb70279a13cc8b6ca27f97ac8c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238360
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-03-23 17:25:11 +00:00
Konstantin Shcheglov 0b12e3e936 Add FunctionElement.isDartCoreIdentical
Change-Id: Ic1d2b17b4a6a41148f02b0f5e6b88dd9ef428bb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238303
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-23 15:30:02 +00:00
Paul Berry ba68d0dfee Remove redundant null check on rawType.
`FullInvocationInferrer.resolveInvocation` only sets `inferrer` to
non-null in the event that `rawType` is non-null.  So inside an `if
(inferrer != null)` block we can safely assume `rawType` is non-null.

Change-Id: I05a56cd2f54d9658877cf24ed8ec4493eabc42d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238381
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-03-23 15:26:21 +00:00
Brian Wilkerson a5ca4b57fe Add documentation for the newest diagnostics
Change-Id: Ia649012c061f5d155d0a045ddb4bf72e61ac0f46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238164
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-03-23 13:42:20 +00:00
Paul Berry b9ed13c76f Rework flow analysis API for operator == and identical.
In order to address https://github.com/dart-lang/language/issues/731
(improved inference for fold etc.) I'm going to need to sometimes
change the order in which the resolution process visits invocation
arguments.  As a preparatory step, this change reworks the flow
analysis API so that it doesn't depend on the order in which arguments
to `identical` are visited.

Bug: https://github.com/dart-lang/language/issues/731
Change-Id: Ic886bb44537523a1cab75762925e62d46e33f290
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237933
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-03-22 22:49:10 +00:00
Paul Berry 7f12ab9d87 Rework handling of identical in the InvocationInferrer class hierarchy.
Rather than have a separate subclass of `MethodInvocationInferrer` to
handle `identical`, with a method override for `_iterateArguments`
that makes calls to flow analysis in between handling arguments, we
now have an `_isIdentical` method to determine whether the flow
analysis calls are needed, and the logic for calling into flow
analysis is directly in the base class implementation of
`resolveInvocation`.

This change will be necessary to support
https://github.com/dart-lang/language/issues/731 (improved type
inference for functions like `Iterable.fold`) because it will require
changing the order in which we visit arguments sometimes, so the
technique of overriding `_iterateArguments` won't work anymore.

Bug: https://github.com/dart-lang/language/issues/731
Change-Id: I77bd20b10494da941a1bc8b5fc63968c6c2c68cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238120
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-03-22 21:56:20 +00:00
Konstantin Shcheglov f204148019 Document that applyPendingFileChanges() is required after changeFile().
Change-Id: I3010902083186cb3e8232683aaa8dc9114f53631
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238182
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-03-22 17:50:26 +00:00
Paul Berry 69d66d9bd5 Add experimental flag inference-update-1.
This is intended to be an umbrella for several features we plan to
implement during Q2:

- Improved type inference for methods like `Iterable.fold`
  (https://github.com/dart-lang/language/issues/731).

- Promotion of final fields
  (https://github.com/dart-lang/language/issues/2020).

- Other type inference and type promotion issues as time allows.

Change-Id: I31db3c15d3f6a2654650f056866c61f3d1023600
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237924
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-03-22 14:25:48 +00:00
Konstantin Shcheglov b14c3c3607 Add async methods for Cider.
Change-Id: I8e7ad68af11933748e40899789169fdcf58124e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238003
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-22 00:26:57 +00:00
Konstantin Shcheglov 3d69c3c0c4 Restore sync file methods in AnalysisSession.
There are clients, like `built_value` that cannot be updated.

Change-Id: I27371018039f22cd7ca2cb82b30ec33469aa6e4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238002
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-21 23:27:57 +00:00
Konstantin Shcheglov 171026be40 Create TypeProvider and TypeSystem before linking, if possible.
Change-Id: Ib1ce59c9a640a34e6bbe204f71c3ff1bad43500f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237858
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-21 22:12:23 +00:00
Konstantin Shcheglov 27f5f486f6 Make link() async, propagate async.
Change-Id: Ie74c8acdf2641e834d41e56200f33075e6987236
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237928
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-21 22:11:57 +00:00
Sam Rawlins ab22a8dd8c Avoid single cascades, unnecessary interpolations, and exposing private types
* Make `MicroContextObjects` constructor private, which is not used
  outside the library.
* Remove unused `analysisContext2` constructor parameter.
* Make `tryMatchSubtypeOf` private, which requires a parameter of
  private type.
* Make `_FileStateFiles` public, as it is used outside the library.
* Return empty for void-typed functions.

Change-Id: If67a69effdbbaed2eb364788e52eeb60270a0c19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237855
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-03-21 18:12:47 +00:00
Paul Berry fdbd5d8c5d Flow analysis: make executableDeclaration_enter's isClosure parameter named.
No functional change.  This is a minor readability improvement that
I'd like to put in place before doing more work on language issue #731
(Inference should flow information between arguments in a generic
function call).

Bug: https://github.com/dart-lang/language/issues/731
Change-Id: Ia25540cd80762a74ac0d0a4d226a51eda7e09a4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237920
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-03-21 17:33:19 +00:00
Sam Rawlins 9a79d61c36 Do not rename method parameter names in overrides
Change-Id: I8c2f91a56c767c89dc4d0bea22b64dec147870c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237852
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-03-21 17:32:22 +00:00
Konstantin Shcheglov b4d339f9d6 Revert "Run macro types phase."
This reverts commit eb95543629.


Revert "Add the macro unit into 'units' of LibraryBuilder."

This reverts commit 2670218aea.

Change-Id: I7d4964264b8be92cfa98334fde0579eeb989c94b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237960
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-21 17:24:19 +00:00
Sam Rawlins a4929aed29 Prefer initializing formals in analyzer
Change-Id: I3bc4c3511bb4c9c1d700710894d57ea22379b0c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237850
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-03-20 22:01:26 +00:00
Konstantin Shcheglov 2670218aea Add the macro unit into 'units' of LibraryBuilder.
So, we should resolve references, types in it.
Not tested yet.

Change-Id: I5264d9b9b8dbb6e05188a2dad961fcd7b87cfc98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237841
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-18 23:17:42 +00:00
Sam Rawlins 843a31fe45 Prefer string interpolations; other small fixes for lints 2.0.0
Change-Id: Ie66c42ac738adbcf07d0b7c5ccc77e34975008c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237801
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-03-18 22:13:21 +00:00
Konstantin Shcheglov eb95543629 Run macro types phase.
The very first version, many improvements to be done later.

Change-Id: If78efba1ab0d06aaea6f3c7525fcd00a39c18459
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237768
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-18 20:22:41 +00:00
Sam Rawlins d5cc53a1b8 Prefer for-loop over forEach; other little fixes
These linter fixes help prepare analyzer for lints 2.0.0

Change-Id: Ic942fa367965edac479b917cbbb601b30da8b53c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237766
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-03-18 03:37:47 +00:00
Konstantin Shcheglov e253d467ae Fix for reporting UNUSED_ELEMENT_PARAMETER when used via super-formal.
Change-Id: I334b2b30dd29ae61fb7fbf3bf2af8e68cf969a3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237767
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-18 02:14:38 +00:00
Konstantin Shcheglov f1a753a338 Don't look for .packages while creating Workspace.
Change-Id: I8903f21caad6d0920dc2dca8f2a20137540198b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237722
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-17 17:57:13 +00:00
Konstantin Shcheglov 592bfc0174 Remove newDotPackagesFile(), related from file_paths, context location / manager.
Change-Id: I0f3c067b47e4d0f6171b8a26d34fc173df983c29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237637
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-17 17:40:16 +00:00
Konstantin Shcheglov 073db61a4e Add implicit arguments for super-formal parameters during constant evaluation.
Change-Id: I1150ebfc9bcdad53ffb38504cff97c2ea9aea5cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237721
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-17 17:39:16 +00:00
Jens Johansen fd4e41a7af [parser-ish] Better errors on invalid unicode escapes
https://github.com/dart-lang/sdk/issues/48542

Change-Id: Icbdcc939a93c737914091c00aaefa3c4efb2dde0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237364
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-03-17 13:57:45 +00:00
Konstantin Shcheglov 963bd7c165 Add AnalysisContext.changeFile()
Change-Id: I42d215e872322cace019bc64f04a74d883e9849e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237628
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-17 00:33:34 +00:00
Konstantin Shcheglov e2f615fa9d Remove the temporary SummaryDataStore constructor.
Change-Id: Id14fc6502bb0885b6843748a1ed833656e1a2df9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237625
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-16 23:53:45 +00:00
Konstantin Shcheglov 5bd060484b Fix order of inference for super-formal parameters.
Change-Id: Ie98663d1788b14d4622e692b446756d8c1c9b763
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237629
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-03-16 20:31:04 +00:00
Konstantin Shcheglov eea52d35f8 Issue 48583. Inherit evaluationResult in DefaultSuperFormalParameterElementImpl.
Bug: https://github.com/dart-lang/sdk/issues/48583
Change-Id: I6217adb5d1e96d2fbb40e4033b9ed62025cd60ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237622
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-16 18:14:14 +00:00
Konstantin Shcheglov 1a1701c2b5 Build macro kernels.
They are not used yet.

Change-Id: I7849bf845f161f5c48e8ec9ded5900a3486148c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237483
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-16 16:55:14 +00:00