Commit Graph

10502 Commits

Author SHA1 Message Date
Konstantin Shcheglov e6dbabd477 Issue 45161. Ignore YAML parsing exceptions in analysis_options.yaml
Bug: https://github.com/dart-lang/sdk/issues/45161
Change-Id: I14169cdb0f39e95612a21266cc7e6cf72141e2d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188960
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-04 01:38:15 +00:00
Paul Berry 8be535350d Flow analysis: improve handling of types in "why not promoted" logic.
This CL plumbs the types of `this` and property get expression from
the CFE and analyzer into flow analysis, so that flow analysis will be
able to create more accurate "why not promoted" information for those
expression types.  This made it possible to eliminate a clumsy aspect
of the previous implementation, namely that we would consider a
promotion attempt like `if (x.y == null) return;` as an attempt to
promote the type of `x.y` to `Object`; now we compute the type the
user is actually trying to promote to, so we will be able to generate
more accurate "why not promoted" messages.

Bug: https://github.com/dart-lang/sdk/issues/44898
Change-Id: I67f9fc59e72103194a1ea6b1c4dfeae8aeb194a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187064
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-03-03 23:16:55 +00:00
Konstantin Shcheglov 034fab2046 Skip symbolic link tests on Windows.
We need at least Windows 10, after 2016 to support it.

Change-Id: I1f1a3df95f70b770d434343bf5f66ba9ab33c6a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-03 22:21:24 +00:00
Konstantin Shcheglov beb216035f Regenerate diagnostics.md
R=brianwilkerson@google.com

Change-Id: Ib5a1d21905d403304bdf3312894ed3d069c1ee66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188821
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-03 21:21:16 +00:00
Konstantin Shcheglov 7d67f3ee5c Rewrite analyzer_cli batch mode using AnalysisContextCollection.
Change-Id: I0765df20f24ebf37b49a8a622a072e4d67f74845
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188582
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-03 19:30:24 +00:00
Konstantin Shcheglov d7dc1bfc45 Don't (re)discover analysis contexts in ContextBuilder.
Change-Id: I4079ec180f759c29ac51af989de30751673f6432
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188584
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-02 22:35:17 +00:00
Konstantin Shcheglov a4529db02b Explicitly analyzed directories and files are analyzed even if excluded by globs.
Change-Id: I6640f372d8494498facb5ad68bb8bf703aeb0e58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188342
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-03-02 17:29:04 +00:00
Konstantin Shcheglov 4128d005b7 Remove migration hints from analyzer/.
Change-Id: I9d3f529b8a2ae7e78dfdd913e8b79cb1a39c891c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188380
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-02 17:23:02 +00:00
Parker Lougheed 81c6f332e7 Quit earlier in dead code visit if we're in the same dead code range.
Change-Id: I4460b8d524e87431816b29079ced533012e534f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188260
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-03-01 15:02:49 +00:00
Konstantin Shcheglov 3268bd0429 Fix for infinite loop in _isExcluded() on Windows.
Bug: https://github.com/flutter/flutter/issues/76911
Change-Id: I7115bcfec7ed736e12ca0c01739bf1738c4ceab9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188200
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-02-27 20:54:28 +00:00
Samuel Rawlins 7aa8d96462 Revert "Report unused system libraries with shadowed elements"
This reverts commit 4c018c7013.

Reason for revert: Breaking dart2js_unit_tests:
https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8854208023803884128/+/steps/dart2js_unit_tests/0/stdout



Original change's description:
> Report unused system libraries with shadowed elements
>
> Fixes https://github.com/dart-lang/sdk/issues/45028
>
> PR out for flutter: https://github.com/flutter/flutter/pull/76436
>
> Change-Id: I63b22934b6ba969ec1a8ea4d282b2e8770d8c207
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186042
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>

Change-Id: I63987443d2a57dbd0a3d22fa433658476074bf5d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188060
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-02-26 20:18:39 +00:00
Paul Berry 085529d58d Flow analysis: hardcode allowLocalBooleanVarsToPromote flag.
This flag was being kept around in case the corresponding feature
(https://github.com/dart-lang/language/issues/1274) wound up having
bugs and needed to be switched off.  It's now had sufficient bake time
that we no longer need the flag.

Removing the flag allows us to remove a bunch of flow analysis code
that's no longer needed.

Bug: https://github.com/dart-lang/language/issues/1274
Change-Id: Ib91fa09a560bb0ebc6bff280ffc37d6037816ef9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187981
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-02-26 18:28:57 +00:00
Paul Berry 265f6fca2d Flow analysis: Fix "why not promoted" functionality for implicit this
Bug: https://github.com/dart-lang/sdk/issues/44898
Change-Id: Ief6014c34aef329e5f408916f5d8ffe14a62effd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187940
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-02-26 18:14:47 +00:00
Sam Rawlins 4c018c7013 Report unused system libraries with shadowed elements
Fixes https://github.com/dart-lang/sdk/issues/45028

PR out for flutter: https://github.com/flutter/flutter/pull/76436

Change-Id: I63b22934b6ba969ec1a8ea4d282b2e8770d8c207
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186042
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-02-26 17:33:27 +00:00
Konstantin Shcheglov 8833cbed7d Fix for ContextRoot.isAnalyzed() when the root is in a dot-folder.
Change-Id: I5f343aa9bdd24a76e0521ec63ac24bf2679ff42f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187760
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-26 00:41:28 +00:00
Konstantin Shcheglov bf4a65cb62 Cache resolved files in FileResolver.
Change-Id: I3df19bb31e962ff6666e3c677d696315f8e8d8e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187720
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-25 23:46:24 +00:00
Konstantin Shcheglov 721ecfd63a We don't have any language features with the version before 2.6, so 2.2.2 is not important anymore.
Change-Id: I01cd35e5eccd47ae0e1638e881fa3b84d5f0a102
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187660
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-25 23:18:54 +00:00
Konstantin Shcheglov 49642ffaa9 Prepare to publish analyzer 1.1.0 and _fe_analyzer_shared 17.0.0.
Change-Id: I8a79e77d70ad780f5c5b3c3b6cc08f993a5ff16e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187560
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-25 20:59:57 +00:00
Konstantin Shcheglov f4bf9288cf Rename newAnalysisOptionsYamlFile() and newDotPackagesFile()
Change-Id: I1d11d5c8a7e7fc4f965cd797471dc84a5572fe9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187541
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-25 20:12:46 +00:00
Paul Berry 7d4da6691b Flow analysis: add "why not promoted" functionality for this
Bug: https://github.com/dart-lang/sdk/issues/44898
Change-Id: Ia42db3d9d84d7815e61444990805048c50d1c179
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187063
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-02-25 19:53:28 +00:00
Konstantin Shcheglov 34bec2f1a5 Deprecate AnalysisDriver.contextRoot
Change-Id: I2dfb7f2f751e3c3ba7cdc11c94b9dfa5ddd35670
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-25 19:35:11 +00:00
Konstantin Shcheglov 0039c061c9 Use ContextRoot.analyzedFiles() to find packages in available declarations.
Change-Id: I8828881af7e1cf55233797644ba411842654d62a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-25 19:27:36 +00:00
Konstantin Shcheglov daef0206d8 Remove AnalysisEngine.processRequiredPlugins()
Change-Id: I1b93729dea3e9d20c132fcdc523e6b1c3d40b0f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187540
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-25 19:27:06 +00:00
Konstantin Shcheglov 959adec89d Deprecate FunctionTypeAliasElement.
Change-Id: I52b49ecadc7217416341b7d7474ded5b36a8ca73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185980
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-25 19:08:36 +00:00
Konstantin Shcheglov d15cca43f2 Update ContextRoot to consider any resource in .name folder as excluded.
Change-Id: I815fdf641e102fcea883cb0eed479678f5e9fa2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187501
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-25 18:56:26 +00:00
Danny Tuppeny 526e191a57 [analyzer] Return isQualified=true for the name of a constructor
Fixes https://github.com/dart-lang/sdk/issues/45105.

Change-Id: Ic7878bd14e6b9b9ee522b5b7d91f25137ab6f31f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187401
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-02-25 17:00:41 +00:00
Konstantin Shcheglov 46e4363df5 Enforce lint: always_use_package_imports
Change-Id: Ib7c9f2b4fe3d3d1a874f97f73def6ba1ffaf911e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187360
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-25 16:57:16 +00:00
Konstantin Shcheglov d54c201932 Fix handling of circular links in ContextRootImpl and ContextLocatorImpl.
Change-Id: Ib1de5a9f6bbf13e72024ddae6c83d3a73dcf24a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186980
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-25 06:01:00 +00:00
Konstantin Shcheglov 8b1c6632c5 Move remaining of file_paths from ContextLocatorImpl.
Change-Id: I7f2362494af731657e59f1189d68790f71d0fc2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187200
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-25 06:00:40 +00:00
Konstantin Shcheglov a629b48fdc Remove file name constants from AnalysisEngine.
Change-Id: I3457973212e704a0fedee20db17956c017ec91ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-25 05:52:56 +00:00
Konstantin Shcheglov 925df4601b Fix API signature computation when 'static' token moves.
Change-Id: Ice82e8cd06bd4fc5634c9aa8f8e9828e3b79a696
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187300
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-25 05:24:25 +00:00
Konstantin Shcheglov fd81b73e67 Replace AnalysisEngine.isDartFileName() with file_paths.isDart()
Change-Id: Icf5d524945ffdb7087b96555968804946b4e5af4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187062
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-24 21:03:24 +00:00
Konstantin Shcheglov 4366ff1afd Tests and fixes for resolveSymbolicLinksSync()
Change-Id: Ic4266f4ad1f46e405e22986e3660a3889ec7016c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187060
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-24 21:02:04 +00:00
Sam Rawlins f32575e43a analyzer: stop mixing WithNullSafety into tests extending PubPackageResolutionTest
Bug: https://github.com/dart-lang/sdk/issues/44666
Change-Id: I01aa8a5908b8a2f195859c4c9fd99e3127249e29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-02-24 17:41:44 +00:00
Sam Rawlins 7718eb1163 analyzer: Remove unused enumElement testing function
Found while looking at call sites to TypeSystemImpl, which I am changing for
generic function types as type arguments.

Change-Id: I6c47f7cdcbe3b2f7051a77484ed904af8bfc67dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185960
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-02-24 14:40:54 +00:00
Daco Harkes d45fd0f9d5 [vm/ffi] Support inline arrays in Structs
Adds support for single dimension inline arrays in structs. Multi-
dimensional arrays will be supported in a future CL.

This CL adds:
- CFE static error checks for inline arrays.
- CFE transformations for inline arrays.
- VM consumption of inline array fields for NativeType.
- Test generator support for inline arrays + generated tests.

Previous CLs added support for inline arrays in:
- analyzer https://dart-review.googlesource.com/c/sdk/+/183684
  - updated in this CL to new API.
- ABI calculation https://dart-review.googlesource.com/c/sdk/+/183682

Closes: https://github.com/dart-lang/sdk/issues/35763

Open issue: https://github.com/dart-lang/sdk/issues/45101

CFE transformations are tested with expectation files:
TEST=pkg/front_end/testcases/(.*)/ffi_struct_inline_array.dart

Trampolines and CArray API are tested with end-to-end Dart tests:
TEST=tests/ffi(_2)/(.*)by_value(.*)test.dart
TEST=tests/ffi(_2)/inline_array_test.dart

Compile-time errors (both CFE and analyzer) are tested in:
TEST=tests/ffi(_2)/vmspecific_static_checks_test.dart

Change-Id: I014c0e4153f1b885638adce80de6ab3cac8e6bb2
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,analyzer-analysis-server-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183640
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2021-02-24 13:02:45 +00:00
Konstantin Shcheglov 1b1e853be4 Remove ContextBuilder.onCreateAnalysisDriver.
It was supposed to be 'temporary plugin support', and I believe we
have a replacement.

Change-Id: I7c6482fa257bee7a7c5c41c47d537b00e8f3ac69
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-24 06:56:32 +00:00
Konstantin Shcheglov ab31c14841 Fixes for MemoryResourceProvider Folder.exists/getChildren() and links.
Bug: https://github.com/dart-lang/sdk/issues/44501
Change-Id: I60a79474111e56ebece3d9df3fe9281f6e3fcc06
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186800
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-24 06:48:29 +00:00
Sam Rawlins 242dd97125 analyzer: Combine non-function-typedef test classes with null-safety test classes
In each file, test cases were simply moved, and not changed at all. No test
cases are removed. None are added.

Bug: https://github.com/dart-lang/sdk/issues/44666
Change-Id: I7566602f53a234b34e3dc54176ac9b80139f444b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186761
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-02-24 03:45:27 +00:00
Sam Rawlins b485114c32 analyzer: update two test classes to use null safety
Bug: https://github.com/dart-lang/sdk/issues/44666
Change-Id: I7db26be235d3911b6c88b199df874da1ee2d552e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186760
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-02-24 02:41:57 +00:00
Paul Berry 588fadcd49 Flow analysis: expand analyzer support for "why not promoted" messages.
This CL adds support for the following scenarios to the analyzer:

- Attempt to use a non-promoted nullable expression as the iterable of
  a for-in loop

- Attempt to use a non-promoted nullable expression as the argument of
  a `yield *` statement

- Attempt to implicitly invoke `.call` on a non-promoted nullable
  expression

- Attempt to use a non-promoted nullable expression as the argument of
  a spread operator (`...`) that is not null-aware

Some of these cases are already handled by the CFE.  Others will be
addressed in a follow-up CL.

Change-Id: I3cf31b1496e1bd92fdd3f8192f04c98dff15077c
Bug: https://github.com/dart-lang/sdk/issues/44898
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186320
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-02-23 17:51:16 +00:00
Konstantin Shcheglov 98c83633a2 Use shared FileContentOverlay in AnalysisContextCollection to ensure content sharing.
This improves performance, and it looks that this might be the issue
that causes Golem to timeout today.

Change-Id: I7a71fb3f6829f55205d8f7fc028245d529501389
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186540
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-23 06:03:29 +00:00
Konstantin Shcheglov f1094d5c3a Use newPubspecYamlFile() to create pubspec.yaml files
Change-Id: I181a3f3f14810019731201bf43e27befa7bc5481
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186420
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-22 21:32:00 +00:00
Sam Rawlins 1a1a199f40 analyzer: Fix ambiguous import test regarding system libraries
Bug: https://github.com/dart-lang/sdk/issues/45057
Change-Id: I693c4560e563d982937c8059c26c0cfcb5eef590
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185981
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-02-22 20:50:49 +00:00
Sam Rawlins f2c7a355c4 analyzer: Migrate four tests to use null safety; tidy up constant/evaluation_test
Bug: https://github.com/dart-lang/sdk/issues/44666
Change-Id: Ic21b1f7ad03cf2049d1db672aa9e314da3dd3a49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186121
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-02-22 16:38:32 +00:00
Kallen Tu 5d99c6b449 Added 'const-functions' experiment flag.
Change-Id: I907c17e8a2039574505273b1f12f706be6121b76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185680
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2021-02-22 16:32:19 +00:00
pq 297ae00922 nullable value fix
01:03 +96 -2: integration core config excludes [E]

  type 'Null' is not a subtype of type 'Object'

  package:analyzer/src/lint/config.dart 123:32                   _LintConfig._parseYaml.<fn>
  dart:collection-patch/compact_hash.dart 397:8                  _LinkedHashMapMixin.forEach
  dart:collection/maps.dart 342:10                               MapView.forEach
  package:analyzer/src/lint/config.dart 115:16                   _LintConfig._parseYaml
  package:analyzer/src/lint/config.dart 110:7                    _LintConfig._parse
  package:analyzer/src/lint/config.dart 36:22                    new LintConfig.parse
  package:linter/src/cli.dart 97:29                              runLinter
  package:linter/src/cli.dart 43:9                               run
  test/integration_test.dart 71:15                               coreTests.<fn>.<fn>.<fn>
  test/integration_test.dart 70:24                               coreTests.<fn>.<fn>.<fn>
  package:test_api/src/backend/declarer.dart 200:19              Declarer.test.<fn>.<fn>
  ===== asynchronous gap ===========================
  dart:async/zone.dart 1294:19                                   _CustomZone.registerBinaryCallback
  dart:async-patch/async_patch.dart 51:8                         _asyncErrorWrapperHelper
  package:test_api/src/backend/invoker.dart                      Invoker.waitForOutstandingCallbacks.<fn>
  dart:async/zone.dart 1354:13                                   _rootRun
  dart:async/zone.dart 1258:19                                   _CustomZone.run
  dart:async/zone.dart 1789:10                                   _runZoned
  dart:async/zone.dart 1711:10                                   runZoned
  package:test_api/src/backend/invoker.dart 228:5                Invoker.waitForOutstandingCallbacks
  package:test_api/src/backend/invoker.dart 383:17               Invoker._onRun.<fn>.<fn>.<fn>
  ===== asynchronous gap ===========================
  dart:async/zone.dart 1286:19                                   _CustomZone.registerUnaryCallback
  dart:async-patch/async_patch.dart 40:23                        _asyncThenWrapperHelper
  package:test_api/src/backend/invoker.dart                      Invoker._onRun.<fn>.<fn>.<fn>
  dart:async/zone.dart 1354:13                                   _rootRun
  dart:async/zone.dart 1258:19                                   _CustomZone.run
  dart:async/zone.dart 1789:10                                   _runZoned
  dart:async/zone.dart 1711:10                                   runZoned
  package:test_api/src/backend/invoker.dart 370:9                Invoker._onRun.<fn>.<fn>
  package:test_api/src/backend/invoker.dart 415:15               Invoker._guardIfGuarded
  package:test_api/src/backend/invoker.dart 369:7                Invoker._onRun.<fn>
  package:stack_trace/src/chain.dart 94:24                       Chain.capture.<fn>
  dart:async/zone.dart 1354:13                                   _rootRun
  dart:async/zone.dart 1258:19                                   _CustomZone.run
  dart:async/zone.dart 1789:10                                   _runZoned
  dart:async/zone.dart 1711:10                                   runZoned
  package:stack_trace/src/chain.dart 92:12                       Chain.capture
  package:test_api/src/backend/invoker.dart 368:11               Invoker._onRun
  package:test_api/src/backend/live_test_controller.dart 153:11  LiveTestController.run
  dart:async/future.dart 198:37                                  new Future.microtask.<fn>
  dart:async/zone.dart 1346:47                                   _rootRun
  dart:async/zone.dart 1258:19                                   _CustomZone.run
  dart:async/zone.dart 1162:7                                    _CustomZone.runGuarded
  dart:async/zone.dart 1202:23                                   _CustomZone.bindCallbackGuarded.<fn>
  dart:async/zone.dart 1354:13                                   _rootRun
  dart:async/zone.dart 1258:19                                   _CustomZone.run
  dart:async/zone.dart 1162:7                                    _CustomZone.runGuarded
  dart:async/zone.dart 1202:23                                   _CustomZone.bindCallbackGuarded.<fn>
  dart:async/schedule_microtask.dart 40:21                       _microtaskLoop
  dart:async/schedule_microtask.dart 49:5                        _startMicrotaskLoop
  dart:isolate-patch/isolate_patch.dart 120:13                   _runPendingImmediateCallback
  dart:isolate-patch/timer_impl.dart 402:11                      _Timer._runTimers
  dart:isolate-patch/timer_impl.dart 426:5                       _Timer._handleMessage
  dart:isolate-patch/isolate_patch.dart 184:12                   _RawReceivePortImpl._handleMessage





Change-Id: I33e31d58432d34dc3e95bc5d7db7b40e6311be89
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2021-02-22 15:49:09 +00:00
Sam Rawlins b7849ab933 analyzer: Improve code quality around used element checking
This is being mailed ahead of the fix, as the fix will probably
require google3 cleanup first.

* Change outermost loop over `usedElements.prefixMap` from forEach to a
for-each loop which allows more efficient short-circuiting.
* Short-circuit continue when `_prefixElementMap[prefix] is null.
* Short-circuit continue when `namespace` is null in a few locations.

Bug: https://github.com/dart-lang/sdk/issues/45028
Change-Id: I5bf1e571c436132665a87625a46cdc0c3f1ef2d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186040
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-02-21 14:42:57 +00:00
Sam Rawlins eb448e3067 analyzer: Remove two TODOs regarding converting null-aware tests
The diagnostics referred to in these tests are not reported in null safe
code.

Bug: https://github.com/dart-lang/sdk/issues/44666
Change-Id: I59676e2c937e154a519649754b2cb196313a3dd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186120
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-02-21 14:41:57 +00:00
Konstantin Shcheglov a68d60090e Add util/file_paths.dart and use in ContextManagerImpl
Change-Id: Ibbf8ec0b0809fa17e073df6b61065f7e6278c7d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186022
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-02-20 20:33:36 +00:00