Commit graph

90859 commits

Author SHA1 Message Date
Srujan Gaddam 8ebed3d806 [dart:html] Add webkitSpeechRecognition to SpeechRecognition class
In Safari, the prototype of a SpeechRecognition object returns a
webkitSpeechRecognition prototype. This name is different than the
one in the @Native annotation, so dart2js fails to recognize it. We
should it to the annotation so we properly intercept it.

CoreLibraryReviewExempt: Changing bindings of dart:html, no change to API.
Change-Id: Ic533e1208dd28e521403998e43009e0f651e2dfa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291961
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-03-31 17:32:54 +00:00
Jake Macdonald d259edfa28 fix up utils/tests/peg and utils/peg code to not have diagnostics
This code is opted in to the latest language version but was not ever migrated.

It could possibly be just deleted, as it hasn't been runnable for some time, but I have no idea really.

Change-Id: I7ccda121dcd56ed9388b48c70e3b3c0b2d087e47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292042
Commit-Queue: Jake Macdonald <jakemac@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2023-03-31 17:04:38 +00:00
Paul Berry d2184a9d03 Patterns parsing: disallow unaryPattern or relationalPattern in unaryPattern.
The precedence-based pattern parser can understand a unary pattern
inside another unary pattern (e.g. `_ as int as num`) or a relational
pattern inside a unary pattern (e.g. `> 1?`), but the specification
prohibits these constructions because they're difficult to read and
not very useful.

This change updates the implementation to match the spec, by producing
the appropriate error.  The offset and length of the error cover the
inner pattern, so it should be easy to construct an analysis server
quick fix that inserts the necessary parentheses.

Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I33e74d6d1f863e7162851d26fefbacd4fd17277c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292120
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-03-31 16:43:01 +00:00
Brian Wilkerson 39c9220927 Add a fix to replace an empty map pattern
Change-Id: If4544e6f33d96ad9e5a8790de1211a15befc64b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292284
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-03-31 16:30:22 +00:00
Nicholas Shahan ce15d1f7c3 [ddc] Avoid crashing on record types in canary mode
Add a simple (but incorrect) implementation that avoids crashing
the compiler when encountering a `RecordType` in canary mode.

This is a temporary workaround to unblock landing changes that
add the use of record types to the SDK.

Fixes: https://github.com/dart-lang/sdk/issues/51904
Change-Id: Ibaa88f06bf42e7be3a1853be3fb43c55c6fe8e66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292203
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-03-31 16:13:28 +00:00
Sam Rawlins 44b8ccdde6 Report when a @reopen annotation is invalid
A `@reopen` annotation is invalid when it annotates a declaration which
does not reopen anything.

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

Also cleaned up some code around reporting other invalid annotations.

Change-Id: I5add39cf2ef553a3441d39dfc47bcd1ffdbeb8ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292140
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-03-31 16:11:27 +00:00
Keerti Parthasarathy 386db23227 Add support for patterns to replace null assert with cast fix
Bug: 51880
Change-Id: I3b4bebefdb1122531ec9070ed70a15933d06dd70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292100
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-03-31 14:48:50 +00:00
Keerti Parthasarathy e31afcb0b1 Add a disable-telemetry option to dart.
Change-Id: I7295a60fbbf90ed95abcb39abc86a1f8427cab89
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292202
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-03-31 14:45:07 +00:00
Paul Berry 2828256821 If verify_error_fix_status_test fails, output the status file path.
This will save me a lot of time because I keep forgetting where the
status file is.

Change-Id: I3ab6ad59f66c4e84515bad3a6b7689b6b47ecddf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292283
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-03-31 14:40:47 +00:00
Sigurd Meldgaard 645511d7f4 Resolve package pubspec of target for relevant dartdev commands
Adds a `--no-pub` flag to those commands

Bug: https://github.com/dart-lang/sdk/issues/50422
Change-Id: I949605c4ebb4c609eb19159625958317e54523a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291500
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2023-03-31 14:03:31 +00:00
Paul Berry 7e1da60f18 Add a watchlist entry for changes to _fe_analyzer_shared
Change-Id: Iabf6c5d53ef6048865cef64b73d3c6e2e2db370d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292121
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-03-31 13:59:27 +00:00
Daco Harkes 3de5d25429 [vm] Class modifiers for NativeFieldWrapper subtypes
Split off https://dart-review.googlesource.com/c/sdk/+/291761.
Landing separately, so that the breaking change itself is a smaller
CL.

TEST=ci build (see touched _test files)

bug: https://github.com/dart-lang/sdk/issues/51896
Change-Id: Ic8d218845ccb6a277689e911b2c34c44639e13cf
Cq-Include-Trybots: luci.dart.try:flutter-linux-try,vm-aot-linux-debug-x64c-try,vm-ffi-android-debug-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292000
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-03-31 13:20:19 +00:00
Paul Berry 452dcdf517 Fix parsing of PATTERN as T? when
The logic for parsing types has special disambiguation rules for
deciding whether a trailing `?` should be included in the type, based
on what token(s) follow the `?`.  In the case where the token that
follows the `?` is `when`, we need to look further ahead to
disambiguate, to distinguish `PATTERN as T? when guard` from something
like `EXPRESSION is T ? when : otherwise`.

(Note: an alternative implementation would be to disambiguate based on
whether we're parsing a pattern or an expression.  But in the future I
want to move toward an architecture where expression parsing and
pattern parsing are combined, so that if the parser makes the wrong
decision about whether it's looking at a pattern or an expression,
error recovery will do a better job.  So I'm disambiguating based
solely on what follows the `?`.)

Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: Idbc780b7b54fecc7fd01cae868c34771564dd804
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292282
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2023-03-31 13:12:48 +00:00
Johnni Winther e6d352dec1 [_fe_analyzer_shared] Update exhaustiveness checking to new semantics
In response to https://github.com/dart-lang/language/pull/2960

Change-Id: I26430aa7666de69b9bbc34ded65e0e54160e3d3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292004
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-03-31 12:54:23 +00:00
Sigurd Meldgaard 6424b82eed Bump pub to 196e89e5716d64b2954021e6ac9bb5a20d975fc6
Changes:
```
> git log --format="%C(auto) %h %s" b615e9e..196e89e
 https://dart.googlesource.com/pub.git/+/196e89e5 Make --example be the default (3856)

```

Diff: https://dart.googlesource.com/pub.git/+/b615e9e1f5c5c525c23b08c0e7ff42599c9dcbea..196e89e5716d64b2954021e6ac9bb5a20d975fc6/
Change-Id: I745d5154a5c0b223e413c62eafd90f5a0a06a0a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292323
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2023-03-31 12:26:43 +00:00
Chloe Stefantsova 9598da006c Remove duplicated keys from a language test
Change-Id: Ic88e9ee5204167184bb69a605c3b38d951867629
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292321
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-03-31 12:24:13 +00:00
Johnni Winther 1536bbab40 [cfe] Updates test with ... in map patterns
Change-Id: I6dceb6d9490c3b42941874499e815638216b0d17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292302
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-03-31 09:54:56 +00:00
Aske Simon Christensen 050eb42748 Update Binaryen to b9b5f162ca8bf5b899ff0f0351491d7d403d7ed9
The new version optimizes slightly better and much faster.

Change-Id: Icbd8cd01f149c609043572bdadd42be2afd6ac54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292301
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-03-31 09:16:37 +00:00
Sergey G. Grekhov cbf64d7241 [co19] Roll co19 to 7edd464c87e1cd453d7c4410cf2ee1240a6320d7
2023-03-30 sgrekhov22@gmail.com Fixes dart-lang/co19#1964. Split matching_map_A01_t01.dart into two tests. The second one is for sound nullability only (dart-lang/co19#1965)
2023-03-30 sgrekhov22@gmail.com dart-lang/co19#1401. If- and for-elements tests for maps and sets added (dart-lang/co19#1967)
2023-03-30 bquinlan@google.com Remove ProcessInfo constructor test (dart-lang/co19#1975)
2023-03-29 49699333+dependabot[bot]@users.noreply.github.com Bump actions/setup-java from 3.10.0 to 3.11.0 (dart-lang/co19#1971)
2023-03-29 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 3.3.0 to 3.5.0 (dart-lang/co19#1970)
2023-03-28 sgrekhov22@gmail.com Fixes dart-lang/co19#1972. Add nnbd-strong flag to some map-pattern runtime tests (dart-lang/co19#1973)
2023-03-27 sgrekhov22@gmail.com Fix IntPtrArray_A01_t01.dart. Remove platform-depended code (dart-lang/co19#1969)

Change-Id: I23b05e414ef7517ee198e426fbf9b85165ce89b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292300
Reviewed-by: Alexander Thomas <athom@google.com>
2023-03-31 09:15:21 +00:00
Johnni Winther 4036b35ac7 [cfe] Only use inferred constant context for <3.0 switch cases
When patterns are enabled, the case expression is not an inferred
constant context.

Closes #51898

Change-Id: I6b5a68b8de587c53a329756b6ce7caa6b9235fef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292081
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-03-31 09:07:22 +00:00
Aske Simon Christensen 7196bb2d03 [dart2wasm] Allow non-strict JS interop in the flute benchmark
Change-Id: I3cc270b9deace30f95ee44f2603af26aca81ce38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292023
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-03-31 07:59:48 +00:00
Aske Simon Christensen 85dfcd8601 [dart2wasm] Compute instance method parameter types from Wasm types.
This improves the precision of the Wasm types for Dart function types
in instance method signatures.

It could in principle also improve the precision of the receiver
parameter from the LUB of the representation types to the LUB of the
actual structs for the classes implementing the member. However,
if at a call site the receiver parameter type is more precise than the
representation type of the receiver, the call site will need to cast
the receiver to the more precise type. This gives rise to more casts
in practice than the ones saved inside the methods by the more precise
receiver parameter type. For this reason, the receiver parameter type
is kept at the LUB of the representation types of the classes
implementing the member.

This change is also a stepping stone towards not having `ClassInfo`
for the special Wasm types.

CoreLibraryReviewExempt: Only affects Wasm-specific libraries.
Change-Id: I81ca5aa1107f1c04ed7729a758e983698492a106
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288400
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-03-31 07:25:08 +00:00
Stephen Adams 482b4e485c [js_runtime] Use marker interface to signal trusted .runtimeType overrides
Use the `TrustedGetRuntimeType` interface to mark implementation
classes that have a `get runtimeType` that should be used for
reporting the types of instances in errors and `Record.runtimeType`.

Streamline the various more general `get runtimeType` implementations
by specializing them to the context. By explictly implementing
`Closure.runtimeType` we avoid the need to test for closures in the
'ordinary' object path. This should help the Flutter pattern of
testing `a.runtimeType == b.runtimeType`.

Change-Id: Ib49a6d89ff23e752beed8753aafceff40457433d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291741
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-03-31 04:05:08 +00:00
Nate Biggs 464bbdde7e [dart2js] Compactify location data on SourceLocations.
We encode line/column in a single 64-bit integer and derive offset from this using the lineStarts stored on the kernel Source object.

Saves 90-100MB of memory within the emitter phase on a large program. Most of that is from the smaller deserialized SourceLocation objects but some memory is also saved due to the smaller output size from the compact serial representation. The input to the emitter phase is ~14MB smaller (with the savings split across multiple codegen shards).

Change-Id: Ic71231fb43fc746293b6f6f77e0ee2c3b17742cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291900
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-03-31 03:27:32 +00:00
Sam Rawlins 17f56d9373 Do not report strict_raw_type on Cast or Object patterns
Bug: https://github.com/dart-lang/sdk/issues/51902
Change-Id: Id5b605075333966b358d4432741514558055e66f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292200
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-03-31 02:21:06 +00:00
Mayank Patke 10912d6c84 [dart2js] Add Rti specializer for is FutureOr<T>.
In particular, this fixes some type tests involving records.
`(1, true) as FutureOr<(int, bool)>` was failing because the Rti for the
record literal was _Record_2 rather than +(int, bool). We want to avoid
constructing the full record Rti, so instead we can have the specializer
for FutureOr directly delegate to its union components.

Fixes: #51910
Change-Id: I3716882aab0a519ab35803d87fabe570b7e27655
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292242
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2023-03-31 02:14:46 +00:00
Mayank Patke 5d859bb463 [dart2js] Add test for issue #51910.
Bug: #51910
Change-Id: I0ee968a88e67279d1ced7e1f1126357b0e1bc6b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292260
Reviewed-by: Stephen Adams <sra@google.com>
2023-03-31 02:14:46 +00:00
Robert Nystrom 15e5ec93f3 Update test for 2.29/2.30 changes to map patterns.
It is still an error to have duplicate keys.

Change-Id: Id86fa7b50c3620540f4bef0399f5f70316848662
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292125
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2023-03-31 01:30:54 +00:00
Joshua Litt 4cd53dbb2e [js_util] Fix patch file inconsistency
Change-Id: I183c163084f53d8d8853bdb3aeccbc9e4f028193
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292122
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-03-30 23:25:56 +00:00
Keerti Parthasarathy 5fda05d041 Add support for patterns to RemoveQuestionMark fix.
Bug: 51885
Change-Id: I11cbba03c73ef380ea2bba2db4d6c9267dbb803c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292123
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-03-30 22:06:04 +00:00
DEPS Autoroller bf27814514 Roll Clang from ee3efcf1bc8b to fa3cb517e4a5
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/clang-dart-sdk
Please CC dart-engprod@google.com,dart-vm-gardener@grotations.appspotmail.com,dart-vm-team@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Clang: https://bugs.fuchsia.dev/p/fuchsia/issues/list?q=component%3AToolchain
To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try;luci.dart.try:dart-sdk-mac-try;luci.dart.try:dart-sdk-mac-arm64-try;luci.dart.try:dart-sdk-win-try
Change-Id: I4b52807c4c32ba94da14d3a3425d095476736298
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291680
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-03-30 21:25:39 +00:00
Ryan Macnak e0e14c370a [vm] Update NULL to nullptr in runtime/platform.
TEST=build
Change-Id: I1a01702451f1be91f14c3a860fa3f84b0c686409
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292062
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-03-30 20:49:48 +00:00
Lasse R.H. Nielsen 9e76983782 Reland "Add more interface and final modifiers to dart:core."
This is another reland of 4f8333e80e.
Third time is the charm.

CoreLibraryReviewExempt: Reland of accepted CL.
Change-Id: I4ea8326af91c168b044d252162571d3fe697e4b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289826
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-03-30 20:34:09 +00:00
Sam Rawlins 3fe440b1e1 Do not report deprecated member use inside deprecated parameters
Fixes https://github.com/dart-lang/sdk/issues/51664

Change-Id: I7f7e9f56c27e81f7d60c3a66e0727b433d854b8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291700
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-03-30 20:01:55 +00:00
Danny Tuppeny 2ff94f8882 [analysis_server] Allow action in response to showMessageRequest to be null
This allows for users to dismiss a notification without taking any action (something that VS Code / LSP allows for but this API did not).

Change-Id: Icf384008cfcfde6f150c63d3f2889e81e79d1dc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292080
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-03-30 19:48:18 +00:00
Ryan Macnak 4176d8a02c [vm] Update NULL to nullptr in runtime/lib.
TEST=build
Change-Id: I883dd0516519b175eb15b530776499248a3e0759
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292061
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-03-30 19:28:28 +00:00
Ryan Macnak 25548a912f [vm, reload] NoSuchMethodError after a static target goes missing or changes signature.
- Mostly restores the pre-kernel behavior, except that actual arguments are not passed to the NoSuchMethodError.
 - Instead of a vague error message, the call site whose target is missing is now part of the stack trace and the name/kind of the missing target is part of the exception message.
 - If the missing target is on a branch not taken, things properly succeed.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/37517
Bug: https://github.com/flutter/flutter/issues/122626
Change-Id: Ic3d5a386caa8d1627d8452a5601bc728ad519987
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291055
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-03-30 19:27:17 +00:00
Jake Macdonald 836e56b774 fix ffi sample diagnostics
Change-Id: I70cac821de46311e3c8d91f5853c5de09d3a7b6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292041
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-03-30 19:19:21 +00:00
Alexander Markov 103a098d64 [vm,debugger] Do not stop at hoisted variable declarations when stepping through patterns
TEST=pkg/vm_service/test/step_through_patterns_test.dart
Issue: https://github.com/dart-lang/sdk/issues/51812
Issue: https://github.com/dart-lang/sdk/issues/49755

Change-Id: Ieb2e6f49c613c7543e7e76119cefbc4d8f9ae3de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291840
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-03-30 18:42:48 +00:00
Alexander Markov 3da80be140 [vm] Fix crashes on record types in mirrors and observatory
TEST=ci, manually verified tests with https://dart-review.googlesource.com/c/sdk/+/290760.

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

Change-Id: I338bc1b1f2e58d2343f6195ff9d12151edbd90dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291969
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-03-30 18:42:08 +00:00
Paul Berry 134007af32 Patterns parsing: make it an error to use var before a type in a variable pattern.
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I46b23ef0d1856401eac4b0a05c6bc6008711d35a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291780
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2023-03-30 18:25:03 +00:00
Ryan Macnak de2abc6091 [vm] Update NULL to nullptr in runtime/vm/compiler.
TEST=build
Change-Id: I54cd75bbc942e11c4d719edcc64640da67077634
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291965
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-03-30 18:23:53 +00:00
Konstantin Shcheglov 1ec1e7358a Changes for map pattern: report an error for rest elements, empty map pattern.
Bug: https://github.com/dart-lang/language/issues/2861
Change-Id: I00ccb3ea03aa476f96c2ecf3e3a9e13bd4926193
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Marya Belanger <mbelanger@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-03-30 17:54:06 +00:00
Ryan Macnak c566435a71 [vm] Update NULL to nullptr in runtime/vm/heap.
TEST=build
Change-Id: Iaa7cb94de855922aef3ce0e005546499386e01f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291964
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-03-30 17:15:58 +00:00
Aske Simon Christensen eca8a9a3ee [dart2wasm] Support commandline arguments to Wasm program
Change-Id: Id44fe9b2faf52071c18c81e9be53a4c04eae1735
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291086
Reviewed-by: Jonas Termansen <sortie@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-03-30 16:20:27 +00:00
Sigurd Meldgaard 6f2238969e Mark variable as used
Change-Id: I068573a3534816b301fde8628d8f15f8c0286898
Tested: not really tested, should be a noop.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292022
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-03-30 15:35:41 +00:00
Paul Berry 104ac30cf4 Parser: clean up handling of variable patterns.
The listener API for variable patterns is split into three separate
functions, to handle the three separate behaviors:

- `handleAssignedVariablePattern` for variable names appearing in an
  assignment context (these assign to an existing variable upon a
  successful match).

- `handleDeclaredVariablePattern` for variable declarations appearing
  in a declaration or matching context (these cause a new variable
  name to come into scope).

- `handleWildcardPattern` for wildcards in any context (these don't
  capture the matched value).

Also, responsibility is shifted to the parser for reporting the
following error conditions:

- VariablePatternKeywordInDeclarationContext (e.g.
  `var (var x) = ...;`)

- PatternAssignmentDeclaresVariable (e.g. `[x, var y] = ...;`)

Previously these errors were detected by the implementations, and
weren't fully covering all possible error scenarios.

In the case of VariablePatternKeywordInDeclarationContext, the
listener method `handleDeclaredVariablePattern` is called instead of
`handleAssignedVariablePattern`.  This ensures that no tokens are
dropped from the analyzer AST.  The CFE uses the `inAssignmentPattern`
argument of `handleDeclaredVariablePattern` to distinguish this error
recovery case from a legitimate declared variable pattern.

Fixes #51868.

Bug: https://github.com/dart-lang/sdk/issues/51868
Change-Id: I28ec679b73d64033166721c6460be35f15e23171
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291583
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-03-30 14:12:03 +00:00
Chloe Stefantsova 81df57636f [cfe] Coerce operands of relational patterns
Closes https://github.com/dart-lang/sdk/issues/51871

Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: I13a28c4849002f189ce6c14df2efaacac2ea4bf8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292001
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-03-30 14:11:09 +00:00
Lasse R.H. Nielsen d274ef0a4a Fix bug in Duration.toString.
On the web, some inputs to `Duration` would make -0.0
occur in positions where the code assumed an integer
with a reasonable `toString`.

Adds `+ 0` and using `0 - x` instead of `-x` to
avoid ever ending up with a `-0.0`.

Fixes #51584

CoreLibraryReviewExempt: Bugfix, no API changes.
Change-Id: Idecfaf049f2ae5677792387ce24e95add99596cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291280
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2023-03-30 14:02:38 +00:00
Jens Johansen ea3000f1d4 [parser] Fix setting endGroup with triple shift
Fixes #51759 (https://github.com/dart-lang/sdk/issues/51759).

Also fixes #45662 (https://github.com/dart-lang/sdk/issues/45662) (which
was already closed but apparently wasn't really fixed --- the `int.>>`
variant still crashed and fixing #51759 made the `int.>>>` crash again).

Change-Id: Ia218d20123ecc36636ad35c15a1b51fb196a07d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292005
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2023-03-30 13:57:21 +00:00