Commit graph

81948 commits

Author SHA1 Message Date
Lasse R.H. Nielsen bdbd3c0602 Make unawaited accept a nullable argument.
The associated `unawaited_futures` lint triggers for expressions
of type `Future?` as well, so we should allow the workaround to
handle such expressions.

This change makes a static function more permissive, and is not expected
to be breaking in any way.
(It does mean that you need Dart 2.15.0 to use the function with
nullable arguments. I've changed the annotation to say `@Since("2.15")`.
That means anyone using a 2.15 SDK should assume that they need a 2.15
SDK to use it, and someone using a 2.14 SDK will not see the argument
as nullable. If anyone uses `@Since` annotations for anything at all.)

Change-Id: Ib2da4b353104cc88a834208a6ebd788ae55b4544
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214406
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-09-27 11:58:16 +00:00
Tess Strickland bb1640eec2 Reland "[vm/compiler] Add more checks in TTSes for uninstantiated types."
This is a reland of 1016bbadde

The broken benchmarks causing the revert were not due to this CL.

TEST=vm/cc/TTS

Original change's description:
> [vm/compiler] Add more checks in TTSes for uninstantiated types.
>
> In certain cases, optimized type testing stubs for uninstantiated types
> compare the instantiation of the type arguments for the type against the
> corresponding instance type arguments. Previously, only an identity
> check was generated, so the instantiation had to match the instance type
> argument exactly.
>
> This CL adds checks for the following cases:
> * The instantiated type argument is dynamic, void, or Object.
> * The instance type argument is Null or Never.
>
> When strong null safety is enabled, we also check that the the instance
> type argument is legacy or non-nullable when the instantiated type
> argument is non-nullable Object or that the instantiated type argument
> is nullable or legacy when the instance type argument is Null.
>
> This CL also adds handling for the case where the instantiated or
> instance type argument is not a Type, which is necessary for safely
> retrieving the type class id and nullability, and allocates some
> additional registers in TTSInternalRegs for storing type arguments. On
> ARM7, this requires pushes/pops around type argument checking, because
> we've run out of registers there.
>
> Fixes https://github.com/dart-lang/sdk/issues/40736
>
> TEST=vm/cc/TTS
>
> Bug: https://github.com/dart-lang/sdk/issues/46920
> Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try
> Change-Id: Ib8498fd2b9593b4abb92111f062ed2fc95a45c16
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210681
> Commit-Queue: Tess Strickland <sstrickl@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

Bug: https://github.com/dart-lang/sdk/issues/46920
Change-Id: Id84730b3bb292ea7fdfe9ebd8b1fc6e71c64cf22
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211901
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-09-27 10:57:18 +00:00
Irina Arkhipets 11f497f6ab [co19_2] Status files updated
[co19] Status files updated

Change-Id: I206e33a31e5c55954f8ac914e0885dc6003afe26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212003
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2021-09-27 10:27:42 +00:00
Clement Skau 629803d782 [vm/ffi] Skips new DartAPI FFI tests on simarm.
TEST=None. Status file change.

Bug: https://github.com/dart-lang/sdk/issues/47284
Fixes: https://github.com/dart-lang/sdk/issues/47284
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-simarm64c-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-nnbd-mac-release-simarm64-try
Change-Id: Ifacf1057cca181aed27e461b69f4bb4231cf57fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214408
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2021-09-27 10:22:33 +00:00
Sam Rawlins 23ff0c8e11 analyzer: Improved checks of type variables in const function references
In particular, check the two cases where a constructor reference or
function reference may appear in which they must be constant
expressions, but are not in constant contexts:

* default parameter value
* field initializer in a class with at least one generative const
  constructor

We also update NodeReplacer to also replace a DefaultParameterElement's
reference to the AST of the default value.

Bug: https://github.com/dart-lang/sdk/issues/46020
Change-Id: Iea92265d41459b9f79317128e96d80de5069abfc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214340
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-09-26 22:35:54 +00:00
Kevin Moore b67a67e03c pkg:analy* - don't call .hashCode within Object.hash functions
Follow-up to cb7c932f7b

Change-Id: Ie00e7759880bfc80f7b04a79979325d26607f148
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214581
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-09-26 21:49:04 +00:00
Konstantin Shcheglov 5f18cd99a4 Fix AnalysisDriverCachingTest on Windows.
Change-Id: I4b10e4fb5ebbf9d3e12ce5b8217d8d86564ae4f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214509
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-26 18:28:44 +00:00
Brian Wilkerson 84c56cc846 Add more documentation for diagnostics
Change-Id: Ic135d6645a8987e9eab0e0ed406a076c81b7b4c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214507
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-09-26 16:48:33 +00:00
Devon Carew 1d43ec2a99 Add an initial version of a script to validate the code samples in the dart: doc comments.
Change-Id: If74a11ffee8130963c37c9bd8ad74da4211f61d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214307
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-09-26 03:07:11 +00:00
Konstantin Shcheglov 667e879ded Remove only libraries potentially affected by the changed file.
For a small analyzer library the time to analyze it 100 times,
each time changing that file that we are analyzing, so simulating
typing in this file, goes from 1000 ms to 100 ms; for a bigger
library 2400 vs 800 ms.

For a tiny Flutter hello_world the difference is 100x, 5800 vs 50 ms.

Bug: https://github.com/flutter/flutter-intellij/issues/5761
Change-Id: I15c43f4cd66399788ffe6032c52fb365665de7f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214502
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-25 17:56:10 +00:00
Kevin Moore b85488cedd pkg:compiler - enable and fix null operator lints
Change-Id: I5aaef20fdd61fd6ac9dc69978111fb680c7f99e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211624
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2021-09-24 23:07:19 +00:00
Ben Konyi 7786183e14 [ Profiler ] Fix CPU sample streaming sending only a single sample block instead of a chain of blocks
A pointer to a single SampleBlockBuffer was being passed in while
building a profile instead of a reference to SampleBlockListProcessor.
This also could lead to a segfault if there were no blocks to process.

TEST=CQ + manual testing in Flutter engine

Change-Id: I1e2903cf718da7b32747553c2ed1efcb78b62c86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214441
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-09-24 23:02:49 +00:00
Kevin Moore 70533ae7fa pkg:compiler - enable and fix prefer_final_fields lint
Change-Id: I042f6047c2c10490121398027489217c6291425d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211622
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-09-24 21:37:39 +00:00
Brian Wilkerson 4daa1ed206 Add a test to ensure that a single diagnostic never has multiple bulk appliable fixes
This includes an allow list for the diagnostics that we're already
approved, and we can add more as needed, but I don't want us to have
multiple bulk fixes without first confirming that they are mutually
exclusive. This should help prevent an oversight.

Change-Id: I73c4a52e36005f256b416372bfbf8bf7db38400e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214424
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-09-24 19:24:39 +00:00
Leaf Petersen 8a9a2e4066 Add CHANGELOG message for constructor tearoffs beta release.
Change-Id: I5f25129fdad1cb58b9f7c03797d18d1712092372
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212521
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2021-09-24 18:34:20 +00:00
Alexander Thomas 9fad776ac3 [dart2js] Remove dart2js unit tests from the NNBD builder
These tests were added to test the forked NNBD SDK but the SDK has long
been unforked.

Bug: b/200928253
Change-Id: Idb0891c2141a09320bf7779c260c79ec868f0ad0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214402
Auto-Submit: Alexander Thomas <athom@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-09-24 17:07:45 +00:00
Alexander Markov d78abd0a69 [vm/aot/tfa] Cache negative results of dispatch target lookup
When looking for a dispatch target, also cache not found selectors
to avoid repeated lookups.

Improves time of AOT compilation step 2 (TFA) on a large
Flutter application 189s -> 171s (-9.5%).

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/42442
Change-Id: I21686e1f40a09ef62abf010bfa3670615c108942
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214342
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-09-24 16:27:45 +00:00
Kevin Moore 22f1cee9d6 analysis_server: Fix OrganizeImports correction
Sort `a.dart` before `a/b.dart`

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

Change-Id: Ic16cf3dc1d0651e450cc476bf02d86afa9abf3fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214310
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2021-09-24 15:57:17 +00:00
Kevin Moore 1b3415b069 Ignore .dart_tool and .packages in pkg dir
Change-Id: I053668459b21e10e2a3f7343296f913f82118768
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214309
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-09-24 15:22:08 +00:00
Martin Kustermann 1d8a9d54cd [gardening] Remove dead print and instead print exception with failure message
This test is flakily failing on iso-stress builder and this is an
attempt to get more information about why it fails sometimes.

TEST=Makes test produce more useful information.

Change-Id: Id1c2e74c9dda69b61ba2b19f553640c801566f7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214382
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-09-24 14:07:16 +00:00
Paul Berry faa03308f6 Migration: don't add !s to expressions of type Null.
Previously, we had a rule in the migration tool that we didn't add
`!`s to the literal `null`, because such a change would be guaranteed
to fail at runtime; instead we issued a warning to the user that there
is no valid migration for their code, so user intervention is
required.

This change extends the rule to apply to any expression whose type is
`Null`.  Notably, this makes migration of code using Mockito much
easier, because it prevents the migration tool from trying to add a
`!` to expressions like `any`, `anyNamed(...)`, `argThat(...)`,
`captureThat(...)`, etc. (all of which have a return type of `Null`).

Bug: https://b.corp.google.com/issues/200173910
Change-Id: I70ce5da5002e6254397024da5a9e9f69eb04f21c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214313
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-09-24 13:25:24 +00:00
Clement Skau 22652a3b49 [vm/ffi] Privatizes dart:nativewrappers' getNativeField(..)
TEST=Updated dart_api_impl_test.

Change-Id: Ib72667b2a20adc342f724a6eff7d326e2e106257
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214401
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-09-24 13:13:55 +00:00
Lasse R.H. Nielsen e4f12438a4 Add documentation on Future and Stream showing async programming.
The documentation on `Future` and `Stream` was only showing
the class API, not `async` programming.
Added examples of using `async`, `async*`, `await`, `await for`,
`yield` and `yield*`.

Fixes #47082

Bug: http://dartbug.com/47082
Change-Id: Ib8b4e8642412073e9e6124429d66747c277f89a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212470
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-09-24 13:07:40 +00:00
Sarah Zakarias 29ee321627 bump yaml_edit revision
Changes:
```
> git log --format="%C(auto) %h %s" ffcbbc22884f590663ec451f48fd8388ba7c49f4..df1452bfe1653286277a1a8f34dddf3e4fbedd9e
 df1452b Use package:lints instead of pedantic (#4)

```

Change-Id: Ib0c376079e3b0026409cfa2295ae769c2b70bfd4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214404
Commit-Queue: Sarah Zakarias <zarah@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
2021-09-24 13:04:24 +00:00
Johnni Winther 5b7968346d [kernel] Add Field.fieldReference
This adds a third reference to Field declaration, so that we know have
three references, one for each use case:

1) fieldReference used for initialization; in FieldInitializer and as
   the key in the InstanceConstant.fieldValues map.
2) getterReference used for reading; in InstanceGet, StaticGet and
   SuperPropertyGet
3) setterReference used for writing; in InstanceSet, StaticSet and
   SuperPropertySet

TEST=existing

Change-Id: I223f130e808e7f19a831c1fe5e3a4725d1bcdc3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203770
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-09-24 12:01:08 +00:00
Danny Tuppeny 4389cf7bba [dds] Add support for services/service extensions to DAP
Change-Id: I4f63fd60bf2128c8e88c999c0963b8a1e5304178
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214281
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-09-24 11:53:15 +00:00
Alexander Thomas 637fb323d9 [vm] Use UTF-8 to read files in *_layering_check.py
Some files in runtime/ are UTF-8 encoded, e.g.:
runtime/vm/unicode_test.cc

Change-Id: Ie71fd46fb66fe793742dbf8a6645b8402956ab77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214381
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-09-24 09:50:27 +00:00
Alexander Thomas 08ee5989b4 [co19] Roll co19_2 to 13344ad01472df9badfa78fd6aa411f042e13354
2021-09-21 irina.arkhipets@gmail.com Issue dart-lang/co19#1189: Check for JavaScript removed because test is excluded.
2021-09-06 irina.arkhipets@gmail.com Issue dart-lang/co19#1188: test expectation corrected fdor web configurations.
2021-09-06 irina.arkhipets@gmail.com Issue dart-lang/co19#1188: test corrected according to the master changes.
2021-09-06 irina.arkhipets@gmail.com Issue dart-lang/co19#1188: Missing issue tags added, tests corrected according to the master changes.

Change-Id: I78dedc099d5abe83ef0702b2c5f576cfdf97f1c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214400
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2021-09-24 08:54:35 +00:00
Alexander Thomas eb89f571f7 [co19] Roll co19 to e9f3b0239dedd349084ca1e0b9d2ceacf4b2a1ef
2021-09-23 irina.arkhipets@gmail.com Issue dart-lang/co19#1200: Missing Issue tags added.
2021-09-23 irina.arkhipets@gmail.com Issue dart-lang/co19#1200: Roll failures fixed for LanguageFeatures/Instantiate-to-bound tests.
2021-09-23 sgrekhov@unipro.ru Fixes dart-lang/co19#1201. Add tests that 'late' and 'required' are not reserved words
2021-09-23 sgrekhov@unipro.ru dart-lang/co19#1200. Some of the roll failures fixed
2021-09-22 sgrekhov@unipro.ru Fixes dart-lang/co19#1199. Change the way of checking of constants identity
2021-09-21 irina.arkhipets@gmail.com Issue dart-lang/co19#1189: Check for JavaScript removed because test is excluded.
2021-09-17 sgrekhov@unipro.ru Fixes dart-lang/co19#1198. Add more e<typeArgs> tests instead
2021-09-16 sgrekhov@unipro.ru dart-lang/co19#1198. Remove callable_objects_instantiation_* tests and add e<typeArgs> tests instead
2021-09-16 sgrekhov@unipro.ru Fixes dart-lang/co19#1191. Call method in mixin tests added
2021-09-15 irina.arkhipets@gmail.com Fixes dart-lang/co19#1189: tests corrected according to https://dart-review.googlesource.com/c/sdk/+/212290.
2021-09-15 sgrekhov@unipro.ru dart-lang/co19#1197. Tests for tearing-off forwarding constructors introduced by mixin application added
2021-09-15 sgrekhov@unipro.ru dart-lang/co19#1087. Syntax tests for non-trivial function object computation added

Cq-Include-Trybots: dart/try:analyzer-nnbd-linux-release-try,dart2js-nnbd-linux-x64-chrome-try,ddc-nnbd-linux-release-chrome-try,front-end-nnbd-linux-release-x64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try
Change-Id: I0ae1d3a78969339c863c5539557660106ca7622e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214380
Reviewed-by: William Hesse <whesse@google.com>
2021-09-24 08:43:02 +00:00
Sarah Zakarias f7fd4ebcec Add dependency to yaml_edit and bump pub revision
Change-Id: Iaec41d7308c7ebe2a78a3c578b91c56cdad97e12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214280
Commit-Queue: Sarah Zakarias <zarah@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
2021-09-24 08:36:24 +00:00
Sam Rawlins 5e0f4c24c5 Move function reference const tests to evaluation_test.dart
This change moves tests out of the older-style test file. In addition:

* additional tests for uninstantiated function tearoff identity.
* additional tests for using a type parameter as a type argument in a
  function tearoff in a const expression.

Change-Id: I6c6a6db13144e02794a62d78337013b4a525549a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214139
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-09-24 05:39:59 +00:00
Riley Porter e559b80f52 Remove getProperty js_util optimization
Removing usage of the foreign JS function from the js_util
CFE optimizations. Keeps foreign JS calls only injected by
the compilers. There will be no change in generated JavaScript
for dart2js, it was already inlining getProperty calls. There
will be a small change for generated JavaScript for ddc, but
we will work on adding a simple ddc inliner to account for it.

Change-Id: Iadcc81a6798a8af397205bf6bb89d0bfbd095432
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214306
Commit-Queue: Riley Porter <rileyporter@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2021-09-24 01:41:48 +00:00
Riley Porter dc4d16fc1b Use Extension Member data instead of desugar api.
Swap to finding the mapping of Procedure to ExtensionMemberDescriptor
data, instead of using the front_end desugar api for extension
member kind, name, and isStatic information.

Change-Id: I4bca55e8f1d3044def420060ddecc75600452a11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214305
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2021-09-24 01:41:48 +00:00
Ben Konyi bd067153d5 [ CLI ] Hide exe and aot-snapshot subcommands from dart compile on IA32
The AOT runtime is not supported on IA32, so generating snapshots and
executables requiring the AOT runtime is not possible on IA32.

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

TEST=pkg/dartdev/test/commands/compile_test.dart

Change-Id: I99e9a16f6a93b3b63b8ed15acc1472f9ca619c08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213680
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-09-24 01:21:08 +00:00
Bruno Leroux 2481cf76f5 [ VM / Service ] Fix 'dart:' scripts lookup
Bug: VM service `addBreakpointWithScriptUri` and `addBreakpoint` don't add valid breakpoints for code in `dart:` libraries. See #47204

This PR contains :
- a new test : 'service/break_on_dart_colon_test.dart', that checks several URIs to register breakpoints in `dart:` libs.
- a fix in `Debugger::SetBreakpointAtLineCol` to make it calls `Library::LookupScript'` with the right value for `useResolvedUri` parameter.

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

TEST=runtime/observatory/tests/service/break_on_dart_colon_test.dart

Change-Id: Id3d6722c278e3238202a9d84a0d34612b957035c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213766
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-09-24 01:20:38 +00:00
Konstantin Shcheglov ec29dce8e0 Remove CompilationUnitElementImpl.sourceContent
I hoped to get hints on why we get out of sync with the number
of classes, getters, etc in the AST and the element model. Unfortunately
it don't not help, we might have a unit without any variables, the
corresponding code, but AST has variables.

So, this code does not help, and I want to remove it.

It was also used for Move File refactoring, we would need some different
solution later. For now I revert to the state it was not long ago.

Change-Id: If7468aac33ce000f85e94f96bfa2d2966892e560
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214341
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-23 22:59:09 +00:00
Kevin Moore 6459e73570 telemetry: allow the latest pkg:usage
Change-Id: I2c3d97b5b999e03682e60a6a62947257f597c182
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214308
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-09-23 21:49:28 +00:00
Paul Berry 5f73b659e8 Extract non-error-code-related members from TodoCode.
This paves the way for code generation of the `TodoCode` class.

Change-Id: I25e113f90194f3f7ac5ab0ae2a17b9836e56b835
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214302
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-09-23 21:16:08 +00:00
Paul Berry 1042903683 Fix some analyzer error codes that have gotten out of sync with their declarations.
Change-Id: Ifa803f6fd86db7aa6f73abf83e85bee1f83ee6b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214074
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-09-23 20:20:28 +00:00
Sam Rawlins 032738141e Fix constructor references in assignments
I maintain the choice to _not_ rewrite a PrefixedIdentifier to a
ConstructorReference in the case that it is the left side of an
AssignmentExpression, because doing so requires extra additional
checking during assignment verification, and probably a new error code
saying a constructor cannot be assigned to, similar to the error code
saying that a method cannot be assigned to. This is all feasible, but
I think it is very reasonable, in AstRewrite, to say, "This prefixed
identifier does seem to refer to a constructor, but it's the left
side of an assignment, so I'm not going to confidently do a rewrite;
instead I will leave this alone and let the assignment verification
code handle it."

Bug: b/200948019
Change-Id: I90c6a157c2992d4935acfb593f38518f0388bced
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214320
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-09-23 19:38:49 +00:00
Alexander Markov e7ce24744b [vm] Take number of base type parameters into account when checking equivalence of function type parameters
When checking if type parameters are equivalent for subtyping,
check both base and index of the type parameter to avoid matching
type parameters from different levels. For example, consider
the following function types:

  void Function<S>(S val) Function<T>(T val)
  void Function<S>(T val) Function<T>(T val)

Also, when instantiating a signature of a closure, correct
base/index of type parameters even if they are not instantiated.

TEST=language/function_subtype/nested_function_type_test
TEST=language/closure/nested_generic_closure_test

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

Change-Id: I6f75a4ee70435f42afeb772e7ecc680ab75a7520
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214136
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-09-23 18:47:58 +00:00
Konstantin Shcheglov 6207d1da35 Revert "Stop using available suggestions for already imported libraries"
This reverts commit 3cc518b3cc.
Initial CL: https://dart-review.googlesource.com/c/sdk/+/201021

Bug: https://github.com/flutter/flutter-intellij/issues/5761
Change-Id: I62e57deef819f78f1d08934ad924585eaa52223b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214225
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jacob Richman <jacobr@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-23 18:39:07 +00:00
Konstantin Shcheglov 57e71e33c5 Fix RemoveUnusedField when some SourceRange(s) being removed are fully covered.
Change-Id: I7ae8b9286c473a368def9c9db22b2f2b828c7b81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-23 16:34:03 +00:00
Alexander Thomas 19b7a3e2b5 [infra] Use dart-lang/co19 issue links in co19 rolls
* Add dart-lang/co19 in front of #123 issue references.
* Update the co19_2 script to match the co19 script.
* Track main from the roll branches.
* Add a comment between the two co19 hashes to prevent merge conflicts.

Fixes: b/200911019
Change-Id: I2806ac7e9cd5ff3d24cac0e50a1d094163b35d7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214046
Reviewed-by: William Hesse <whesse@google.com>
2021-09-23 15:51:06 +00:00
Lasse R.H. Nielsen 651d6e076b Add null-unsoundness check to print's object.toString() result.
This makes it an *earlier* error if a `toString` method returns `null`
when passed to `print`, possibly a new error if the underlying platform's
print implementation let `null` through.
Returning `null` is something `toString` was never supposed to do,
and with null safety, it's enforced by the type system,
so only pre-null-safety legacy code can actually return `null`.

Makes the error message from `NotNullableError` not assume a parameter,
so it can be used in more places.

Bug: https://github.com/dart-lang/sdk/issues/47196
Change-Id: I7f10156330994d31e44384fa952dd88385e2628d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214043
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-09-23 15:36:23 +00:00
Chloe Stefantsova 65184a9ff4 [cfe] Don't serialize an empty show/hide clause
TEST=existing

Change-Id: Ie63444c4dbeaa45b38fd195e554780f14fed878e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213767
Commit-Queue: Chloe Stefantsova <dmitryas@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-09-23 14:01:54 +00:00
Jens Johansen 1197e15a7e [CFE] Enable avoid_void_async lint
This CL enables the avoid_void_async lint in the CFE, makes the needed
changes and adds the missing `await` (because the lint
`unawaited_futures` doesn't react to void async methods).

Change-Id: Iffc1f173badd3c2d48356ee02e81a9aed492ce5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213481
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-09-23 11:58:18 +00:00
Johnni Winther 2fa89236d7 [cfe] Handle potentially constant types in instantiations
Part of https://github.com/dart-lang/sdk/issues/46232

Closes #47154

Change-Id: I71fe16d26facf29bdae1b98971c4ccfe18f95e80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213772
Reviewed-by: Chloe Stefantsova <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-09-23 09:04:12 +00:00
Erik Ernst 93d2f90383 Add test about type parameter as constant
Change-Id: If9ecc60b835944897366e716ed90896dbecc3f87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213769
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2021-09-23 07:46:24 +00:00
Konstantin Shcheglov aad3389eb0 Implement LintDriver using AnalysisContextCollection.
This change requires a change to linter to be rolled.
https://github.com/dart-lang/linter/pull/2949

Change-Id: Ib49438e0dcd6145d79f2914fef30af5e3009e14f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213290
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-23 06:45:03 +00:00