Commit graph

47685 commits

Author SHA1 Message Date
Danny Tuppeny 1b302b8df0 Move tests for switch enum cases for >= 2.19 from AddMissingEnumCaseClausesTest to AddMissingSwitchCasesTest_SwitchStatement
The tests in this class were duplicated when pattern support was added, one set
of tests for <= 2.19 and one for > 2.19. The> 2.19 tests were marked as Failing
because this functionality didn't work.

This functionality has now been implemented, but because the error code and fix
are different, these tests continued to fail. This change moves the tests to
the equivalent pattern-enabled fixes tests and removes `@FailingTest` for
those that can now pass.

There are still a few marked `@FailingTest` because of differences in the new
implementation.

See https://github.com/dart-lang/sdk/issues/52180#issuecomment-2166814402

Change-Id: Ie1dfa5bc5c608d38a191507f5f0403d20ba2ef31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371684
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-14 15:48:51 +00:00
pq 24156d0b67 [wildcards] code folding tests
Fixes: https://github.com/dart-lang/sdk/issues/56009

Change-Id: Iad1f197388d0b89e9bd9b31cc82a496cf578380b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371663
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-14 15:44:19 +00:00
Ben Konyi fa89a0183e [ package:vm_service ] Prepare for 14.2.4 release
Change-Id: Ibee954dcbac5f7ac592686440e3d6a7fdc83b522
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371581
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
2024-06-14 14:01:58 +00:00
Martin Kustermann 7078310249 [dart2wasm] Specialize string interpolation expressions for 1/2/3/4 arguments
This affects very common string interpolation expressions where we now
avoid creating arrays and looping over arrays and casting references
when getting things out of arrays.

e.g. `StringBuffer.write()` uses "$obj" in it's implementation
which will benefit from this.

Change-Id: Ie6615e5f76a4a8ccb4ff9aa85c05c7e39eab6f00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371660
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-06-14 12:33:51 +00:00
Johnni Winther 4b704b8f0b [cfe] Use SourceCompilationUnit in SourceLoader.tokenize
This moves a lot of the methods needed for tokenization and
outline parsing from SourceLibraryBuilder to SourceCompilationUnitImpl.

Parts that are still used elsewhere remains in SourceLibraryBuilder
but accessed through SourceCompilationUnitImpl.

Change-Id: I0df431eee4c187e5447850961d2c27be14cb0ba3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371682
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-06-14 10:49:48 +00:00
Johnni Winther 289bba506e [cfe] Remove LibraryBuilder.nullableBuilder et al.
Change-Id: I36b2a8c25568d4df90a6a1b039d15519d244be96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371123
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-06-14 10:10:20 +00:00
Johnni Winther 74d2eb28a6 [cfe] Add DillCompilationUnit and SourceCompilationUnit
This adds DillCompilationUnit and SourceCompilationUnit and separates
CompilationUnit from DillLibraryBuilder and SourceLibraryBuilder.

This prepares for creating SourceLibraryBuilders only after
CompilationUnits have been resolved into parts and main libraries.

Change-Id: I1b8e77ac66648f7d12ee7f09826d305fdfccb363
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371300
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2024-06-14 08:47:46 +00:00
Martin Kustermann 6f21d19b02 [dart2wasm] Add flag to allow experimental wasm interop.
Adds a flag users can use via

    dart compile wasm \
        --extra-compiler-option=--enable-experimental-wasm-interop

which allows code to import `dart:_wasm` and use import/export
pragmas.

Similar to how we have a way to import `dart:ffi`

    dart compile wasm \
        --extra-compiler-option=--enable-experimental-ffi

TEST=web/wasm/allow_import_export_pragmas_test (positive test)
TEST=web/wasm/reject_import_export_pragmas_test (negative test)

Change-Id: Ibdbbac6c3aa049b2759e96b7b749dd30ecc6aaed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370063
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-06-14 07:01:58 +00:00
Martin Kustermann 18ffc284c3 [dart2wasm] Remove deprecated --name-section flag from dart compile wasm
Change-Id: I1e1746c408a704d23db1dbf05b554afda667a0ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371540
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2024-06-14 06:50:18 +00:00
Sam Rawlins 50e4c576b9 analyzer: fix various issues for static extension member resolution
* Unqualified, out-of-scope static extension members are not
  accessible.
* Locally scoped extension members shadow others.
* Static and instance extension members do not conflict.

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

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

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: Icd618d044b3857efa24f365c6835d42c0022c176
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370323
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Sam Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-06-14 00:59:57 +00:00
Konstantin Shcheglov b4e30d1b45 CQ. Deprecate unused static members of AnalysisError.
Change-Id: I46e76defbc9a833a867cc3fa2154635f71a6d085
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371422
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-06-13 23:39:21 +00:00
Mayank Patke bf83cc30ed [dart2js] Convert VariableUse to a sealed class hierarchy.
Change-Id: I28d71d81031e3e6eefc2b4f6decfe375099a1c32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371185
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2024-06-13 23:01:34 +00:00
Konstantin Shcheglov 7ae9900059 CQ. Deprecate File.createSource()
Change-Id: I222989d1ef915f7f14d7a3f36eab614a163faec3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371501
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-06-13 21:11:39 +00:00
Ben Konyi 9304826679 [ DDS ] Refactor DDS entrypoint to allow for overriding behavior in google3
This moves the CLI logic into lib/src/dds_cli_entrypoint.dart so it can
be invoked by a custom google3 entrypoint (bin/dds.dart can't be
imported using a package: URI).

Since google3 will be able to perform some custom configuration of DDS,
google3 related logic (e.g., `BazelUriConverter`) is also removed. This
is technically a breaking change, but should be safe as this
functionality isn't currently being used.

Change-Id: I54d8a9927ff2df70e013ca5c8bc1d510b0b95f02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371520
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
2024-06-13 20:27:22 +00:00
Konstantin Shcheglov 02faed0a9a Prepare to publish analyzer 6.6.0 and _fe_analyzer_shared 71.0.0
Bug: https://github.com/dart-lang/sdk/issues/55870
Change-Id: Ic06f4c0a2cc5dc5f07f72335dd172f203b948cb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371261
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-06-13 19:56:30 +00:00
Mayank Patke 0ddba91190 [dart2js] Convert SubclassResult to a sealed class hierarchy.
Change-Id: I151c2f6f72dcecaff6a6976f058940b9ddf97f47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371461
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2024-06-13 19:25:28 +00:00
Konstantin Shcheglov cc073a0782 Macro. Re-export package:_macros/src/executor/response_impls.dart from 'package:macros'.
Change-Id: I89e59cbac52edb5197e409e3000c5a3dedd80b3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371421
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2024-06-13 19:12:41 +00:00
Konstantin Shcheglov 9974252ac6 Increment DATA_VERSION.
https://dart-review.googlesource.com/c/sdk/+/371260 should have done this.

Change-Id: I34763f6221ad1c0f098d1c24eb9928935f917c78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371442
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2024-06-13 18:48:25 +00:00
Danny Tuppeny bf7f5171e5 [analysis_server] Treat field formal parameters and fields equally when finding references in LSP
This changes LSP's Find References to treat fields and field formal parameters as a single entity (matching what Document Highlights (Occurences) and Rename refactor does).

It does this in one direction by resolving the initial element to a field if it's a FieldFormalParameter, and in the other by including FieldFormalParameters when collecting the set of elements in the hierarchy to find references to.

Fixes https://github.com/Dart-Code/Dart-Code/issues/4868

Change-Id: I33626a8d58f35d0c3bda574078f32bf98f4bc87c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-13 18:34:33 +00:00
Keerti Parthasarathy 95f90f553f Remove unused code in test method.
Change-Id: I541762501e9546eaaf0f1022ebdebbeefe6413dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371460
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-13 18:30:10 +00:00
Mayank Patke ad3a1a72fd [dart2js] Convert IsTestSpecialization to sealed class hierarchy.
Change-Id: I08552d4dda928259be56e0b99f9f002baeb4d6b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371240
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2024-06-13 18:21:59 +00:00
pq dcf72c0882 quick fix for REPRESENTATION_FIELD_TRAILING_COMMA
See: https://github.com/dart-lang/sdk/issues/55917

Change-Id: Ib278e49749618325c8c5fcc7a5627840f87c4553
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371401
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
2024-06-13 18:02:14 +00:00
Danny Tuppeny 1ea71b4b9b [analysis_server] Handle unexpected types in LSP experimental client capabilities LSP gracefully
Previously if you sent values in experimental capabilities that are different types to what we'd expect, in some cases we'd throw an exception and fail to initialize the server.

Since the experimental section is not specified (it's specifically for off-spec things) the behaviour of sending values should (IMO) be considered server-specific. However, reporting a useful message and continuing to function is clearly better than reporting a cryptic error and failing to initialize.

At least one client (`kak-lsp`) appears to be sending values in `"commands"` intended for the Rust LSP server which uses a different format to we're using (a nested Map where we use a List). This change will prevent the failure for them and instead report a warning. My recommendation is that their client is also updated to not send Rust experimental capabilities to non-Rust servers.

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

Change-Id: I8cba1aa3a5beebf884ff247180f809ffd33b3111
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-13 17:29:49 +00:00
Konstantin Shcheglov 09d1522f8a DevX. Issue 39451. Sort (almost) UnlinkedTokenType.
I decided to keep NOTHING at the top still.
The google3 is not an issue any more, AFAIK.

Bug: https://github.com/dart-lang/sdk/issues/39451
Change-Id: Iac96c64326b15527268347ebcadb35c616605279
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-06-13 17:10:06 +00:00
pq 9e51c2fa74 quick fix for EMPTY_RECORD_TYPE_WITH_COMMA
(Also improves fix description for `EMPTY_RECORD_LITERAL_WITH_COMMA`.)

See: https://github.com/dart-lang/sdk/issues/55917

Change-Id: I742506d8c1a77b10f99861aa84947f8d348916df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371342
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-06-13 17:05:54 +00:00
Konstantin Shcheglov 4e8af3bb56 DevX. Issue 54497. DeclaredVariablePattern in ForEachPartsWithPattern to final.
Bug: https://github.com/dart-lang/sdk/issues/54497
Change-Id: Ifa195d29a1a4db47fa12c221e6969ed0d8578a72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371162
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-06-13 16:57:51 +00:00
Brian Wilkerson 80ba2a9524 Produce completion locations where previously produced
There are many places where the code is producing a different location
than OpType is, but those can be handled is a separate CL.

Change-Id: Idea7529a3e64ddb25a9b15bb68f7537abd3d19e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371202
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-13 16:44:48 +00:00
Brian Wilkerson aa3f144f1c Remove unnecessary code from some tests
Change-Id: If3ab5e836a1977ab1089cdefdeb661d8992543ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371183
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-13 16:06:09 +00:00
Ben Konyi bcaf745a9b [ package:vm_service ] Add missing code to code generator
Was added originally in https://dart-review.googlesource.com/c/sdk/+/367821

Change-Id: I7873e960319c10e995e24b1bb2514ede0c3299d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371360
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
2024-06-13 15:03:49 +00:00
Jake Macdonald 57fc55d934 rev the macros version, preps for a new release once publishing the package is fixed, see https://github.com/dart-lang/pub/issues/4305 for context
Change-Id: I8fe93ce7895fc6bb1b2ba896d8256366ae698ce0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371142
Reviewed-by: Morgan :) <davidmorgan@google.com>
Commit-Queue: Morgan :) <davidmorgan@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2024-06-13 14:03:08 +00:00
Martin Kustermann 68229c4e58 [dart2wasm] Make is/as-checker helpers be used even if operand type is not InterfaceType
Right now the optimized is/as-checkers are only used when the operand
type is an [InterfaceType]. That means they don't get used for e.g.

   dynamic obj;
   T obj2;
   obj is String
   obj2 is List<dynamic>;

But we can use the is/as-checkers on any operand type as long as the
type we test against is an [InterfaceType] without arguments or where
the type arguments are equivalent to defaults-to-bounds (i.e. require
no checking).

Issue https://github.com/dart-lang/sdk/issues/55516

Change-Id: I1adff52b3d880c37c344edb0c42ffd454d7b1164
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371124
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-06-13 13:18:59 +00:00
Martin Kustermann 6d185d2003 [dart2wasm] Make pkg/dart2wasm/tool/compile_benchmark more similar to dart compile wasm
This allows copy&past'ing commands from `flutter build web --wasm
--verbose` and replacing `dart compile wasm` with
`pkg/dart2wasm/tool/compile_benchmark`.

* We make the shell script recognize `-o` flag.
* We make the shell script recognize different platform being passed.

Change-Id: Iabecc7c87b35d35f073ced5e111a9ca5ea0d9298
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371341
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-06-13 13:18:19 +00:00
Sarah Zakarias d289a725a3 Add topics to pubspec.yaml
Closes https://github.com/dart-lang/sdk/pull/55922

GitOrigin-RevId: 5729941116885da445296f09c5de5d097154c53f
Change-Id: I2c4076506ae8d1411550320f12dba4ae2a6dc559
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369510
Commit-Queue: Sarah Zakarias <zarah@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2024-06-13 13:02:54 +00:00
pq 70f4e89ddf quick fix for EMPTY_RECORD_LITERAL_WITH_COMMA
See: https://github.com/dart-lang/sdk/issues/55917

Change-Id: Ifee29c7623f3322d4a35534e1c2a00d1cd6b0b03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371063
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-06-13 13:02:45 +00:00
pq 5cc92cf696 quick fix for STATIC_SETTER_WITHOUT_BODY
See: https://github.com/dart-lang/sdk/issues/55917

Change-Id: Id3b704915c03b61d9ba778b96c6e6fc55e1ef3dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371060
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-06-13 12:12:39 +00:00
Ömer Sinan Ağacan 633e7c4b15 [vm_service] Decode incoming JSON in one step instead of two
Currently we decode incoming data as a string, then parse the string as
JSON.

We can do it in one step by fusing a `Utf8Decoder` with a `JsonDecoder`,
which will be faster.

A difference between `jsonDecode` and the fused version is that
`jsonDecode` returns `dynamic`, the fused version returns `Object?`.

To keep changes as small as possible we cast the return value of the
fused verison to `dynamic` in this CL.

However using `dynamic` values is often slower than type casting it to
the right type and then using it. So it might make sense to cast it to
something like `Map<String, dynamic>` in a separate CL.

Change-Id: I76de535a72ae5532db5a27e543929519c48c701c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371080
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-06-13 11:53:40 +00:00
asiva 7a068fae7d [pkg/kernel-service] Fix invalid index used in expression
TEST=ci
Bug: 55951
Change-Id: I58d3bd361666324f33a0e4b25f5b1e85ffa71440
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371182
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2024-06-12 22:13:29 +00:00
Konstantin Shcheglov 78a0c7a5e1 DevX. Issue 54567. Support for joined cases in 'Convert to switch expression'.
Bug: https://github.com/dart-lang/sdk/issues/54567
Change-Id: Idb6cc7ecd88e1e9e3b14c6a54176c958bac36afa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371201
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-06-12 22:10:47 +00:00
Mayank Patke ca3e67a3b6 [dart2js] Add --interop-null-assertions.
This CL adds a new --interop-null-assertions flag (cf.
--native-null-assertions) with the goal of validating that JS interop
APIs with non-nullable static return types do not return null values.
This flag is currently disabled by default but is intended to assist in
sound null safety migrations.

In general, we don't guarantee type soundness of package:js interop
since users can write incorrect static types which are not backed by
any runtime checks. However, it is likely that during the null safety
migration, some interop APIs which should have been made nullable
weren't. Therefore, we want to offer some additional (but limited)
checking for this case.

For static invocations of functions with non-nullable return types, we
can simply perform a null check on the result of the call.
For instance methods (which could be invoked virtually/dynamically), we
want to perform a null check on the return value in the callee (the
interceptor method) itself when possible.

It's possible for multiple interop bindings to share the same
interceptor method. We produce a null check in the interceptor method
body if all the methods have non-nullable return types. Otherwise, we
insert checks at callsites when appropriate.

Change-Id: Ifd155d7f8326152b6d57d61199e0b7973c4a1211
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369784
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2024-06-12 21:28:23 +00:00
Konstantin Shcheglov bb66bd92c8 DevX. Issue 53744. Remove 'const' that starts implicit constant context, add sibling 'const's.
Bug: https://github.com/dart-lang/sdk/issues/53744
Change-Id: Ie0dbfa420d247be47405f014f5b089bc59dde9f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371022
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-06-12 21:11:55 +00:00
Jake Macdonald f4899aa62e skip failing macro test
Bug: https://github.com/dart-lang/sdk/issues/55992
Change-Id: Ib2bfaf980d0edc7ac8a0e2a891983a3294ee1588
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371220
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-06-12 20:59:34 +00:00
Daco Harkes 9588927faf [vm] Native asset relative path resolution with symlinks
This CL moves native assets resolution to the embedder.

The Dart VM looks up the asset path (for example
`['relative', 'foo.so']`) with the asset id. The embedder defines
callbacks for asset loading, and returns a handle to the dylib.
Then the VM calls the embedder again with `dlsym` to lookup the symbol.

The Dart VM & kernel compiler are responsible for the asset id to
asset path mapping. The kernel compiler compiles it into the snapshot
and the VM looks it up in the snapshot.

Relative paths are resolved relative to the isolate script uri (kernel
snapshot, jit snapshot, aot snapshot, or `dart compile exe` result).
The embedder is responsible for remembering the script uri it set when
spawning the isolate group.

This CL does not add `dlclose` or `dladdr` embedder callbacks yet.
Bug: https://github.com/dart-lang/sdk/issues/55521
Bug: https://github.com/dart-lang/sdk/issues/55966

TEST=pkg/dartdev/test/native_assets/build_test.dart
TEST=tests/ffi/native_assets/asset_relative_test.dart

Bug: https://github.com/dart-lang/sdk/issues/55410
Bug: https://github.com/dart-lang/sdk/issues/55523
Bug: https://github.com/dart-lang/sdk/issues/55207
Change-Id: I75ec4a368c5fb3d2f76b03771e796ff56bcac941
Cq-Include-Trybots: dart/try:vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-x64c-try,pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-mac-release-try,pkg-mac-release-arm64-try,pkg-win-release-try,pkg-win-release-arm64-try,vm-aot-asan-linux-release-x64-try,vm-asan-linux-release-x64-try,vm-aot-msan-linux-release-x64-try,vm-msan-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361881
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-06-12 16:45:19 +00:00
Ben Konyi 6b788d2a77 [ Service / DDS ] Re-introduce explicit cast to remove dynamic invocation of operator[]
Fixes failures in type flow analysis tests introduced by https://dart.googlesource.com/sdk/+/cf9623f3d9520bc58b7d3cba146934b69dba1d8f

TEST=pkg/vm/testcases/transformations/type_flow/transformer/bench_vector.dart

Change-Id: I401d12d42a64c64537722ef346dd86b1eff78f84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371140
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
2024-06-12 16:34:17 +00:00
Kallen Tu 8095cb32c6 [cfe] Formal parameter wildcards are non-binding.
This CL changes the following:
- Formal parameter wildcards can have duplicate declarations.
- Formal parameter wildcards will produce an error when used.

Most of this CL is still needed even if we want to keep these parameters in scope. I'm working on that so I'll put this out in the meantime. The tech debt is small compared to getting a move forward on the functionality of wildcards.

Bug: https://github.com/dart-lang/sdk/issues/55655
Change-Id: I5a8b6a8081ea6deb4cfd4bf2626280c6e8c98989
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370761
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2024-06-12 14:42:51 +00:00
Kallen Tu 2ec0ca25a8 [cfe] isWildcard set only with experiment on.
Only set `isWildcard` on variables when the experiment for wildcards is enabled.

Bug: https://github.com/dart-lang/sdk/issues/55655
Change-Id: I54a1f0ba1b9192df6c86e44e92d5ff4bebc9a232
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371020
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2024-06-12 14:25:59 +00:00
Johnni Winther 726f9f1a68 [analyzer] Generate multiple cases in missing cases fix
This pipes multiple witnesses from a non-exhaustive switch expression
or statement to the ADD_MISSING_SWITCH_CASES fix, such that multiple
cases can now be inserted in a single fix.

Change-Id: I5625bbb81c72917f10f4388cfe96d1bd1536c269
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371062
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-06-12 12:45:09 +00:00
Johnni Winther 5986f91820 [cfe] Split CompilationUnit and LibraryBuilder
This moves CompilationUnit from being a supertype of LibraryBuilder
to only being implemented by DillLibraryBuilder and SourceLibraryBuilder.
This is done in preparation for fully separating CompilationUnit from
LibraryBuilder.

Change-Id: Id2e9488d5f35ab108d5067583541dec433b90cf2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371081
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-06-12 10:46:18 +00:00
Martin Kustermann dd92e9a0b4 [dart2wasm] Faster search in RTT supers data structure
If the transitive supers graph contains many classes we use a binary
search instead of a linear search.

Issue https://github.com/dart-lang/sdk/issues/55516

Change-Id: I1018082e8d27090293b67a2239abfaf279270b9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370860
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-06-12 10:42:22 +00:00
Jens Johansen c15466034e [status_files] Cleanup status files
Make tool (by default) give error when test entry specified in status
file does not exist. Make -w (by default) remove such entries.

Cleanup most status files, fixing a few entries containing `.dart` and
removing obsolete entries (i.e. entries pointing to nonexisting tests).

This should for instance have given an error in
https://dart-review.googlesource.com/c/sdk/+/370600 saying that the file
I specified didn't exist (in that I shouldn't have specified the `.dart`
part).

TEST=No tests, this is status file maintenance.

Change-Id: Ie977bf15dea2e3dad8d771fd3e99917317e975f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370886
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2024-06-12 10:21:23 +00:00
pq 86b43dc50c update status of unreported COVARIANT_CONSTRUCTOR
`COVARIANT_CONSTRUCTOR` is not reported by the parser (today) and constructors are treated the same as other members. This change updates fix status bookkeeping making it clear that the diagnostic isn't reported and so is not fixable.

Change-Id: I4944beef64e4c9ee42757430383291a54ae75f6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371061
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2024-06-12 09:29:39 +00:00