Commit Graph

8489 Commits

Author SHA1 Message Date
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 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
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
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
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
Konstantin Shcheglov c2195fcc14 Rewrite to use AnalysisContextCollection in analysis_server.
Change-Id: Iee6b392711790d17c25a3c18fa1e9bdfe8b8cc4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-19 23:01:25 +00:00
Konstantin Shcheglov e4643d5809 Deprecate ElementVisitor.visitFunctionTypeAliasElement()
Change-Id: Ib5d364b77af7974d757626a0719604fa7ec1fec7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185902
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-19 22:21:15 +00:00
Konstantin Shcheglov 29ed048cf2 Fix some null checks.
Change-Id: Id5fa53c60ec1d50e8b9a42dc7e707343031b6f9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184620
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-19 19:24:34 +00:00
Dmitry Stefantsov 32fe29617e [cfe] Remove line enabling 'extension-types' flag
TEST=The flag is updated according to the documented recommendations.

Change-Id: I0997b29eafc40844b6ab6dc089ad91723071d4e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185880
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-19 17:43:17 +00:00
Konstantin Shcheglov 3bcae5219b Set FieldElementImpl for synthetic getter/setter in top-merge.
Saw it crashing on a co19/ test internally.

Change-Id: I02662ad27eed409df2cadb81502a54207182a104
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185722
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-19 16:37:24 +00:00
Konstantin Shcheglov 9bfd416c45 Add ContextRoot.workspace, deprecated AnalysisContext.workspace, support included excludes in ContextLocatorImpl
Change-Id: Iecd324ad45b926ca6b0626f8bea4f479409154e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185499
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-02-19 02:15:40 +00:00
Konstantin Shcheglov 9a30392588 Require Workspace for ContextBuilder.getAnalysisOption() and createSourceFactory()
Ideally we want to create Workspace only once, and pass it around.
I was not able to do this yet, because DAS ContextManager kind of
dynamically updates contexts and drivers. I expect to avoid this issue
by switching DAS soon to AnalysisContextCollection.

I will follow with a bigger CL that keeps Workspace in ContextRoot.

Change-Id: I3050ba65400e0e5aa73e6d5f8beae821db10a6ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185498
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-19 00:54:30 +00:00
Konstantin Shcheglov 6c4f354458 Consider 'exclude: foo/**' as excluding the whole directory 'foo/'.
Change-Id: If75fb54929e01481b8511ef83a621a2bdf853c40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185481
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-18 19:00:57 +00:00
Sam Rawlins d2bbb91872 Analyzer: Report on more invlid error handlers.
Bug: https://github.com/dart-lang/sdk/issues/35825
Change-Id: I43060e9b0b0a764f14be041c5cbdf1d884d92326
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181740
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-02-17 15:12:25 +00:00
Dmitry Stefantsov 3a79baed23 [cfe] Add 'extension-types' experimental flag
TEST=The flag is added as per recommended instructions.

Change-Id: I7135fa772e884d083f7388741bc2b3c3a4e6f0e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185360
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-17 14:08:15 +00:00
Daco Harkes 3593de9179 [vm/ffi] Change Pointer.elementAt and sizeOf to use static type
This CL changes the semantics of
`Pointer<T extends NativeType>.elementAt` and
`sizeOf<T extends NativeType>` to use the compile-time `T` rather than
the runtime `T`.

Issue: https://github.com/dart-lang/sdk/issues/38721

TEST=tests/ffi/data_test.dart
TEST=tests/ffi/sizeof_test.dart
TEST=tests/ffi/structs_test.dart
TEST=tests/ffi/vmspecific_static_checks_test.dart

Change-Id: Ifb25a4bd66d50a385d3db6dec9213b96dff21722
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,analyzer-nnbd-linux-release-try,front-end-linux-release-x64-try,front-end-nnbd-linux-release-x64-try,benchmark-linux-try,dart-sdk-linux-try,pkg-linux-release-try,vm-ffi-android-release-arm-try,vm-ffi-android-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178200
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-02-17 11:39:42 +00:00
Sam Rawlins 0897b95f3c Analyzer: Support const Symbol('>>>')
Bug: https://github.com/dart-lang/sdk/issues/44908
Change-Id: I7af5587317da43f79f043dd7e92976e1011935ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185242
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-02-17 08:22:39 +00:00
Sam Rawlins ff6ddd2972 Analyzer: deduplicate errors when operator defined with bad parameters
If an operator declaration has both too many parameters, and one or more
optional parameters, just report the former error.

This is better UX, and is closer aligned to what the CFE reports.

Change-Id: I1f30ab9564f4bcdc49c1f3317add6c55cca29597
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185201
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-02-16 22:39:04 +00:00
Paul Berry e0fd546dc3 Improve "why not promoted" context message for the case of writes.
The new message phrasing should flow better, especially in the analyzer CLI.

For the motivation for this change, please see
https://github.com/dart-lang/sdk/issues/44904#issuecomment-776286501

Bug: https://github.com/dart-lang/sdk/issues/44898
Change-Id: I595492c64b42aff25cae5a8936c32aa8a218edd8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184601
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-02-13 15:21:06 +00:00
Sam Rawlins 33910fe2b8 Analyzer: Add wrong-number-of-params error for triple-shift
Also, add more triple-shift tests.

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

Change-Id: Ic14c6fe4f24d955fbdfd1875b21b1881251bd859
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184700
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-02-12 22:48:40 +00:00
Paul Berry 957c0a1c9d Improve "why not promoted" info for field/property reference.
When reporting that a null check is needed due to a lack of type
promotion, and the thing that was not promoted was a reference to a
field or property, the CFE and analyzer now report "why not promoted"
using a context message that points to the definition of the field or
getter.  (Previously the CFE reported a context message with no
location, and the analyzer didn't report "why not promoted").

Bug: https://github.com/dart-lang/sdk/issues/44898
Change-Id: If1841727b8b60dd87c43f239e6a06b98f363801f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184522
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-02-12 22:43:55 +00:00
Konstantin Shcheglov 51950ab881 Add Resource.parent2 that returns non-null Folder, add Folder.isRoot
A bigger version of than https://dart-review.googlesource.com/c/sdk/+/184381
This is breaking change, so we do this in steps.

Change-Id: I0c7212a073b605ade56657036543c604651810c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184581
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-02-12 19:09:20 +00:00
Konstantin Shcheglov 5ba061c4e1 Un-experiment null safety APIs.
Change-Id: Ib1d0502458625e5569b057140b9a066cc9c0f0b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184642
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-02-12 18:23:12 +00:00
Konstantin Shcheglov 0a04e2ec0f Either2, update Glob to it.
Change-Id: Iae85869339b0c7a35950408c74be08d52b6b5a4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184622
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-12 18:02:05 +00:00
Konstantin Shcheglov f6a6e57689 Issue 44223. Improve diagnostics for type arguments violating type parameter bounds.
Bug: https://github.com/dart-lang/sdk/issues/44223
Change-Id: Ia3ffddbc7d2a1be8455f642c5799d21051eefb1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184524
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-12 17:37:53 +00:00
Konstantin Shcheglov 875af7c991 Deprecated TypeProvider.futureType2/listType2/etc
Change-Id: Ia994be1e29b4d96b89d714beafcb9256a0cb4de6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184641
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-12 17:26:07 +00:00
Daco Harkes 34e3f571ac Reland "[vm/ffi] Disallow empty Structs"
Closes: https://github.com/dart-lang/sdk/issues/43974

TEST=tests/ffi/vmspecific_static_checks_test.dart

Change-Id: I35e6f5315826a751e5ce017a6a618c2c224c0f84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180189
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-02-12 15:35:29 +00:00
Konstantin Shcheglov 27e707268f Always crawl up in getOptionsFile()
Change-Id: I424cd625f05d9bc10ae0366e0332e96496633062
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184580
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-11 23:24:11 +00:00
Konstantin Shcheglov 8a80001cb9 Fix null checks in generated summary format.
Change-Id: Ie8c0f19c1604a92c07b8be98301d5ee8f89a2ed8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-11 22:21:57 +00:00
Konstantin Shcheglov 6944a2c1ec Use extensions in FfiVerifier.
Change-Id: Ib9fe8c4c327508e29aaa330054359b75157bb805
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184521
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-11 20:43:37 +00:00
Konstantin Shcheglov c749c0e3a9 ConstructorDeclaration always has a body, at least EmptyFunctionBody.
Change-Id: I5cbc5317256d02cd1422233107ce469e8d8935f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184341
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-11 18:08:15 +00:00
Konstantin Shcheglov 3d8d4b4c2b FunctionExpression always has a body, at least EmptyFunctionBody.
Change-Id: I0d09df2571436f30a7706e657a98056a021e25e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184342
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-11 18:00:11 +00:00
Konstantin Shcheglov 244964d893 Refactor ContextBuilder.createPackageMap() and createWorkspace() into static methods.
There are places when we need to call createWorkspace(), but we don't
have enough data to create full ContextBuilder, because we don't
know SdkManager.

Change-Id: I12ec5701ecab897bf1c49c478e8487c7ca348a29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184380
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-11 17:52:53 +00:00
Konstantin Shcheglov bb696cb6c2 Fix null checks in ConstantVerifier.
Here we apply two techniques:
1. Group pieces of data that always available together;
2. Pass implied data explicitly.

Change-Id: I7d78e9783e9a47bb56ec4e2c8782e6e643b9f5eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184321
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-11 17:52:08 +00:00