Commit graph

44121 commits

Author SHA1 Message Date
Johnni Winther 0769b22b4f [cfe] Support interface member access on extension types
Change-Id: I53975b71683e119fe6abec72341cdcd814244f58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318982
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-08-09 12:19:39 +00:00
Oleh Prypin 27ad1a74dd Revert "[dart2js] Add runtime type check for await."
This reverts commit c81711bdda.

Reason for revert: `Internal Error: Runtime type information not available for type_variable_local` - b/295131730

Original change's description:
> [dart2js] Add runtime type check for `await`.
>
> See https://github.com/dart-lang/sdk/issues/49396 for details.
>
> Fixes: #50601
> Change-Id: Ie89130cffe642b3e4935d7d02fe2e34f7fc8b12e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316320
> Commit-Queue: Mayank Patke <fishythefish@google.com>
> Reviewed-by: Stephen Adams <sra@google.com>

Change-Id: I481b119b6569d1bc9cf2ab80d997a3eb6d06f674
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319421
Reviewed-by: Alexander Thomas <athom@google.com>
Auto-Submit: Oleh Prypin <oprypin@google.com>
Commit-Queue: Oleh Prypin <oprypin@google.com>
2023-08-09 11:23:19 +00:00
Oleh Prypin 9f0f33c676 Revert "[analyzer] simplify the libraries.dart file"
This reverts commit 1948b0a9fe.

Reason for revert: causes `promiseToFuture` to become undefined - b/295129286

Original change's description:
> [analyzer] simplify the libraries.dart file
>
> Change-Id: I86bc196eaddd9a80c02f38c8d947d3c0f4c63394
> CoreLibraryReviewExempt: the sdk_library_metadata/libraries.dart is only used by the analyzer
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317803
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Commit-Queue: Devon Carew <devoncarew@google.com>

Change-Id: I4810c408b996cefd46c0a40cc36818d34aa86071
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319402
Auto-Submit: Oleh Prypin <oprypin@google.com>
Commit-Queue: Oleh Prypin <oprypin@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-08-09 10:27:47 +00:00
Ömer Sinan Ağacan 605b5a2e61 [dart2wasm] Transform List factory calls to implementation class calls
This is mainly used in [1] to allow using unboxed int lists when a
factory type argument is `int`, which then allows inlining unboxed int
list `[]` and `[]=` and storing and loading `int` values unboxed.

This implementation is mostly a copy of VM's transformer with the same
name. However we can't reuse VM's pass as we do different
transformations in [1].

[1]: https://dart-review.googlesource.com/c/sdk/+/318680

Change-Id: I16c06fc2b2edb1a5498807fc5c0fee839c003965
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318921
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-08-09 09:31:59 +00:00
Aske Simon Christensen 3df48faff1 [wasm_builder] Fix failure type of br_on_cast[_fail]
The Wasm validation rules state that the failure type is sharpened to
non-nullable if the cast target type is nullable.

Change-Id: I77596c31ea7443c5dace543d13024262879a5fb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318660
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-08-09 08:24:37 +00:00
Parker Lougheed 1b8870bbb1 [analyzer] Don't generate error codes for removed diagnostics
Also renames 'removed' to 'removedIn' to better indicate it is looking for a version, not a boolean.

Change-Id: If3a6708ba32460305e89ba59c4a58ce2ad284e6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319282
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-09 04:08:23 +00:00
Konstantin Shcheglov 1e12b09a59 Extension types. Report conflicts for members from superinterfaces.
Change-Id: I4bc513102f734a98a263dffd97c5d93874ef3ae1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318803
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-08 23:23:13 +00:00
Kallen Tu 1f88336597 [analyzer] Move all constructor error reporting to _InstanceCreationEvaluator.evaluate
Pull the error handling outwards to _InstanceCreationEvaluator.evaluate. All errors in const constructors should point to the location of the actual exception and provide more context.

Change-Id: Iafcf46182fab698f5546c63780de6dd9a605a51b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318802
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-08-08 21:55:34 +00:00
Keerti Parthasarathy 155bfc973b Add support for sort imports to BulkFixProcessor, add prefer_generic_function_type_aliases to list of lints for lightweight mode.
Change-Id: Ic8a1afde5f35a65065dd8439a11c4d99846c2905
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319240
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-08 21:10:54 +00:00
Devon Carew 1948b0a9fe [analyzer] simplify the libraries.dart file
Change-Id: I86bc196eaddd9a80c02f38c8d947d3c0f4c63394
CoreLibraryReviewExempt: the sdk_library_metadata/libraries.dart is only used by the analyzer
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317803
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2023-08-08 21:00:01 +00:00
Konstantin Shcheglov 36c578f75c Extension types. Report when has representation self reference.
Change-Id: I729515f92c4c31530b61c7f9d71507fbf922787d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319180
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-08 20:39:40 +00:00
Konstantin Shcheglov 5930cd6d55 Extension types. Report TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND when via extension type.
Change-Id: I79d77e251fc4107e8d8496f9b4baea4b8a2b8bf0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319200
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-08 20:23:38 +00:00
Mayank Patke c81711bdda [dart2js] Add runtime type check for await.
See https://github.com/dart-lang/sdk/issues/49396 for details.

Fixes: #50601
Change-Id: Ie89130cffe642b3e4935d7d02fe2e34f7fc8b12e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316320
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-08-08 20:18:04 +00:00
Daco Harkes 585c34b4d1 [deps] rev native
`packge:native_assets_builder` had a number of breaking changes.
The most notable one: It now returns a data structure with a `success` boolean instead of throwing exceptions.

Also bumps Dart to 3.0 in Dartdev so we can use records.

Change-Id: Ic32d7c2dd58860883c10f42411b80e979df2a797
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318980
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Hossein Yousefi <yousefi@google.com>
2023-08-08 19:32:30 +00:00
Srujan Gaddam 86eb49ac19 [dart:js_interop] Disallow user @staticInterop classes from subtyping most dart:_js_types types
Since user @staticInterop types are erased to JavaScriptObject, they
should only be able to subtype other types that are :> JavaScriptObject,
which are just JSObject and JSAny. Eventually all the other JS types
will move to extension types and we can remove this check.

Change-Id: If56b6770e141238b583937880ca87496780c8fac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316865
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-08-08 19:17:25 +00:00
Danny Tuppeny 1bae1b3dd5 [analysis_server] Don't produce fix-all-in-file fixes when there's no individual fix
Fixes https://github.com/dart-lang/sdk/issues/53021

Change-Id: I674430c5e01eaeaee7867e85795eca2250ec14f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-08 18:20:39 +00:00
Paul Berry 9a3420f1d4 Flow analysis: fix field promotion within cascades of non-promotable targets.
Previously, flow analysis used a hack to make it easy to generate "why
not promoted" messages when the user tried to promote a non-promotable
field: it treated all field accesses as stable for the purpose of
assigning SSA nodes, but avoided promoting non-promotable fields by
setting the `_Reference.isPromotable` flag to `false`. So, for
instance, in the following code, both subexpressions `c.i` got
assigned the same SSA node, even though there's no guarantee that
`C.x` will return the same value each time it's invoked.

    class C {
      int? get i => ...;
    }
    f(C c) {
      if (c.i != null) {
        var i = c.i; // Inferred type `int?`
      }
    }

This mostly worked, since the SSA node assigned by flow analysis is
only used for promotion, and promotion is disabled for non-promotable
fields. However, it broke when the field in question was used as the
target of a cascade, because fields within cascades always had their
`_Reference.isPromotable` flag set to `true` regardless of whether the
corresponding cascade target is promotable. For example:

    class C {
      D? get d => ...;
    }
    class D {
      final E? _e;
      ...
    }
    class E {
      m() { ... }
    }
    f(C c) {
      (c.d)
        .._e!.m() // OK; promotes _e
        .._e.m(); // OK; _e is promoted now
      (c.d)
        .._e.m(); // OOPS, _e is still promoted; it shouldn't be
    }

See
`tests/language/inference_update_2/cascaded_field_promotion_unstable_target_test.dart`
for a more detailed example.

This CL removes the hack; now, when a non-promotable property is
accessed more than once, flow analysis assignes a different SSA node
for each access. As a result, the `_Reference.isPromotable` is not
needed, because non-promotable fields simply never have the chance to
be promoted (since every field access gets a separate SSA node, so
type checking one field access has no effect on others).

To preserve the ability to generate "why not promoted" messages, the
`_PropertySsaNode` class now contains a `previousSsaNode` pointer,
which links together the separate SSA nodes allocated for
non-promotable properties, so that they form a linked list. The "why
not promoted" logic traverses this list to figure out which promotions
*would* have occurred if the property had been promotable.

In order to make it efficient to create this linked list, the
`SsaNode` class also had to acquire a `_nonPromotableProperties` map,
which records the SSA node that was allocated the last time each
property was accessed.

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

Change-Id: I16a7b27f77c309bdccce86195a53398e32e8f75d
Bug: https://github.com/dart-lang/sdk/issues/52728
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318745
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-08-08 17:26:09 +00:00
Konstantin Shcheglov ed0544a43a Sort context messages by offset from low to high.
Change-Id: Ibedaff82eb8d5e3b6740c69b34736514289e93d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319060
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-08-08 17:11:59 +00:00
Alexander Markov fe7778291b [vm/aot/tfa] Share captured local variables among invocations
This is a step towards detaching bodies of closures/local
functions from the enclosing functions in TFA, so closures
could be analyzed separately.

Also, this change allows TFA to accumulate types of captured local
variables among all invocations.

On a large Flutter app, this change doesn't cause noticeable compilation
time or snapshot size changes.

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

TEST=pkg/vm/testcases/transformations/type_flow/summary_collector/control_flow.dart

Cq-Include-Trybots: luci.dart.try:vm-aot-linux-release-x64-try,vm-aot-mac-product-arm64-try
Change-Id: I785b15656df559a8cc80fcceea196b480ba7a91a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318021
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-08-08 16:35:10 +00:00
Anna Gringauze 67d752aa12 [ddc] Clean up expression compiler tests
- Allow running the tests with asserts enabled

- Allow running the tests in canary mode

- Unify common test code and remove duplication
   - merge expression_compiler/setup_compiler_options.dart
     into share_compiler_options.dart

   - Merge TestCompiler code from expression evaluation and
     expression compilation tests and move into
     expression_compiler/test_compiler.dart

   - Rename various TestDrivers so they have more descriptive names

- Remove 'golden' JS comparison tests from expression_compiler_test.dart
   - replace by evaluation tests where needed

Closes: https://github.com/dart-lang/sdk/issues/53145
Change-Id: Ic797fa4ee9bfa6b858b924be9f9a53fd10ae1448
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318080
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-08-08 16:21:31 +00:00
Ömer Sinan Ağacan e61c6dc620 [dart2wasm] Improve wasm:class-id pragma error messages
Change-Id: Id9d073557738548d41e6fd90d8973d8e5d5c0748
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318920
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-08-08 15:39:27 +00:00
Danny Tuppeny b6e7b7e536 [analysis_server] Expose additional LSP handlers over legacy protocol
Change-Id: I8aae887eba3d35f8086b62f2e9b861e17e41555e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318983
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-08 15:21:53 +00:00
Jess Lally 700c7e3b3f [dart2wasm] Remove Closures dependency on CodeGenerator
Change-Id: Ie18bdc704ca8a3459bde1bd27e8ed7866239b737
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318942
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Jess Lally <jessicalally@google.com>
2023-08-08 14:54:43 +00:00
Johnni Winther 6b5c722712 [cfe] Update ast-to-text for extension type declarations
Includes a fix for the serialization of the representation name found
through the update of the ast-to-text.

TEST=existing

Change-Id: Id741d66d8f43b5dc1d5e79f967b9625579539404
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318941
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-08-08 14:53:20 +00:00
Johnni Winther b6409c0f04 [cfe] Check superbounded extension types
Closes #53139

Change-Id: I2f13d77454e2a7bac70d19afa1fb321815aac3bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318641
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-08-08 09:13:51 +00:00
Konstantin Shcheglov 7d83540366 Extension types. Report an error for instance fields in extension types.
Change-Id: I35cb446c45e027a77d0a5ff870b4e5b4b22b7512
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318747
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-07 22:39:55 +00:00
Konstantin Shcheglov b4164b956f Extension types. Test for invoking (old) extension methods on extension types.
Change-Id: I7da853dbfa4b24b578ba1eb1a9999e8582c63016
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318748
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-07 22:04:19 +00:00
Konstantin Shcheglov 33736cab48 Extension types. Report when used in extends, implements, with, on clauses.
Change-Id: I84effd787ce6405140beae13662f3255fd929012
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318744
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-07 21:00:04 +00:00
Danny Tuppeny 2a811a0ad9 [analysis_server] Split DartUnitHoverComputer.compute() into smaller methods
No functional changes here, I'm just trying to simplify the hover implementation a little as this method had gotten quite long and deeply nested. We've discussed improving hover support for patterns and keywords and hopefully this'll make that easier.

Change-Id: I974f7fb0fbb99a967b5970f99b36ef3601df4ea3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318701
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-07 18:14:15 +00:00
Konstantin Shcheglov 0e32c36019 Extension types. Tests for InstanceCreationExpression.
Change-Id: I50e7cfa4cb574c7626a7a3ae0990edcb8e32b37f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318743
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-07 18:08:43 +00:00
Konstantin Shcheglov 0cd0412a75 Extension types. Report when invalid type is implemented.
Change-Id: I66c30209a5fe5083f78291ea3ec7e5fd2259164f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318742
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-07 18:06:11 +00:00
Kallen Tu 848638c47b [analyzer] Add test for enum equality in constant evaluation.
Confirm that const enum equality works with the addition of enum comparisons in recent language changes like https://github.com/dart-lang/language/issues/312

We can keep an extra test in the suite.

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

Bug: https://github.com/dart-lang/sdk/issues/45441
Change-Id: I80f7496e172a9a09e9bec3ea1643811788b38443
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316701
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-08-07 18:00:39 +00:00
Joshua Litt 0332c70638 [wasm_builder] Lift import / definition restrictions.
Change-Id: Id0651e8e2ad270be5cc3788d361257769088faa6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316627
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-08-07 17:08:13 +00:00
Keerti Parthasarathy 360ebb6e50 Wire up a parse option for bulk processor
Change-Id: I8cecd6bf4ac3693e2cf65a66eed809abb571b22a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318362
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-08-07 16:29:58 +00:00
Konstantin Shcheglov 6ac57ff0b9 Extension types. Report when a method has the name of an Object member.
Change-Id: I0585451580c1a1921f813a1af574175f04354475
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318741
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-08-07 16:11:59 +00:00
Brian Wilkerson 7901efffe7 Convert a few more methods in KeywordContributor
Change-Id: I905a4855f67db227ab654c3d4dc7441b7ee2bf58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315540
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-08-07 16:09:40 +00:00
Danny Tuppeny 17f3a6ec30 [analysis_server] Convert more LSP handlers to work over the legacy protocol
Change-Id: I9bd1f3ffd9bcdb017a4208e4aedcfb7436259fc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318700
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-07 15:27:46 +00:00
Keerti Parthasarathy 2530047ad2 Add test case for #53101
Change-Id: I0d6956e37e4240f861addf7c71a933071c1498b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318022
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-08-07 14:55:14 +00:00
Danny Tuppeny 660c9bbace [analysis_server] Switch LSP completion tests to use new setXxx() capabilities instead of nested withXxxx() capabilities methods
No functional changes, just simplifies the tests a little by calling functions to set capabilities instead of having to nest them inside `initialize()` calls.

Change-Id: I1496da221b1802c3375c32c7e0d048310769bdf9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317961
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-07 14:39:32 +00:00
Danny Tuppeny ea5e58356b [analysis_server] Fix logging of LSP-over-Legacy requests to use the LSP identifiers
Otherwise they'll be recorded as "lsp.handle".

Change-Id: I511d5eef44d6d647fef4d0347a03f6a7a9f88f9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315920
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-07 14:27:12 +00:00
Johnni Winther 7a2f49a3fa [cfe] Check cyclic representation dependency
Change-Id: Ic0da6d4af5c16c1460add140bbffcb21c5a2139d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318280
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-08-07 08:58:28 +00:00
Danny Tuppeny 16d787694a [analysis_server] Refactor completion labels in preparation for new LabelDetails support
This is just a little refactoring towards https://github.com/Dart-Code/Dart-Code/issues/2462. It doesn't change anything, it just makes the next CL (with the functional changes) simpler.

Change-Id: I98ed5991f1abb67f86f9d4d43c27ff6ccf21847c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317940
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-06 18:21:31 +00:00
Danny Tuppeny 7f0ac7853e [analysis_server] Fix navigation for the offset between a type name and generic type args
Fixes https://github.com/Dart-Code/Dart-Code/issues/4619

Change-Id: I5cee17037fe4531183dc5e2cb566e9f020e1b541
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316223
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-06 17:37:27 +00:00
Danny Tuppeny 76dc2c4cfa [analysis_server] Change LSP-over-Legacy to be wrapped with the original protocol
Originally we didn't use the LSP Request/Response classes, and just exposed the handlers through the legacy request/response.

However there were some mismatches (such as legacy protocol always returns Map<String, Object?> but some LSP requests return Lists, LSP using int|String IDs, and LSP having numeric error codes that don't match legacy string error codes).

This change uses LSP's request and Response by wrapping them inside a standard (legacy) handler. The LSP-over-Legacy handler has become a standard handler, and the params contain an "lspMessage" field that holds an LSP message, and the result contains an "lspResponse" field that contains an LSP response.

If an LSP handler returns an error, it will be returned as an error inside the LSP response, which will be in a _successful_ legacy request (since that's how we can return an LSP response - as the result).

Change-Id: I67973590ab32f3543d1a6e1b7279974e5e8832bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315201
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-06 14:32:18 +00:00
Danny Tuppeny 678e207a6d [analysis_server] Fix a bug with sorting semantic tokens
I was trying out DCM and it found this bogus condition.

The only instance I can find where it triggered was adjacent interpolations in strings, and the fallback code (which compares by token type) would handle it correctly, but in case there are other cases (now or in future), I've added an assert to try to avoid reaching the fallback in case it doesn't produce the desired result.

Change-Id: I3092fa4892c812be7d3a91629c5f6ed3be627743
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-05 19:05:38 +00:00
Konstantin Shcheglov e21306a4eb Extension types. Report when a type parameter is used in a non-covariant position.
Change-Id: I12dbfccdf670cb02f74ddcb787b9e1e4a2b4e6fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318001
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-05 03:51:42 +00:00
Konstantin Shcheglov 26325d6f29 Extension types. Report conflicts.
Change-Id: I389561c2a143600968ed85cc3fd86ac1d81d649b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318480
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-05 03:49:38 +00:00
Konstantin Shcheglov 319eb24e1e Prepare to publish analyzer 6.1.0 and _fe_analyzer_shared 63.0.0
Bug: https://github.com/dart-lang/sdk/issues/53084
Change-Id: Id3143e4d2ffd7795a5c36c69d1e6c62d4ee7c65c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318460
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-08-04 22:34:59 +00:00
Srujan Gaddam a56642e9a1 [dart:js_util] Handle type parameters in export/mocks.
Several changes are made:

- createDartExport now does not export methods that define type parameters.
- createStaticInteropMock adds conformance checks to make sure implementing
members can handle all possible values of a type parameter in an interop
member. An error is added to reduce confusion around this.
- Export creator now uses dart:js_interop_unsafe for a lot of its lowering
as the dart:js_util equivalents are buggy when it comes to calling exported
functions in JS with JS types.
- Small code changes are added to backends to handle the above changes.

Change-Id: Ie3b6b157930537267f270b60373b2b17e0a14344
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316141
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-08-04 21:45:29 +00:00
Konstantin Shcheglov b9a66a0d2e Extension types. Report an error if the feature is not enabled.
Change-Id: Icc1e4fddea91dab22fcab694928c9138b0781e76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318440
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-04 21:10:39 +00:00