Commit graph

88606 commits

Author SHA1 Message Date
Sergey G. Grekhov c0330b6444 [co19] Roll co19 to 9cfd817af42a5b3f934829aa1a82b5f27463130f
2022-12-01 sgrekhov22@gmail.com dart-lang/co19#1401. [Patterns] More test cases added to variable and wildcards tests (dart-lang/co19#1551)
2022-12-01 sgrekhov22@gmail.com dart-lang/co19#1401. [Patterns] Constant pattern tests update according to the new spec (dart-lang/co19#1566)
2022-12-01 sgrekhov22@gmail.com dart-lang/co19#1401. [Patterns] Parenthesized pattern tests added (dart-lang/co19#1548)

Change-Id: I2458848da6ba816368c6d5b9bfe8d7fa6467dfcd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273360
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2022-12-05 08:41:02 +00:00
Jens Johansen b812517fac [analyzer] Don't ask for subtypes for the same elements several times when searching for references
When asking for all references of a member it starts by finding all
supertypes for the class, then for each supertype (including itself)
(that has a member with the same name as the one we're querying for)
it searches for all subtypes.

We recall that when getting all subtypes, it really gets all direct
subtypes, then for each of those, their direct subtypes etc.
Naturally, then, with getting all subtypes for all supertypes we
will often ask for all direct subtypes of the same class several times.

In fact, it's O(n^2):

As an example, if asking for references to `foo` on this
(in a file in analyzer, with 8 workspaces):
```
class X0 { void foo() { print('hello'); } }
class X1 extends X0 { void foo() { print('hello'); } }
class X2 extends X1 { void foo() { print('hello'); } }
[...]
class X149 extends X148 { void foo() { print('hello'); } }
```
we ask for subtypes 90600 (150 classes * 151 / 2 * 8 workspaces) times.

This CL stops that from happening and in the example from above we
"only" asks for subtypes 1200 (150 classes * 8 workspaces) times.

For the `newFile` from `AbstractSingleUnitTest` example, for instance,
we go from 28,264 asks to 17,432 asks (a ~38% reduction).

Non-first runtimes when asking for references:

Before:
0:00:03.074853
0:00:03.021881
0:00:03.034707
0:00:03.115596
0:00:03.032574

After:
0:00:02.223978
0:00:02.149937
0:00:02.150236
0:00:02.104704
0:00:02.175859

Difference at 95.0% confidence
        -0.894979 +/- 0.060283
        -29.2867% +/- 1.97266%
        (Student's t, pooled s = 0.0413338)

Change-Id: Id792a595e74de01c7186ab1263c38728f051f603
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272623
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-12-05 08:03:24 +00:00
Nicholas Shahan a464fc354b [ddc] Support more complicated subtype checks
Generate type hierarchy rules for all interface types used in a
module. These rules are utilized by the `isSubtype()` to determine
interface subtypes.

Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: I63f64075d4947f234eca5e730ad15588e60b9e1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266542
Reviewed-by: Anna Gringauze <annagrin@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-12-03 00:37:41 +00:00
Nicholas Shahan bf548e788a [ddc] Clarify class vs type references for records
Preparation for separating type representation from classes.

Use `JS_CLASS_REF(_RecordImpl)` to inline a reference to the class
in JavaScript (not the type representation).

Use a standard Dart `is _RecordImpl` type test and let the compiler
produce the correct type test code.

Change-Id: I160312d61137ad0c6b2aa30b8aeba4acbe848df9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273523
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-12-03 00:26:58 +00:00
Paul Berry eb827958a4 Remove support for & and | in patterns.
Logical-and and logical-or patterns must now use `&&` and `||`,
respectively.

Change-Id: I87774016da46a21c90a50581e7ed843160159c80
Bug: https://github.com/dart-lang/language/issues/2501
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272743
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-12-02 23:53:40 +00:00
Brian Wilkerson 6346e7fcd1 Update imports in files other than the source and destination when moving declarations
Change-Id: I3675bddc9479744a4642bdbb66b8de013f0f01df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273524
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-12-02 23:22:16 +00:00
Konstantin Shcheglov 95a390cfd9 Don't report CASE_EXPRESSION_TYPE_IS_NOT_SWITCH_EXPRESSION_SUBTYPE when patterns is enabled.
Change-Id: I780ab9a9c82e115d254c61311ac8015f46db12aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273540
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-12-02 22:57:21 +00:00
Konstantin Shcheglov 48d0d95edb Report CONSTANT_PATTERN_WITH_NON_CONSTANT_EXPRESSION
Change-Id: Idb6d0963515457e1748362dbda1441d5820a040a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273521
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-12-02 22:56:57 +00:00
Alexander Aprelev 4275d595b6 [vm/regexp] Copy, rather than share RegExp objects between isolates.
RegExp code objects keep backtracking and registers stacks in object pools, can't be shared between isolates.

BUG=https://github.com/dart-lang/sdk/issues/50082
TEST=one_regexp_many_workers

Change-Id: Ic7db8d7a75a0951178b2f4800f96224d52506545
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273480
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-12-02 22:45:21 +00:00
Kallen Tu 6c9873bf42 [cfe] Report error when using a class as a mixin when sealed-class is enabled.
From the changes in dart-lang/language#2674 that specify from a certain language version, we would like classes to not be used as mixins unless specified as a 'mixin class'.

Currently, this behaviour is under the sealed-class flag. May be subject to change as the other modifiers are added, but I'd at least like to make sure this works for sealed classes.

Change-Id: I5754b383327dde06d49175fe2d05c8ba7462145f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273082
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-12-02 22:31:58 +00:00
Konstantin Shcheglov 70b994e54f Test rest element with subpattern in map pattern.
Change-Id: I348ce8bfb6b32b3fcd1a63427d0a82a33dfa2c1a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-12-02 21:50:50 +00:00
Nate Bosch b64f84d695 Mention late errors in Future.timeout doc
Add an example where the source future results in an error that is ignored, with
only the `TimeoutException` surfacing in a catch block.

Move some comments to the same line as the `print` call to match other
lines in the example code. Use doc comment syntax on functions in the
example code.

Change-Id: I5d3146ebe8f7edce303d76ff36822ced9b831c95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272960
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2022-12-02 20:05:26 +00:00
Joshua Litt b493cdfc1b [dart2wasm] Add runner script to streamline running wasm in d8.
Change-Id: I0f891d28419d0df55f94e0229ff33e87b791e7d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273280
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-12-02 19:55:16 +00:00
Devon Carew 72c5a1a900 [deps] rev collection, fixnum, http, protobuf, sse, stack_trace, test, webdev
Revisions updated by `dart tools/rev_sdk_deps.dart`.

collection (efd709f..caf6802):
  caf6802  2022-11-28  Nate Bosch  Tweak docs for split extensions (#256)

fixnum (bca3816..62916f2):
  62916f2  2022-11-24  Lasse R.H. Nielsen  Split into separate libraries instead of using parts. (#97)
  14d4827  2022-11-23  Lasse R.H. Nielsen  Add `tryParse` methods. (#96)

http (047d6ed..976bd56):
  976bd56  2022-11-28  Kevin Moore  Use latest mono_repo (#832)

protobuf (c181573..4f3e328):
  4f3e328  2022-11-30  Devon Carew  Emit imports in sorted order (#778)
  3cc088e  2022-11-28  Kevin Moore  Latest mono_repo (#779)

sse (8d018dd..d396145):
  d396145  2022-11-29  Elliott Brooks (she/her)  Fix Fetch credentials (#69)

stack_trace (dce0013..cf3562e):
  cf3562e  2022-12-01  Devon Carew  blast_repo fixes (#123)

test (b25dac9..f3d80a6):
  f3d80a68  2022-11-29  Nate Bosch  Fix missing label and reason after isNotNull (#1797)
  5b1f0075  2022-11-29  Nate Bosch  Use double quotes for test names on windows (#1802)
  986045c4  2022-11-29  Nate Bosch  Temporarily pin to ubuntu 20.04 (#1800)

webdev (637b406..91b8a19):
  91b8a19  2022-12-01  Elliott Brooks (she/her)  Fix global variable `isInternalBuild` in injected client (#1805)
  7d0810a  2022-11-30  Elliott Brooks (she/her)  Updates the `fixture` package `pubspecs` so it is clear what shouldn't be migrated to null-safety
(#1803)
  acd3f9f  2022-11-30  Elliott Brooks (she/her)  Can debug with the MV3 Dart Debug Extension (#1802)
  1258510  2022-11-29  Elliott Brooks (she/her)  Detect whether the Debug Extension was built for dev or release (#1800)
  b4a23c6  2022-11-29  Elliott Brooks (she/her)  Fix Fetch API implementation (#1801)
  67133df  2022-11-29  Elliott Brooks (she/her)  Pull out debug logging into one file (#1799)
  a395c68  2022-11-28  Elliott Brooks (she/her)  Handle detecting Dart app when tab changes (#1796)
  4fb4328  2022-11-28  Elliott Brooks (she/her)  Authenticate the user when they click on the Dart Debug Extension icon (#1795)

Change-Id: I7beeeb43de4ba514817836ffd4ff6a62b801f2dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273282
Commit-Queue: Devon Carew <devoncarew@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-12-02 19:02:54 +00:00
Ryan Macnak ed2899ea4a [vm] Don't unroll initialization code based on macro lists.
-30k (-0.07%) out/ReleaseX64/exe.stripped/dart
-29k (-0.25%) out/ReleaseX64/exe.stripped/dart_precompiled_runtime

TEST=ci
Change-Id: I7c05705ada10dcaa388d9c8a8abd4edd9495cdc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273009
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-12-02 18:45:03 +00:00
Ömer Sinan Ağacan a1a942f960 [kernel] Remove references to DispatchCategory
DispatchCategory was removed in 74cf86cb.

Change-Id: Id5fa7710d7cd68d6004360bee90ac342c5f90583
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273400
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-12-02 18:19:36 +00:00
Ryan Macnak 393451a37a [test_runner] Extend the --rr option to include run_vm_tests and gen_snapshot.
Change-Id: I3e1a950e9fb9d25bbade60c9fe3577e5dbcd6f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272862
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-12-02 18:16:12 +00:00
Brian Wilkerson edb66fe3bb Capture the prefix for references in the search index, take 2
Change-Id: I600dd7c064ce9779251d043305becd4a8203bbc5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271802
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-12-02 18:00:59 +00:00
Konstantin Shcheglov 46bffdabb1 Test logical-and in variable declaration, report REFUTABLE_PATTERN_IN_IRREFUTABLE_CONTEXT.
Change-Id: I7fcffea3b591fbe3a181a8bb8a8a461d18ec3d64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273340
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-12-02 17:53:19 +00:00
Konstantin Shcheglov cdf5aa216e Fix rewrite tests after issue 50591 fixed.
Change-Id: Ic730d69ea5f6f309aa27e785b52d5f42d1186041
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273461
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-12-02 17:52:56 +00:00
Sam Rawlins 987c7503d1 Move DAS tutorial dir, and add light mode icons
The tutorial doc was mistakenly _not_ in the doc/ directory.

The icons show up as way too big, so I use inline HTML to specify
their width, so that they look good inline.

I add light mode icons, and use GitHub (and dartdoc)'s support for
switching between light mode and dark mode images.
https://www.stefanjudis.com/notes/how-to-define-dark-light-mode-images-in-github-markdown/

Change-Id: I1a368bfc6628adf941ba5e7a752317f9757d2538
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273460
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-12-02 17:16:08 +00:00
Ryan Macnak 16149782ef [test] Make less memory be gated by finalization in splay_dart_finalizer_test.dart.
When the heap limit is reached, directly unreachable objects are reclaimed but objects that will be unreachable after a finalization are not, and there needs to be enough headroom between opportunities for finalizers to run (returning to the event loop).

So only do the finalization thing with the upper, high-mutation part of the splay tree and remove it from the lower, write-once part. The high-mutation part is what's more interesting for GC stress testing.

Bug: https://github.com/dart-lang/sdk/issues/50597
Change-Id: Id02b38b0ac1e9bb640954ef1b686ce3eef8370af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273300
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-12-02 17:04:38 +00:00
Paul Berry e9a1248fc2 Add parser support for patterns in for-in statements and collection elements.
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I9eda03c1501cf3164cfb09cf9084576a5d1141cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273122
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-02 15:22:38 +00:00
Jens Johansen ff87b5ea8e [CFE] Replace 'first' with 'roots'
Before we could get into a situation where we didn't produce the entire
class hierarchy when we loaded from dill even though we set up the
entry points correctly.
This might not be perfect, but seems better.

Change-Id: Ifc56930da7ccad52e96ae32d6a8ab509421b37b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273381
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-12-02 15:18:27 +00:00
Paul Berry c381425bd3 Parser: additional fixes to mayParseFunctionExpressions for patterns.
Expressions can also occur in patterns, either after an equality or
relational operator (e.g. `== e`), or after `const` (though what's
allowed after `const` is heavily restricted).  We need to make sure
that the expression parser doesn't greedily treat `=>` as introducing
a function expression when parsing these constructs inside a switch
expression.

But it's ok to allow function expressions inside list patterns, map
patterns, parenthesized patterns, and in the argument part of object
patterns.  (These will be rejected by a later stage of analysis
because expressions inside of patterns must be const, and a function
expression can't be const.  But the parser should still accept them so
that we can give useful error messages).

Fixes #50591.

Bug: https://github.com/dart-lang/sdk/issues/50591
Change-Id: I828555782f5bc8cb8aae8a3948849b7a75bdec57
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273286
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-02 15:04:09 +00:00
Paul Berry 882941caf4 _fe_analyzer_shared: add support for rest patterns with subpatterns in maps.
The parser now handles maps that contain rest patterns with
subpatterns (e.g. `{'foo': _, ...var rest}`).  Even though this is
invalid Dart, it still makes sense for the parser to handle it so that
we can generate higher quality error messages.

The shared type analyzer now generates an error,
`restPatternWithSubPatternInMap`, if it encounters this error
condition.

Change-Id: I7f447bde28e646593aa432e3e5ad1f5e415bdd30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273283
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2022-12-02 13:50:38 +00:00
Johnni Winther 999c9b5e19 [cfe] Add (rudimentary) subtype implementation for ViewType
Change-Id: I7b102de842a828bb2c49b347d045d5919a4a5ae5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273241
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-12-02 11:17:34 +00:00
Jens Johansen 8cc984cd45 [analyzer] More timings and keep track of number of invocations
Before we might get something that looks like this:
```
(name: request, elapsed: 0:00:00.732983, elapsedSelf: 0:00:00.002428)
  (name: requireResolvedUnit, elapsed: 0:00:00.037635, elapsedSelf: 0:00:00.037635)
  (name: _getImplementations, elapsed: 0:00:00.692920, elapsedSelf: 0:00:00.000135)
    (name: searchAllSubtypes, elapsed: 0:00:00.691494, elapsedSelf: 0:00:00.691494)
    (name: filter and get location, elapsed: 0:00:00.001291, elapsedSelf: 0:00:00.001291)
```

With this CL we get this:
```
(name: request, count: 1, elapsed: 0:00:00.739592, elapsedSelf: 0:00:00.008764)
  (name: requireResolvedUnit, count: 1, elapsed: 0:00:00.104381, elapsedSelf: 0:00:00.104381)
  (name: _getImplementations, count: 1, elapsed: 0:00:00.626447, elapsedSelf: 0:00:00.000350)
    (name: searchAllSubtypes, count: 1, elapsed: 0:00:00.624650, elapsedSelf: 0:00:00.001226)
      (name: _searchDirectSubtypes, count: 428, elapsed: 0:00:00.623424, elapsedSelf: 0:00:00.023618)
        (name: discoverAvailableFiles, count: 8, elapsed: 0:00:00.000422, elapsedSelf: 0:00:00.000422)
        (name: subTypes, count: 3424, elapsed: 0:00:00.599384, elapsedSelf: 0:00:00.599384)
    (name: filter and get location, count: 1, elapsed: 0:00:00.001447, elapsedSelf: 0:00:00.001447)
```

Change-Id: Ia6ff3a55d7d0467b41a036ecdfb86f7e7b436b55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272622
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-12-02 08:58:23 +00:00
Johnni Winther 8bda08227d [cfe] Handle access to 'this' and parameters in view instance methods
Change-Id: I033ba603cb9f289e3ab4b39977b68e0c4641c61b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273182
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-12-02 08:40:26 +00:00
Sam Rawlins 14d553ad9d Add a tutorial for collecting instrumentation, and analyzer diagnostics
Change-Id: Icdf8480cf9954b6181bed320ccc1764055bd6640
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273301
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-12-02 07:31:18 +00:00
Nate Biggs e48df2f7f3 [dart2js] Carry library load priorty through to script tag creation.
Change-Id: Ie05b5ffe0f2e1638faf8b784a2e8c5535ec0d76a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272760
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-12-02 05:19:53 +00:00
Konstantin Shcheglov 73721f7654 Report PATTERN_TYPE_MISMATCH_IN_IRREFUTABLE_CONTEXT
Mostly to don't crash when running co19 tests.

Change-Id: I62838d04872642b2e3a9ed01a1be120aec1c0608
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273081
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-12-02 02:58:16 +00:00
Nate Biggs 3daee0282b [dart2js] Fix inferrer bug in handling exit conditions in try/catch/finally.
This is showing up in places like here where we are inferring `JSObject.toString` to return `String?`:
https://github.com/dart-lang/sdk/blob/main/sdk/lib/_internal/js_runtime/lib/js_patch.dart#L204

Change-Id: Ie15c6a06cd1e0f9ead87b4a9ceaa949bdcbce989
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269040
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-12-01 22:16:35 +00:00
Oleh Prypin 328c261397 Expand RemoveReturnedValue fix to turn => null into {}
This is targeted at the lint `avoid_returning_null_for_void` which already complains about expression function bodies but the fix doesn't do anything for them.

Change-Id: I14f3d7659301edae08482d9ffa6b72b483737e59
Bug: https://github.com/dart-lang/sdk/issues/45920
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Oleh Prypin <oprypin@google.com>
Commit-Queue: Oleh Prypin <oprypin@google.com>
2022-12-01 22:04:48 +00:00
Paul Berry 599911d197 Add parser support for for (var pattern = expression; ...; ...)
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I5f07b848ba06be403e56538a4cc64f6de51bd668
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273005
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-01 21:49:47 +00:00
Paul Berry 9221f34648 Update analyzer and CFE unit tests to use && and || in patterns.
In a follow-up CL I'll remove support for logical-and and logical-or
patterns using `&` and `|`.

Bug: https://github.com/dart-lang/language/issues/2501
Change-Id: I2627cd9999ac703dd0ab63cd6be3d0d883860674
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272920
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-12-01 19:41:43 +00:00
Paul Berry b0c705e4bd Set mayParseFunctionExpressions properly during switch expression parsing.
We need to prohibit function expressions during guard clauses in
switch expressions, otherwise the `=>` might be misinterpreted.

Fixes #50591.

Bug: https://github.com/dart-lang/sdk/issues/50591, https://github.com/dart-lang/language/issues/2672
Change-Id: Ie5703ac7049557798b19778281429e8a591cf09f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273020
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-01 18:57:33 +00:00
Konstantin Shcheglov 1f42c2a6f3 Remove 'final' from pattern variables fields.
Bug: https://buganizer.corp.google.com/issues/260986270
Change-Id: I0afc38a49a6714b42304a51cbb7869caff278d86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273260
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-12-01 18:28:28 +00:00
Mark Zhou 4a5eff63d7 [ddc] Emitting nullability wrappers for records
Change-Id: I032e5cf915a70b44559a8269e22ab2dbedb9726a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272740
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2022-12-01 18:04:18 +00:00
Devon Carew 99026df0f8 [deps] update package:webdriver
Change-Id: Iaa875c46f1425160063b5cc5f44e87a60c5e61dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273003
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2022-12-01 17:42:21 +00:00
Danny Tuppeny a7baf9309f [analysis_server] Ensure plugin protocol classes only use types valid for Isolate.send()
Fixes https://github.com/dart-lang/sdk/issues/50594.

Change-Id: I5550239dbce4a1ed7fbd844dd53642989289c899
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273200
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-12-01 16:57:56 +00:00
Tess Strickland 5fd3d4b810 [gardening] Fix debug build for ARM64C.
4-byte ldar zero extends, so can just use kObjectBytes here.

TEST=ci

Change-Id: I3b3aa792350100fd24c474c85d8ea1613c9f197b
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273242
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-12-01 16:55:52 +00:00
Ömer Sinan Ağacan ddbc111067 [dart2wasm] Fix range checks in codeUnitAt methods
New passing tests:

- co19/LibTest/core/String/codeUnitAt_A02_t01
- co19/LibTest/core/String/operator_subscript_A02_t01
- corelib/string_codeunits_test
- language/optimize/string_charat_test
- language/string/charcode_test

Change-Id: I27fe1bc080be8d70d4a33763cbfb737e6c837a50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273143
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-12-01 16:19:10 +00:00
Sigurd Meldgaard 258598eeb6 Bump pub to 21aa23f148a428ae4dd97a27ecc70b08c1328089
Changes:
```
> git log --format="%C(auto) %h %s" 4fd2051..21aa23f
 https://dart.googlesource.com/pub.git/+/21aa23f1 Revert "Create output folder if it doesn't exist in the precompiler (#3676)" (#3677)
 https://dart.googlesource.com/pub.git/+/04f7bce8 Don't consider resolution outdated in dev-releases (#3678)
 https://dart.googlesource.com/pub.git/+/74473e12 Create output folder if it doesn't exist in the precompiler (#3676)
 https://dart.googlesource.com/pub.git/+/5bfd68b1 Avoid .incremental.dill.incremental.dill in temporary file name (#3675)
 https://dart.googlesource.com/pub.git/+/c3870bc1 Unskip test (#3671)

```

Diff: https://dart.googlesource.com/pub.git/+/4fd2051bb8060ea2f2e02b13dfeb2f793d197994..21aa23f148a428ae4dd97a27ecc70b08c1328089/
Change-Id: Ie5060563cc3f96b0bc52e542f7a7b19d17fefd8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273223
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2022-12-01 16:13:50 +00:00
Ilya Yanok 9378d5ca21 Add hints for Angular constructor arguments
The rules are:

1. Arguments annotated with `@Optional` must be nullable (that part
   worked before this change).
2. Arguments annotated with `@Attribute` must be nullable if it's
   a constructor of a component (`@Attribute` can also appear on
   arguments of directives constructors, it doesn't provide any signal
   in the latter case).
3. Arguments of constructors of components or `@Injectable` classes,
   that have neither `@Optional` nor `@Attribute`, must be non-nullable.

Tested:
  Added new test cases to `api_test.dart`
Change-Id: I0f06a128e0f6ec49d39cc6bf025fe1796938f1f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272900
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
2022-12-01 15:37:33 +00:00
Vyacheslav Egorov c704e11ee2 [vm/api] Introduce Dart_WriteHeapSnapshot API
Allows embedders to programmatically request heap snapshot from a
running isolate group instead of relying on a vm-service or hidden
internal Dart APIs

Additionally we allow to include snapshot writing functionality into
PRODUCT builds using DART_ENABLE_HEAP_SNAPSHOT_WRITER define.

TEST=vm/cc/DartAPI_WriteHeapSnapshot

Bug: b/259115846
Change-Id: Ic3ef76e5fb9adcf8f23a1959f5238742b64ecde2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273181
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-12-01 14:38:44 +00:00
Michael Thomsen 7ebe699d85 [co19] Roll co19_2 to 9f28a5f173bd39c9b97a691e7abcba6fdf80b47b
2022-12-01 sgrekhov22@gmail.com Fixes dart-lang/co19#1565. FallThroughError tests removed (dart-lang/co19#1567)
2022-11-14 sgrekhov22@gmail.com dart-lang/co19#1540. Tests error expectations updated (dart-lang/co19#1544)

Change-Id: I4f4904e3c1e002230f4c47c5236fe0f93b18fc8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273220
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2022-12-01 14:35:25 +00:00
Kevin Chisholm 3e968e5fc4 update changelog on main to include dart 2.18.5 hotfix notes.
Change-Id: Ic3cfe61db296d2ed1500fc0756ee3f6f29832f07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272880
Commit-Queue: Kevin Chisholm <kevinjchisholm@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2022-12-01 13:54:43 +00:00
Jens Johansen 89b6ba91ba [vm] tools/heapsnapshot has download util
Change-Id: I11e8a750a3a40d3fbc2733f4120c50b25194cc82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273183
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-12-01 13:25:47 +00:00
Johnni Winther 05c0f5ca9a [cfe] Add synthesized this to view instance methods
+ generate getters.

Change-Id: Id873e8e6c3f8d64a845b211f18616d807302f180
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273180
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-12-01 11:53:17 +00:00