Commit graph

91670 commits

Author SHA1 Message Date
Konstantin Shcheglov c0d33e45d1 Issue 52151. Fixes for reachability in switch patterns when unresolved / error type.
Bug: https://github.com/dart-lang/sdk/issues/52151
Change-Id: Ib56df1711cbfb7a593c7b16fd6a67e45baeabc3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302455
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-05-12 19:16:42 +00:00
Paul Berry 8d2b2a197d [parser] Ensure that list and map pattern parsing always makes progress.
In rare circumstances involving syntax errors, the `parsePattern`
method inserts a synthetic token but does not consume any
tokens. Usually when this happens it's not a problem, because whatever
method is calling `parsePattern` consumes some tokens, so the parser
always makes progress. However, when parsing list patterns, after
calling `parsePattern`, the parser would look for a `,`, and if it
didn't find one, it would supply a synthetic `,` and call
`parsePattern` again, resulting in an infinite loop. A similar
situation happened with map patterns, though the situation was more
complex because in between the calls to `parsePattern`, the parser
would also create synthetic key expressions and `:`s.

To fix the problem, when parsing a list or map pattern, after the call
to `parsePattern`, the parser checks whether any tokens were
consumed. If no tokens were consumed, it ignores the next token from
the input stream in order to make progress.

I also investigated whether there were similar issues with
parenthesized/record patterns and switch expressions, since those
constructs also consist of a sequence of patterns separated by tokens
and other things that could in principle be supplied
synthetically. Fortunately, parser recovery doesn't get into an
infinite loop in those cases, so I didn't make any further
changes. But I did include test cases to make sure.

Fixes #52352.

Bug: https://github.com/dart-lang/sdk/issues/52352
Change-Id: Idc8140236f6054deb1fd3c862036fe47dd84f30b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302803
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-05-12 18:43:39 +00:00
Jackson Gardner 48346c458a Static interop stuff might also be in ui_web, so it needs to be added
to the list.

This should fix https://github.com/dart-lang/sdk/issues/52364

Change-Id: Id6ab25ee48da4027adee89e91868bde5b07b4ac2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303002
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: Mouad Debbar <mdebbar@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-05-12 18:25:59 +00:00
Brian Wilkerson d40890582c Convert uri completion tests
I am concerned about the tests marked with TODOs because I don't know
why the behavior changed. It's possible that the contributor is still
producing the suggestions but that they're being filtered out later.

I checked using the debugger, and they're not in the list of results
that we're getting back, so it seems likely that they represent real
bugs. If we just weren't detecting the bug before then we're good.

But I can't think how rewriting the tests could effect what the user
is seeing, so I think it's safe to make these changes.

Change-Id: If72042b7ec24b97994a12449c811213b8f708f72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303000
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-05-12 18:08:15 +00:00
Mark Zhou 383115fdbf [ddc] Renaming real deferred loading to DDC deferred loading
Change-Id: I9d2848288c76db0cc0427439a0bbc2e291a1df8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303001
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Auto-Submit: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-05-12 17:54:55 +00:00
Nicholas Shahan f2aa312e17 [ddc] Implement new record types
Update the format of the shape keys to better match the format used in
the dart:_rti library. This change applies to the current runtime type 
system as well.

Change-Id: I87d2af2aaf2b9dbe012fae60a64718d264a3a18c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295721
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-05-12 17:23:07 +00:00
Konstantin Shcheglov 42c79709a4 Separate isDynamicBounded() and isInvalidBounded().
Also includes https://dart-review.googlesource.com/c/sdk/+/302680
that was reverted because of adding extre diagnostics for Flutter.

Change-Id: I4cf7cedfcb67a5af226e609d279551fea0b0dee1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302844
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-12 15:12:38 +00:00
Konstantin Shcheglov 5e083e7dbc Issue 52360. Don't attempt to serialize PatternAssignment.
Bug: https://github.com/dart-lang/sdk/issues/52360
Change-Id: Iaf6fdbc602bd534147d88882fc39db69c3014585
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302882
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-12 15:02:23 +00:00
Konstantin Shcheglov 7312bf2437 Issue 52362. Fix NPE in AstNodeExtension.nodeCovering()
Bug: https://github.com/dart-lang/sdk/issues/52362
Change-Id: I47db23d809e30e5470f16abe1308bd11e74f3410
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302883
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-12 14:59:59 +00:00
Johnni Winther 458ebaf1f1 [cfe] Fix caching of sublist
This cache didn't use the head size as intended.

Closes #52345

Change-Id: I99a3e4fe1664186103d889e0a324b6992947216a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302922
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-05-12 13:31:48 +00:00
Sergey G. Grekhov 57bee2ab35 [co19] Roll co19 to c19f40239d976ab7db825227ac1a230f347f42c0
2023-05-12 sgrekhov22@gmail.com Fixes dart-lang/co19#2046. `records`, `patterns`, `class-modifiers` experimental flags removed (dart-lang/co19#2047)

Change-Id: I1efad98384834ddb5d007b777c4f6893f9fa1635
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302921
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-05-12 10:20:08 +00:00
Ömer Sinan Ağacan 7bbe675971 [dart2wasm] Specify finalizer map concrete type
The map `breakFinalizers` need to have insertion-ordered iteration
otherwise creation of Wasm blocks when compiling try-finally blocks
won't work. Update the map type from `Map` to `LinkedHashMap` to make
this clear.

This doesn't change the concrete map type used as non-constant map
literals are already compiled to `LinkedHashMap`s, just makes the type
more precise for clarity.

Change-Id: Idebffe2f0f75232f5ef41729538ad3d2508c74c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294760
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-05-12 09:31:28 +00:00
Ryan Macnak f97200616a [infra] Remove old configurations for VM in checked mode.
Change-Id: I907345b2bfeedebc87cb79931b5eece38ef0f576
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290611
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-05-12 02:53:21 +00:00
Ryan Macnak 63b72e5357 [infra] Remove vm-aot-mac-release-simarm64 and vm-aot-mac-product-x64.
Change-Id: I061fa10156ec665b9296211588313f45c850cec1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/300041
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-05-12 02:52:08 +00:00
Brian Wilkerson 57b11688ae Convert static member completion tests
I'm becoming concerned that the filtering is making it difficult to
verify the results. We can look at the textual output to see whether all
of the printed suggestions are valid, but we can't know what other
suggestions are being produced and whether they're valid, nor can we be
sure that suggestions that shouldn't be produced are not being produced.

Change-Id: Id131b9b53740b625ba74a9b5bdb690da21fcdbfc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302901
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-05-11 23:28:23 +00:00
Keerti Parthasarathy a071769acc Improve error message for async return type
fixes #33424

Bug: 33424
Change-Id: I8a0b7fb356ded813bf8736f6e52ccd365987e148
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302846
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-05-11 23:13:27 +00:00
Nicholas Shahan f469856233 [ddc] Temporarily skip tests that timeout
These tests are flaky or timing out on the stable DDC configurations.
This change adds skips for the canary configurations to avoid crashing
the infra when too many tests that timeout are attempted to be
deflaked.

When the canary mode stabilizes we should manually mark all these
tests as flaky if they are still not passing on the stable DDC
configurations.

Issue: https://github.com/dart-lang/sdk/issues/50666
Change-Id: I9b1cb8fe466624480767fea05610331bf0f4ed87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302843
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-05-11 23:03:38 +00:00
pq 88a71f7b7b add quick fix for unnecessary_null_checks
Change-Id: Ia51273c3036f627825ae01bb3bb57b1bd5c648b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302902
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-11 23:02:14 +00:00
Ryan Macnak 4641a46077 [vm] Update comment on thread interrupters.
TEST=docs only
Change-Id: Ib2921c485defc232264d0c4f86b783ce33c6eadd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302848
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-05-11 21:41:01 +00:00
pq b8f28f576c + quick fix for implicit_reopen
Change-Id: If12dc7c079d3024047379453ddfd715e854034e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-05-11 21:18:40 +00:00
Paul Berry 7968ea8b1f Remove unused parameter and return value from handleCaseHead.
These were introduced in
https://dart-review.googlesource.com/c/sdk/+/287601 to allow the
common front end to report back to the shared analysis logic when it
desugars a guard expression, so that flow analysis will properly
account for any promotions made by the guard expression; previously,
if a guard expression got desugared by the front end, promotions
performed by the guard would be lost.

In https://dart-review.googlesource.com/c/sdk/+/298840, we've switched
to a more general technique for ensuring that promotions performed by
the guard will not be lost: now the `dispatchExpression` method uses
`FlowAnalysis.forwardExpression` to compensate for the differences in
the conventions of the CFE and the shared logic, so that the shared
logic no longer needs access to the desugared expression. So the
`head` parameter (and the associated return value) are no longer
needed.

In a future change, I plan to adjust the CFE conventions to match
those of the shared logic, so that `FlowAnalysis.forwardExpression`
won't be needed at all (see
https://github.com/dart-lang/sdk/issues/52189).

Change-Id: I686d1d5b7e4c9db353f583c38792274451f9f8bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302366
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-05-11 20:58:22 +00:00
Ryan Macnak f4bd3590fc [vm, gc] Avoid double-checking when draining work lists.
TEST=ci
Change-Id: Icc1a8e42e58eee967e562e4e0429eaab33dd7fe0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302802
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-05-11 18:31:30 +00:00
Kallen Tu e155e4d515 [cfe] Add tests for pre-feature and a post-feature declaration interactions.
Just adding a few tests to make sure there's no regressions.

Bug: https://github.com/dart-lang/sdk/issues/52259
Change-Id: I6aad2d0040736462117a0ce60e3001725923e242
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302445
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-05-11 17:44:27 +00:00
Ryan Macnak 13c094e30a [pkg] Support mmap with all the Linux architectures.
TEST=pkg/mmap, local qemu
Bug: https://github.com/dart-lang/sdk/issues/52333
Bug: https://github.com/dart-lang/sdk/issues/51591
Change-Id: I939f225b2e0e08a20a07cd7bf3147b2ad8a737c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302453
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-05-11 17:15:26 +00:00
Brian Quinlan 04ef7c274c Update package:watcher to 1.1.0-dev
Change-Id: I8c26a1a67a410396dca7d191fb97879c5697574d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302450
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2023-05-11 16:46:39 +00:00
Lasse R.H. Nielsen a826699931 Have Uri give better error message for invalid Windows path.
CoreLibraryReviewExempt: Trivial change to error path.
Change-Id: Iadfb80eeb1e6c58686ed9741a88f369e130ed9e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302780
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Lasse Nielsen <lrn@google.com>
2023-05-11 16:43:28 +00:00
Danny Tuppeny 2d43bc319d [analysis_server] Fix LSP references on initializing formals
Fixes https://github.com/Dart-Code/Dart-Code/issues/4535.

Change-Id: Id2cfc6abba756afc10d8b67bde86c0aae6ae5659
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302786
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-11 15:38:02 +00:00
Daco Harkes 5cbd939dbb [vm/ffi] asTypedList MSAN and UBSAN fixes
Cleanup for https://dart-review.googlesource.com/c/sdk/+/301001.

TEST= ffi/external_typed_data_finalizer_test with sanitizers

Closes: https://github.com/dart-lang/sdk/issues/52349
Change-Id: Iff553c2af7bd61d7d68dbc5a60acbee46e03c17b
Cq-Include-Trybots: luci.dart.try:vm-msan-linux-release-x64-try,vm-aot-msan-linux-release-x64-try,vm-aot-ubsan-linux-release-x64-try,vm-ubsan-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302785
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-05-11 14:17:24 +00:00
Emmanuel Pellereau d3c7e183e9 Revert "Issue 35828. Don't report COULD_NOT_INFER when InvalidType, make it a subtype of everything."
This reverts commit 838c926f64.

Reason for revert: breaks google3. See b/281948666

Original change's description:
> Issue 35828. Don't report COULD_NOT_INFER when InvalidType, make it a subtype of everything.
>
> Bug: https://github.com/dart-lang/sdk/issues/35828
> Change-Id: Ie7757cb2e0cbc0cfdd1530b75f34ffb3dd3156dd
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302680
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Samuel Rawlins <srawlins@google.com>

Bug: https://github.com/dart-lang/sdk/issues/35828
Change-Id: I05ddcf7657069b1e889b5b0019faaf7301f6643b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302781
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-11 14:00:06 +00:00
Sergey G. Grekhov 375e83d08c [co19] Roll co19 to 29df8c5030f62f8d9e382dd7ff69600f6d5e7bf2
2023-05-11 sgrekhov22@gmail.com Fixes dart-lang/co19#2044. Use `async` closure for async loops (dart-lang/co19#2045)
2023-05-11 sgrekhov22@gmail.com Fixes dart-lang/co19#2042. Replace `extends StreamConsumer` by `implements ...` (dart-lang/co19#2043)
2023-05-10 sgrekhov22@gmail.com dart-lang/co19#1959. Tests for class modifiers restrictions and type aliases (dart-lang/co19#2030)
2023-05-08 sgrekhov22@gmail.com Fixes dart-lang/co19#2039. Add and use asyncThrows method (dart-lang/co19#2040)
2023-05-08 sgrekhov22@gmail.com dart-lang/co19#1401. Async for-in element tests added (dart-lang/co19#2033)

Change-Id: Ic537cbf46cfae9880cc9ef3469c0273798ac26e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302784
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-05-11 13:46:51 +00:00
Tess Strickland 6b922021a1 [platform] Fix include of vm/globals.h instead of platform/globals.h.
TEST=build

Change-Id: If9e88f09268ff9aecd483734924c9c6f6170d4fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302783
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2023-05-11 11:53:56 +00:00
Chloe Stefantsova e3ba23a5f7 [cfe] Detect usage of type variables in record types in supertypes
Additionally, the CL adds a runtime check for handling all of the type
builder kinds in the function for type variable usage detection.

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

Change-Id: I84c7b53f4f0cfc39a18356d5b35fbdc843bb8a5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302740
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-05-11 10:54:28 +00:00
Alexander Aprelev 3a668dcf03 [vm/win/aot] Provide unwinding information for Windows AOT snapshots.
Fixes https://github.com/dart-lang/sdk/issues/52045
TEST=ffi_induce_a_crash_test

Change-Id: Ic047df10732d6ff8cf695ce098d80ec3a098dbf9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302380
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-05-11 03:14:27 +00:00
Konstantin Shcheglov 838c926f64 Issue 35828. Don't report COULD_NOT_INFER when InvalidType, make it a subtype of everything.
Bug: https://github.com/dart-lang/sdk/issues/35828
Change-Id: Ie7757cb2e0cbc0cfdd1530b75f34ffb3dd3156dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302680
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-05-11 01:05:51 +00:00
Konstantin Shcheglov 6c995aab3f Issue 26710. Don't report NON_CONSTANT_DEFAULT_VALUE when InvalidType.
Bug: https://github.com/dart-lang/sdk/issues/26710
Change-Id: I43e68aa46de338c3ebcfafa5eec21eebeab3be54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302660
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-05-11 01:05:47 +00:00
Nate Biggs 776b614018 [dart2js] Add stage flag to Dart2JS.
Maintains functionality of existing '--write-X-uri' and '--read-X-uri' but also introduces new '--stage' flag that indicates which phases of the compiler should run.

Also expands the behavior of the `--output` flag to support taking a file prefix and/or an output directory that files are written out to.

Valid invocations can look like:
`dart2js main.dart --stage=cfe`
`dart2js main.dart --stage=cfe --output=prefix1-`
`dart2js main.dart --stage=cfe --output=/some/path/`


Change-Id: If90fb16f549d35f16f77d660c51f8d28673e454f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/300520
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2023-05-10 22:43:37 +00:00
Nate Biggs 9a25f65eb6 [dart2js] Introduce formalized phases to Dart2JS.
This change locks down the Dart2JS command line API to the few invocation flows we use today:
1) Full compile from Dart sources.
2) Full compile from pre-compiled dill sources (modular CFE).
3) Phased compilation from Dart sources.
4) Phased compilation from pre-compiled dill sources (modular CFE).

It also ensures that each phase is run individually (accounting for sharding in codegen/emitter).

There are already places in the code where we assume that Dart2JS will be invoked in one of these ways so this should codify those assumptions.

Change-Id: I4e2a85d123e0c2ad924e2dd1b230548a995af0da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/299760
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2023-05-10 22:43:37 +00:00
Tess Strickland 4b8aa6a634 [vm] Update assembler to access AbstractType::flags_ as Uint32.
In d592882f, the old uint8_t `type_state_` and `nullability_` fields
in subclasses of `AbstractType` were merged into a single uint32_t
`flags_` field in `AbstractType` itself.

Accessing the nullability information was abstracted into two methods:

* `LoadAbstractTypeNullability`
* `CompareAbstractTypeNullabilityWith`

However, the code from these methods were based off the old
`CompareTypeNullabilityWith` and `CompareFunctionTypeNullabilityWith`
methods that used unsigned byte loads to access the old field, and kept
that even though the new field is now a 32-bit unsigned integer. This
works for now, because the nullability portion of the `flags_` field
happens to be the lowest two bits, but might lead to confusion if
someone attempts to write similar code for accessing the other parts of
the `flags_` field without realizing it's larger than 8 bits.

Thus, this CL does the following:

* Unifies the implementation of both methods across architectures.
* Adds a native slot definition for the `AbstractType::flags_` field
  and uses `LoadFromSlot` to load the `flags_` field instead. Other
  places where the `AbstractType::flags_` field is accessed from the
  assembler are also changed to use `LoadFromSlot` appropriately.

TEST=The existing suite of tests are sufficient.

Change-Id: Ie578e4dddce810223ca9e767403136cb40d340f3
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-release-x64-try,vm-aot-linux-release-simarm_x64-try,vm-aot-linux-release-simarm64-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-simriscv64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-linux-debug-x64c-try,vm-kernel-precomp-linux-release-simarm-try,vm-linux-release-x64-try,vm-linux-release-simarm64-try,vm-linux-release-simarm-try,vm-linux-release-ia32-try,vm-linux-debug-simriscv64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302187
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-05-10 22:40:58 +00:00
Kallen Tu 9c34ff75db [analyzer] Produce error when omitting base/final/sealed on base/final superclasses through legacy libraries.
When a post-feature library implements a pre-feature library declaration that has a final core library class as a super declaration, it should not produce a base/final/sealed transitivity error. Subclasses of a base core library class will still emit this error.

Otherwise, if base/sealed/final is omitted in a non-implement case, we want to report these errors.

Bug: https://github.com/dart-lang/sdk/issues/52315
Change-Id: Icdd4f63f69b061be5eabc7fd30b703d0358018a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302365
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-05-10 22:05:59 +00:00
Robert Nystrom 73dea244cc Roll the latest dart_style into the SDK.
This has a few changes. One of them affects code even before Dart 3,
though it only touches parameters with metadata on them, which tend to
be rare (outside of uses of the freezed package). It may affect code in
the SDK repo.

The other two are specific records and patterns so won't affect much
existing code. But the formatted behavior before these bug fixes looks
pretty bad, so if it's not too much risky, I think it's worth cherry
picking into the next stable point release.

Change-Id: I1e60d251b474b099c5059ffa63ddb260f0ed1318
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302500
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2023-05-10 21:39:48 +00:00
Konstantin Shcheglov 25b2a4c989 Issue 52340. When inline method, check for string interpolation of parameters.
Bug: https://github.com/dart-lang/sdk/issues/52340
Change-Id: Ic8d74778e62b3bee2152bf921fbb48d2febd3701
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302641
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-10 20:57:37 +00:00
Konstantin Shcheglov a3956e49d0 Use InvalidType instead of DynamicType when unresolved.
Bug: https://github.com/dart-lang/sdk/issues/36697
Change-Id: If982ca46030959160f21950c5b5e3127895d937b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/300181
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-10 20:38:48 +00:00
Daco Harkes 4992725ac2 [deps] Auto-roll pkgs in native
Change-Id: Icfbf9821e60e33ea86e912ffec00f925b755a43e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302624
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
2023-05-10 20:20:55 +00:00
Devon Carew 44afc0ea19 [deps] revert the recent package:csslib roll
Change-Id: I72ee802a53c57d5f44c8bcb31e1573379cff9863
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302449
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-05-10 19:34:49 +00:00
Paul Berry cb0eb28cba Account for differing flow analysis conventions between CFE and shared code.
With one exception (noted below), the shared analysis logic uses the
convention that the expressions passed to flow analysis are the
original (pre-lowered) expressions, whereas the expressions passed to
flow analysis by the CFE are the lowered expressions. This difference
caused two problems:

- If a boolean expression appeared on the right hand side of a pattern
  assignment or pattern variable declaration, and it was lowered, the
  flow analysis implications of that boolean expression would be lost.

- If a boolean expression appeared in a `when` clause, and it was
  lowered, the flow analysis implications of that boolean expression
  would be lost. Exception: for switch statements, the shared analysis
  logic has been passing lowered expressions to flow analysis, so this
  problem didn't occur for `when` clauses in switch statements.

Notably, when compiling for the VM, the CFE lowers expressions like
`x != null` to something more like `!(x == null)`.

Fortunately, the first of these two situations shouldn't cause
problems very often, since typically if the right hand side of an
assignment or variable declaration is a boolean expression, there is
no need for the left hand side to involve patterns.

As for the second of these two situations, it's also not too likely to
cause problems, since typically null checks occur inside patterns
rather than in `when` clauses.

As a short term fix, we remove the exception noted above, and we
account for the difference in conventions by adding a call to
`FlowAnalysis.forwardExpression` to the CFE's implementation of
`dispatchExpression`, so that when transitioning between CFE logic and
shared logic, flow analysis will be informed how to match up the
lowered expressions to their pre-lowered counterparts.

Longer term, I would like to switch everything to the convention of
using the original (pre-lowered) expressions; this will bring the
analyzer and CFE into better alignment with each other and should
eliminate a class of subtle bugs. This long term goal is tracked in
https://github.com/dart-lang/sdk/issues/52189.

Fixes #52183.
Fixes #52241.

Bug: https://github.com/dart-lang/sdk/issues/52183, https://github.com/dart-lang/sdk/issues/52241.
Change-Id: I2449ce34c54325603bc2730d1660a7cfc7d79aec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/298840
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-05-10 19:31:19 +00:00
Martin Kustermann 3ed8736bdd [vm] Make [ReloadOperationScope] a macro instead of a class
The [ReloadOperationScope] has [StackResource]s as fields and is itself
a [StackResource] which is problemantic if unwinding happens manually.

So we'll make it a macro that expands to the 3 fields instead.

TEST=ci

Change-Id: I3fb7bec7ca87193c83ec34908f9a43c5db005900
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302201
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-05-10 19:08:23 +00:00
Derek Xu 6c3c34560e [VM/Service] Add code for working with Perfetto protos to package:vm_service
TEST=get_perfetto_vm_timeline_rpc_test and
get_perfetto_cpu_samples_rpc_test

Change-Id: I23a30629f1d7a8cd7e2c9daad2d02fae4decb338
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302421
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-05-10 19:06:10 +00:00
Derek Xu e26fe2817c [VM/Timeline] Start skipping over dart::TimelineEvents that provide no useful information when writing Perfetto traces
TEST=Checked that traces written using the Perfetto file recorder, and
traces retrieved through `getPerfettoVMTimeline` still looked correct.

Change-Id: I7e327ef525c99187fa8aea868d1cc48721af9f98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302420
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-05-10 19:06:10 +00:00
Helin Shiah 5d57b747e9 Change dev dependencies
Change-Id: I2ad300cfacb096bac68f91f606e8bd054e83da71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301504
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Helin Shiah <helinx@google.com>
2023-05-10 18:43:06 +00:00
Robert Nystrom 9cd43f7d7d Fix switch expression example in CHANGELOG.
Fix #52338.

Change-Id: Ia7ebaaa202003090894bb2c9e7daea0a1694bae5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302447
Reviewed-by: Michael Thomsen <mit@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2023-05-10 18:26:19 +00:00