Commit graph

41406 commits

Author SHA1 Message Date
Nicholas Shahan c39ac36ed3 [3.0 alpha][dart2js] Remove use of NullThrownError
It is being removed in Dart 3.0 and a `TypeError` should be used
instead. This is true in legacy code as well and all test
expectations will be updated.

Change-Id: I021fa4ecb1a9bbc404598113c65349e17926cd91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275782
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-12-15 21:36:56 +00:00
Ahmed Ashour f652c7962b [analysis_server] fix AddNullCheck with null-aware operators
Fixes #50506

Change-Id: I8f7564ec7aaaf32888e9979254e450cd2633e307
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274442
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-12-15 21:13:41 +00:00
Ryan Macnak 933d2cf4e7 Change the default architecture in test.py from x64 to host.
This brings test.py into agreement with build.py, and makes development on arm64 hosts nicer.

Change-Id: Ic544b4eee0e27d9f395328297ed6108d4e4689f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257800
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-12-15 20:41:33 +00:00
Kallen Tu 8e1162cb72 [analyzer] Add mixin classes to ClassElementImpl
Change-Id: I41cbbf218a9c8d7c26fa8f32e3b8022c51b42789
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275521
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-12-15 19:20:06 +00:00
Michael Thomsen bcbf24ec3d [3.0 alpha] Remove deprecated CastError and FallThroughError dart:core errors
TEST=ci

Bug: https://github.com/dart-lang/sdk/issues/49529
Change-Id: I52495d3e5319f0555714f4f8247149afc06128a1
Cq-Include-Trybots: luci.dart.try:vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try,vm-kernel-nnbd-mac-debug-arm64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,dart-sdk-linux-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259041
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-12-15 13:38:47 +00:00
Lasse R.H. Nielsen 2274ce9b05 Retire experiment flags introduced in 2.18.
Change-Id: I660bbf09c758f88589a10b0334ddd34c0620460d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275244
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
2022-12-15 13:18:50 +00:00
Alexander Markov 7ebd4dd61c [3.0 alpha] Remove deprecated public class CyclicInitializationError
This deprecated class cannot be removed just yet because
we still need to throw something in case of cyclic initialization
in Dart legacy libraries (which are still supported).

Class CyclicInitializationError is copied for each implementation
(VM, dart2js and DDC) and made private. Each implementation now has
an independent private class which can be removed separately.

TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/49529
Change-Id: I8100bbe16636c12c4cbabbb5fe770f4c648c4249
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275120
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-12-15 11:20:58 +00:00
Ilya Yanok 822d15e7cc nnbd_migration: fix crash on mixin override
Migration tool currently crashes if a class overrides
some methods it got by adding a mixin.

Added a test for that and fixed the crash, the fix
boils down to casting to just `InterfaceElement` instead
of `ClassElement`.

Tested: added a new test
Change-Id: Iab5ddb26c4930ed2020d6f3caa0710e55f24d8c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275721
Commit-Queue: Ilya Yanok <yanok@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2022-12-15 09:19:38 +00:00
Ömer Sinan Ağacan 6cda72d39e [dart2wasm] Add special case for const adjacent strings
Language specification (section 17.2) says two strings are identical
when they're both constants and equal.

It doesn't mention adjacent strings, but looking at the tests, it seems
like juxtaposition of constant strings are expected to be constants as
well.

This adds a special case in string juxtaposition compiler to handle the
case where parts of the adjacent strings are all constants.

New passing tests:

- co19/Language/Expressions/Instance_Creation/Const/canonicalized_t05
- co19/Language/Expressions/Strings/adjacent_strings_t02
- language/const/string_test

Change-Id: Ib46582be492ba20c417546cbfb4e67b2d90e3ba3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275200
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-12-15 07:45:47 +00:00
Sam Rawlins f30e5de558 Remove preview-dart-2 option in analysis options
Fixes https://github.com/dart-lang/sdk/issues/50680

AnalysisOptionsHintCode is moved from generated `option_codes.g.dart` to `option_codes.dart`, for non-generated diagnostics:

* AnalysisOptionsHintCode.DEPRECATED_LINT_HINT and
* AnalysisOptionsHintCode.DUPLICATE_RULE_HINT

Change-Id: I131fb2901fca26ff971b6c9c519ab2f0b983a65c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275500
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-12-14 21:04:29 +00:00
Tess Strickland bd81c8bc06 [pkg/dart2native] Add checks to avoid MachO-related regressions.
Now that 9df6656aa9 has appropriately propagated and the build rules in
google3 have been updated, re-add checks to ensure that the empty
section used to pad the original header exists and that the new header
is smaller than the old header.

Bug: https://github.com/dart-lang/sdk/issues/49783
Change-Id: I5b8b31bf9edf4814686eb7928457a9a7d53c0727
Cq-Include-Trybots: luci.dart.try:dart-sdk-mac-try,dart-sdk-mac-arm64-try,pkg-mac-release-arm64-try,pkg-mac-release-try,vm-kernel-mac-release-arm64-try,vm-kernel-mac-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275622
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-12-14 20:16:57 +00:00
Brian Wilkerson ce99386077 Update the noSoundNullSafety flag to allow for testing
Change-Id: Ibf79675c758ffefaa8af7488dd1965f0fabbfc4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275741
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-12-14 19:13:28 +00:00
Jens Johansen 959f0a299c [analyzer] Report memory usage on Windows too
Change-Id: I6a31370c51e40a9593f8875d365a43d9f4111aaf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275660
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-12-14 18:11:25 +00:00
Paul Berry c6d287cc05 Move business logic into shared patterns analysis for relational patterns.
Previously, the client had to know that the relational operator should
be looked up in the matched value type.  Now the shared analysis logic
requests the lookup and supplies the appropriate type.

It's a small change, and one might argue that it doesn't really move
around very much business logic, but it makes the tests more readable
so I think it's worth it.

Change-Id: I936d5f5f929f11800efe25974334c898c7e1072d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275360
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2022-12-14 17:25:59 +00:00
Danny Tuppeny ec8918c20c [dds/dap] Handle errors parsing/casting launch/attach arguments and provide useful errors
Fixes https://github.com/dart-lang/sdk/issues/50709.

Change-Id: I35a7593ced462ab81d52069db831e5f95a9a4ba7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275623
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2022-12-14 17:19:05 +00:00
Joshua Litt 9b79ab636c [dart2wasm] Chunk copying large strings to JS.
This change is necessary for large strings because otherwise we hit V8's maximum argument limit to a function.

Change-Id: I2473d1c5acd62f16d509752c437678c697e7ebeb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275480
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-12-14 17:16:01 +00:00
Sam Rawlins a5392b932b Re-categorize all SDK_VERSION_* codes as StaticWarningCode
Change-Id: If7a83f9f3258ce369dbe3142fcd5c088d6d88e40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-12-14 16:14:38 +00:00
Kallen Tu 120bfdc076 [analyzer/cfe] Parse 'mixin class' behind sealed flag.
Allow 'mixin class' modifier which allows a class to be used as a mixin.
https://github.com/dart-lang/language/blob/master/working/base-interface-final/feature-specification.md

Change-Id: I6b4dac75f2ff09b7ef833c5e015b1baf7fa3883b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275144
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-12-14 15:41:58 +00:00
Paul Berry 9b294b846b Only set isExplicitlyExhaustive on switch statements without default clauses.
This enables the front end to skip the old-style (enum-based)
exhaustiveness checking algorithm when pattern support is enabled,
because with pattern support enabled, switches on enums are required
to be exhaustive (this will be checked by the new exhaustiveness
checking algorithm).

That in turn means that in the future, when we remove support for
language versions that lack patterns support, we will be able to
remove the old-style exhaustiveness checking algorithm.

This change has a small effect on code generated by the WASM back-end
(the only back-end that uses `isExplicitlyExhaustive`): for a switch
statement that is exhaustive *and* has an unreachable `default`
clause, after testing all the cases, the WASM back-end will generate a
branch to the `default` case.  Previously it would instead generate an
`unreachable` instruction.  There should be no behavioural difference
because the instruction in question is unreachable in both cases.
Also, there should be negligible code size difference because the body
of the `default` case is being emitted either way.

Bug: https://github.com/dart-lang/sdk/issues/50419
Change-Id: Id6bd7d9a540cb1b4d9c3624db8ff494438276bea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274924
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-12-14 14:38:50 +00:00
Paul Berry 607b370933 Shared patterns analysis API: remove matchedType from method calls.
A desired feature for flow analysis of patterns is that the matched
value type of one subpattern may depend on promotions from previous
patterns.  For example, we want this to work:

    int? x = ...;
    if (x case null || < 0) ...;

This means that although the type of the scrutinee is `int?`, after
the subpattern `null` has been processed, type promotion should
promote the matched value type to `int`, so that the subpattern `< 0`
doesn't report an error.

This requires changing the API of the shared patterns analysis logic,
so that the client is no longer responsible for passing around the
matched value type.  Instead, flow analysis keeps track of it and
provides it to the client when requested.

In follow-up CLs I'll add the necessary logic to flow analysis to
actually promote the matched value type in situations like the example
above.

Change-Id: I6ce66962af32f9bd93bfe4082ba256de627d3cc6
Bug: https://github.com/dart-lang/sdk/issues/50419
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274942
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2022-12-14 14:06:30 +00:00
Ömer Sinan Ağacan af5c53b087 [dart2wasm] Mark static variables initialized on assignment
New passing tests:

- co19/LibTest/core/Stopwatch/stop_A01_t01
- language/getter/setter_getters_setters_test
- language/identifier/naming_test
- language/lazy/static3_test
- language/lazy/static7_test
- language/lazy/static_test
- language/loop/for_in2_test
- language/new/statement_test
- language/nnbd/inference/variables_initialized_to_null_test
- language/operator/operator_test
- language/setter/setter0_test
- language/setter/setter1_test
- language/super/call2_test
- language/unsorted/inv_cse_licm_test

Change-Id: Id7dd53228f1476190dffe3b22ba91d04ed4c2a14
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275320
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2022-12-14 13:38:27 +00:00
Johnni Winther 77e24a6736 [cfe] Migrate noSuchMethod forwarder tests to null-safety
Change-Id: I7fbfc06a864eaaf4052b736d756410be5d1ab531
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275601
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-12-14 13:12:09 +00:00
Johnni Winther e550718712 [cfe] Compute noSuchMethod forwarders in members builder
TEST=existing

Change-Id: I24c6732bf2b099af249fa5f461b1933b4259b708
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272301
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2022-12-14 09:25:57 +00:00
Johnni Winther cc35b9bcda [patterns] Handle nullability in StaticType for top/nullType
This updates the exhaustiveness implementation to have specific static
built-in types for nullableObject (the top) and its underlying nonNullableObject,
nullType and its underlying neverType. In the previous encoding, the top
wasn't nullable (if you queried the isNullable property) but was still
assumed to contain `Null` in other parts of the code.

With this change, the top space is now an ExtractSpace based on
StaticType.nullableObject, the empty space is an ExtractSpace based on
StaticType.neverType and record spaces are based on
StaticType.nonNullableObject.

The StaticType is now split into a StaticType interface and a
StaticTypeImpl implementation class for the non-built-in types. This
prepares for integrating the exhaustiveness checking with the analyzer
and CFE where the properties of the sub/supertype relation and fields of
the StaticType needs to be computed lazily.

Change-Id: I5a6919d7cba356f9bc8ac3f69fd3ac2b41319e9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274020
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-12-14 09:21:27 +00:00
Johnni Winther 434b65470b [cfe] Rename *ViewBuilder to *InlineClassBuilder
Change-Id: I4f4c6d076c25efa71f9f346eedc9431d8f0b5afb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275420
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-12-14 08:41:10 +00:00
Johnni Winther 81845864ca [kernel] Rename View* to Inline*
TEST=existing

Change-Id: I8726c936261ceb770b489f264d14fff02a1b4998
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275243
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-12-14 08:36:57 +00:00
Nate Biggs 0ebed3f7d5 [dart2js] Make _call non-null in CallSiteTypeInformation nodes.
Change-Id: I114b772f72dc377ea1a8a3499318fe71f1ea56da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275460
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2022-12-14 02:20:21 +00:00
Stephen Adams d633b0a383 [dart2js] More records implementation
These are scattered changes to get to type inferrence.

- Add some impact tracking for used record types
- Add RecordTypeInformation and FieldInRecordTypeInformation
- Add a simple test to show inference is currently very conservative.

Change-Id: Icb81033b11588c1bddd01c8c5fcf69950fdb77e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275161
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-12-14 02:20:18 +00:00
Jackson Gardner 1306a4c284 [dart2wasm] Add intrinsics for bitwise operations on booleans.
Change-Id: Ic09545535c954d72615ca035ed1b133fada5d733
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275080
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
2022-12-13 23:07:40 +00:00
Nate Biggs c15f248840 [dart2js] Fix linearization call tracking.
`null` was being included in the set of called nodes and this was causing members normally called once to not be inlined.

Change-Id: Ie42302e47691bb924dea1e54b82e08072c0ecd7b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275122
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2022-12-13 22:23:17 +00:00
Brian Wilkerson 1aebb81274 Improve the error message produced by ThrowingAstVisitor
Change-Id: I4f4d725d52a244d9c37bc44802782f7d8e97ab9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275400
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-12-13 21:56:05 +00:00
Sam Rawlins ea120b5d44 Remove all support for all 'strong-mode' analysis options
Fixes https://github.com/dart-lang/sdk/issues/50679

Change-Id: I3572faf51276f5c7551d35b7725c799567189413
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274921
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-12-13 21:32:24 +00:00
Brian Wilkerson 1b624249c2 Remove some unnecessary ignore comments in dart2native
Change-Id: I77a5f0fc48c6f4a814a1d7382ce67ce02ff62a19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274724
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-12-13 21:29:26 +00:00
Aske Simon Christensen f053d2170d [dart2wasm] Put function types of imports in singleton rec groups
Starting from ba6be821c99db09b0ef2689dea8f0cb863c47ff5 (11.0.194), V8
enforces type equivalence according to the canonical iso-recursive
types for functions imported from other modules or constructed using
`WebAssembly.Function`, which means that to match such a type, a
function type declared in a Wasm module must be declared in a
singleton rec group.

To be compatible with this new canonicalization scheme, we define the
function types for all imported functions each in their own rec group
separately from other types.

Change-Id: I166b4b7d1c8fa48638f816f874f737536a61f15d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274388
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-12-13 20:43:22 +00:00
Aske Simon Christensen 905b913a77 [dart2wasm] Classify value types in identical based on class ID
This avoids reliance on the distinctness of the Wasm types.

Change-Id: I23762c674fcf8b2101da30d91f0b6db9ae947d79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274681
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-12-13 20:43:22 +00:00
Johnni Winther e742ecfa9e [parser] Parse 'inline' instead of 'view'
Change-Id: I2ec0553fccf6caa3aa93275955c9e8e2213ee7f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275240
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-12-13 19:38:38 +00:00
Sam Rawlins 35f0bb8187 Stop using strong-mode options in dart2js_runtime_metrics and scrape
Change-Id: I89347335d14ecf539fc7ea7fc44bd31680dbc458
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275302
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-12-13 18:27:22 +00:00
Sam Rawlins fdf59ad1eb Remove all support for super-mixins option
Bug: https://github.com/dart-lang/sdk/issues/50680
Change-Id: I96409d02e64d3e198e0fae4a55f58f871ce2aeac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275142
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-12-13 18:13:37 +00:00
Johnni Winther e6d59342ff [cfe] Build PatternVariableDeclaration in BodyBuilder
Change-Id: Ic55dbc03bf2cf4865275b186266c0f420263d406
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273744
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2022-12-13 17:03:13 +00:00
Tess Strickland e44cece2ca [CFE] Fix compileSdk check in CompilerOptions.equivalent.
Change-Id: I3c8e7917e45d441f712c5643a6ecba4ece6450f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275242
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-12-13 16:51:51 +00:00
Dan Chevalier fd6fa010ec [ VM Service / DDS ] Add custom service stream support (Revised)
NOTES:
Original CL: https://dart-review.googlesource.com/c/sdk/+/274061
Revert CL: https://dart-review.googlesource.com/c/sdk/+/274802

Regression tests that failed after merging Original CL:
- https://ci.chromium.org/ui/p/dart/builders/ci.sandbox/pkg-mac-release/24046/overview
- https://ci.chromium.org/ui/p/dart/builders/ci.sandbox/pkg-mac-release-arm64/5999/overview

----------
DESCRIPTION:
Setting the `stream` parameter on `developer.postEvent` will now forward those events to a custom stream inside DDS.


The first use of this will be for widget inspection. A navigation event will be posted to a custom stream. Our IDE DAP can listen for the Event and react to it by navigating to the desired location in the code.

TEST=Made sure that regression from original PR could be reproduced, and then resolved by applying this change. Updated observatory tests. Created new developer test to check assertions. Added DDS tests for new custom stream behaviour. Manually tested the postEvent and StreamListen with multiple clients

https://github.com/flutter/devtools/issues/4533

Change-Id: I2b04a84b4daf11dd9d72f899928b5e1f62a5ae02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275121
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-12-13 16:31:37 +00:00
Derek Xu 53d859f6b9 Revert "[VM/CLI] Remove dartdev.dill"
This reverts commit c09f790d37.

Reason for revert: CI failures

Original change's description:
> [VM/CLI] Remove dartdev.dill
>
> Incompatible VM flags will no longer break the CLI when running from an
> AppJIT snapshot, so the fallback logic is no longer required. This CL
> thus removes dartdev.dill and the fallback logic.
>
> Relevant past CLs: https://dart-review.googlesource.com/c/sdk/+/157601
> and https://dart-review.googlesource.com/c/sdk/+/178300
>
> Fixes https://github.com/dart-lang/sdk/issues/50504
>
> TEST=I tried running `out/ReleaseX64/dart --observe --sound-null-safety test.dart`
> and `out/ReleaseX64/dart --observe --no-sound-null-safety test.dart` and
> both worked.
>
> Change-Id: I5cdcfbccf71ec557964014fdb80733b4a7c76b4d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274520
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Derek Xu <derekx@google.com>

TBR=bkonyi@google.com,derekx@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I5117f990dfabf93f5a9bae56098831280845e84e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275181
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2022-12-13 15:28:19 +00:00
Paul Berry c430a3b4aa Patterns flow analysis: fix handling of empty exhaustive switch statements.
I previously thought that the only possible situation where a switch
statement over a valid type could be exhaustive without containing any
cases was if the scrutinee type was the empty record type (`()`).  But
that isn't true at all:

- The empty record type is inhabited by empty record objects, so such
  a switch statement would not be exhaustive after all.

- It is possible for the user to create a type that can be
  exhaustively switched over with zero cases: by creating an abstract
  sealed class without any subclasses.

In the latter case, I think it makes the most sense to treat the code
after the switch as unreachable, because that's the normal behaviour
of a switch over an exhaustive type with no `break`s.  It is sound to
do so because the type is uninhabited, therefore the body of the
switch statement itself will never be reached.

Bug: https://github.com/dart-lang/sdk/issues/50419
Change-Id: Ibc0a21226f25ae155db994343874354d5b8e4f7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274621
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-13 14:36:57 +00:00
Paul Berry 9169abc8f4 Add SwitchStatementTypeAnalysisResult.requiresExhaustivenessValidation.
This boolean tells the analyzer and front end whether it is required
to run the exhaustiness algorithm on the switch statement (and to
report an error if the switch isn't exhaustive).

Bug: https://github.com/dart-lang/sdk/issues/50585
Change-Id: I8c95e563bd59a83cf5e1b94170af5c4f8b5c6496
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274925
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-13 14:35:37 +00:00
Paul Berry a29cd031d3 Analyzer: fix dead code detection in top level declarations.
Fixes #49701.

Bug: https://github.com/dart-lang/sdk/issues/49701
Change-Id: I77fa7faf1dbfcda04a73eedcf0614c2f852b1dac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275041
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-13 14:13:18 +00:00
Paul Berry 87f2429051 Shared patterns analysis: make TypeAnalyzer.flow non-nullable.
This simplifies the shared TypeAnalyzer code by avoiding a lot of null
checks.

This required modifying a few analyzer code paths that didn't
previously initialize FlowAnalysis so that they now do.

Change-Id: Ie306d3ac94c4ca00d211e9cd038fb0b001996747
Bug: https://github.com/dart-lang/sdk/issues/50419
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274940
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-13 13:10:08 +00:00
Brian Wilkerson 9488163d7e Add a flag to temporarily allow pre-null-safe code to be analyzed
Change-Id: I89e3d1cbdc47d2a7c5c9e7e04d1dd5ab1855e8c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275140
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-12-13 01:07:35 +00:00
Nate Biggs 750b684cf9 [dart2js] Fix small bug in linearization.
Change-Id: Icc8c91131eaf8f1a7d10482f8549aa522552d05f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274960
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-12-12 23:48:53 +00:00
pq 331185dbef fix generator script
Change-Id: I1b0ce85aff6d80608d9ad1de90923bff59c686bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275141
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-12-12 23:06:06 +00:00
Johnni Winther aa51913101 Rename 'views' experimental flag to 'inline-class'
This feature is about to be renamed from Views to Inline Classes and
we adjust the flag name accordingly. The rename PR hasn't landed yet,
but we update the flag now to unblock work on co19 tests.

Change-Id: Ib6981b99f8541ed75f3315059a8bbca02f3a4579
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275000
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
2022-12-12 22:22:39 +00:00