Commit graph

93096 commits

Author SHA1 Message Date
Paul Berry 907e705307 Flow analysis: use a more precise split point for refutable patterns.
Previously, the flow control logic for patterns didn't use the
`FlowModel.split` or `FlowModel.unsplit` methods at all. This meant
that if a control flow join point occurred in pattern logic, flow
analysis would consider the split point to be whatever split point was
established by the enclosing expression or statement. In the case of
an if-case statement, it would consider the split point to be at the
beginning of the scrutinee expression.

Split points are used by flow analysis for the sole purpose of
ensuring that joins propagate type promotions the same way in dead
code as they do in live code (so that users introducing temporary
`throw` expressions or `return` statements into their code do not have
to deal with nuisance compile errors in the (now dead) code that
follows. The consequence of flow analysis considering the split point
to be at the beginning of the scrutinee expression is that if the
scrutinee expression is proven to always throw, then joins that arise
from the pattern or guard may not behave consistently with how they
would have behaved otherwise. For example:

    int getInt(Object o) => ...;
    void consumeInt(int i) { ... }
    test(int? i) {
      if (
          // (1)
          getInt('foo')
          case
              // (2)
              int()
          // (3)
          when i == null) {
      } else {
        // (4)
        consumeInt(i);
      }
    }

In the above code, there is a join point at (4), joining control flows
from (a) the situation where the pattern `int()` failed to match, and
(b) the situation where `i == null` evaluated to `false` (and hence
`i` is promoted to non-nullable `int`). Since the return type of
`getInt` is `int`, it's impossible for the pattern `int()` to fail, so
at the join point, control flow path (a) is considered
unreacable. Therefore the promotion from control flow path (b) is
kept, and so the call to `consumeInt` is valid.

In order to decide whether to preserve promotions from one of the
control flow paths leading up to a join, flow analysis only considers
reachability relative to the corresponding split point. Prior to this
change, the split point in question occurred at (1), so if the
expression `getInt('foo')` had been replaced with `getInt(throw
UnimplementedError())`, flow analysis would have considered both
control flow paths (a) and (b) to be unreachable relative to the split
point, so it would not have preserved the promotion from (b), and
there would have been a compile time error in the (now dead) call to
`consumeInt`.

This change moves the split point from (1) to (2), so that changing
`getInt('foo')` to `getInt(throw UnimplementedError())` no longer
causes any change in type promotion behavior.

The implementation of this change is to add calls to `FlowModel.split`
and `FlowModel.unsplit` around all top-level patterns. At first glance
this might appear to affect the behavior of all patterns, but actually
the only user-visible effect is on patterns in if-case statements,
because:

- In switch statements and switch expressions, there is already a
  split point before each case.

- In irrefutable patterns, there is no user-visible effect, because
  irrefutable patterns cannot fail to match, and therefore don't do
  any control flow joins.

This change allows the split points for patterns to be determined by a
simple syntactic rule, which will facilitate some refactoring of split
points that I am currently working on.

Change-Id: I55573ba5c28b2f2e6bba8731f9e3b02613b6beb2
Bug: https://github.com/dart-lang/sdk/issues/53167
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319381
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-08-11 17:09:49 +00:00
Konstantin Shcheglov c9684e54e8 Extension types. Compute notSimplyBounded flag.
Change-Id: I18f40aab9ca163b248c0d5555ce9cfdfa3e9efe2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320120
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-11 16:39:53 +00:00
Konstantin Shcheglov fd61717401 Extension types. Adjust isNullable(), only potentially nullable.
Change-Id: I382394267de3eaab6314d006ed32dbcf53d4d9b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-11 16:29:33 +00:00
Alexander Aprelev 61111a5af1 [ssl/mac] Avoid unnecessary allocations of x509 certificates, fix leak.
BUG=https://github.com/dart-lang/sdk/issues/53113
TEST=leaks --atExit -- xcodebuild/DebugARM64/dart --sound-null-safety -Dtest_runner.configuration=vm-mac-debug-arm64 --packages=$DH/.dart_tool/package_config.json $DH/tests/standalone/io/https_bad_certificate_test.dart

Change-Id: Ie9ba76a507c42879206929a42071c0a1a8c6ceaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319080
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-08-11 16:28:46 +00:00
Anna Gringauze 8f4e5c8194 [ddc] Fix runtime failure on evaluation of expressions that use JS interop and extension types
Incremental compiler only runs procedure transformations during expression compilation, as opposed to modular library transformations
that are run during initial compilation stage on libraries (including JS interop-related transformations).


In this CL:

- Add implementation of `performTransformationsOnProcedure` to dev compiler target
  - runs JS interop-related transformations on a procedure.
- Add related expression evaluation tests
  - expressions using JS interop and extension types.

Closes: https://github.com/dart-lang/sdk/issues/53048
Change-Id: I085920db9c3af4c680283c574087d8901c99dfcf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319585
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2023-08-11 16:15:00 +00:00
Parker Lougheed 410c394374 [analyzer] Mark DEFAULT_LIST_CONSTRUCTOR as removed
Follow-up to https://dart-review.googlesource.com/c/sdk/+/276770

Change-Id: I583d19e3fab99594a12083381cc98cd1e453efcf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319641
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-11 14:54:58 +00:00
Parker Lougheed 0360930dbc [changelog] Add optional named parameter separator breaking change
Fixes https://github.com/dart-lang/sdk/issues/52491

Bug: https://github.com/dart-lang/sdk/issues/52491
Change-Id: Ief94acb7a3ba75ea555718e017e39ce2c418b41e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320020
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2023-08-11 14:49:32 +00:00
Parker Lougheed 80fb7b3f9d [release] Update changelog with stable patch notes
Change-Id: I5bbf530c55be59c0a7b23d5d035d266d19eecd5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320040
Commit-Queue: Kevin Chisholm <kevinjchisholm@google.com>
Reviewed-by: Kevin Chisholm <kevinjchisholm@google.com>
2023-08-11 14:43:13 +00:00
Tess Strickland 4af0a59e8c [benchmarks] Change the MemoryCopy memcpy benchmarks to use memmove.
While our benchmarks don't involve overlapping memory between source
and destination, general methods for copying between TypedData must.
Thus, our benchmark for using the C interface via FFI must use memmove
instead of memcpy.

To avoid having to update our benchmark configurations, the name of
that benchmark is unchanged.

In addition, this CL adds filtering for benchmark names and turning on
and off specific outputs for quick comparisons when running manually.

Change-Id: I20616549d8bc9ab481884846d3f13df20a3c854e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319981
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-08-11 13:17:17 +00:00
Oleh Prypin 6bd0bb4fec Revert "[dart2js] Use symbols for isolate tags"
This reverts commit 58f4b3a7a6.

Reason for revert: Causes build failures in google3 - b/295404395

Original change's description:
> [dart2js] Use symbols for isolate tags
>
> All supported browsers have JavaScript Symbols so use Symbols.
> Avoiding string property names should fix a bug where separate
> programs running in separate iframes arrive at using the same
> property.
>
> Issue: #53154
> Change-Id: I470dc47de3ad381aeab670cf62d62e53f2e72873
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319865
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Stephen Adams <sra@google.com>

Issue: #53154
Change-Id: I581fe08aee6ac9e2d74e813641a942223553cf5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319980
Auto-Submit: Oleh Prypin <oprypin@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Oleh Prypin <oprypin@google.com>
2023-08-11 12:48:31 +00:00
Johnni Winther 1c12ac639f [cfe] Compute instantiated representation type
TEST=pkg/front_end/testcases/inline_class/extension_types/representation_type.dart

Change-Id: I384c7b68513ccf8426a41029622b8c0913197cd2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319481
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-08-11 10:32:00 +00:00
Jens Johansen a445fae681 [parser] Fix issue 52954 about nested record destructuring with shorthand
Fixes https://github.com/dart-lang/sdk/issues/52954

Change-Id: I41e229380ccc16aa8bab0696fa79ca701a43220f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317681
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-08-11 09:19:31 +00:00
Aske Simon Christensen 1e3689cfa7 [dart2wasm] Fix isSubtype case of type parameter vs FutureOr
Change-Id: I3b6186426af231473fe2d93afcc787ffef6d3a97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319760
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-08-11 09:08:32 +00:00
Aske Simon Christensen 64dd387d09 [dart2wasm] Fix normalization of nullable FutureOr
Change-Id: I471534ef458fe5ba79996534015fa1d14983cbb3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318922
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-08-11 09:08:32 +00:00
Aske Simon Christensen 0c1bb28ad4 [dart2wasm] Special runtime type classes for special interface types
Adds special representations of runtime types for the interface types
`Object`, `Function` and `Record`. With this change, all types with
non-interface subtypes have special representations, which avoids some
special cases down the line.

Change-Id: I61b4da20fa1cc62d42e1770278a3272028c9e2a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318681
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-08-11 09:08:32 +00:00
Martin Kustermann 166c5d7b41 [vm] Add test for dart:developer registerExtension() method
There was a bugfix in [0] to ensure the passed closure is invoked in the
right zone, but it was missing a test.

There seems to be also no other tests of `registerExtension()`.
=> So we'll add a test in this CL.

[0] https://dart-review.googlesource.com/c/sdk/+/275842

Issue https://github.com/dart-lang/sdk/issues/53178
Issue https://github.com/flutter/flutter/issues/93676

TEST=dart/flutter_regress_93676_test

Change-Id: Ibfdf15026b36beff1db9cef30c69a052b9efc77d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319940
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2023-08-11 08:18:30 +00:00
Stephen Adams 58f4b3a7a6 [dart2js] Use symbols for isolate tags
All supported browsers have JavaScript Symbols so use Symbols.
Avoiding string property names should fix a bug where separate
programs running in separate iframes arrive at using the same
property.

Issue: #53154
Change-Id: I470dc47de3ad381aeab670cf62d62e53f2e72873
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319865
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-08-10 23:42:16 +00:00
Konstantin Shcheglov ab7f49166e Extension types. Report deferred superinterfaces.
Change-Id: Ie767ce5e96953d83edeeb3331bea0aecfc5f51a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319904
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-10 23:17:35 +00:00
Konstantin Shcheglov f6db810b96 Extension types. Report CONFLICTING_METHOD_AND_FIELD and CompileTimeErrorCode.CONFLICTING_FIELD_AND_METHOD.
Change-Id: I3ebf1f2f767f2b64cf47e2c80473b086695d20d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319869
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-10 22:54:26 +00:00
Konstantin Shcheglov 42b992c947 Extension types. Fixes for type parameters in scope and metadata.
Change-Id: I25df6a91e9ff9292f26782412651b8e024306933
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319866
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-08-10 22:54:09 +00:00
Sigmund Cherem 4ae3e53545 [dart2js] make a few properties of backendusage private
Change-Id: I5b6d1ef13240a7785c58ccc7257f46097f624ff3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318884
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2023-08-10 22:45:54 +00:00
Sigmund Cherem 759e7e67b4 [dart2js] merge backend usage builder and impl
Change-Id: I3a2d73d49c891636a66a53f0c1d05bd0a6f024f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318881
Reviewed-by: Stephen Adams <sra@google.com>
2023-08-10 22:45:54 +00:00
Sigmund Cherem ab0b4fcbe2 [dart2js] cleanup backend usage (I)
Change-Id: Id2fcc83ef3ae68b00693a13b186ffc406886972c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318880
Reviewed-by: Stephen Adams <sra@google.com>
2023-08-10 22:45:54 +00:00
Konstantin Shcheglov 66b18bce40 Extension types. Apply substitution when copy superinterface members into extension types.
Change-Id: I93d8ab4582491bad262253eedc94dc63d33c5457
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319900
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-10 21:14:04 +00:00
Alexander Aprelev 2d0fba3981 [isolate/spawn] Fix typo in the error message.
Add space in the message below: Invalid argument(s): Cannot simultaneously request automaticPackageResolution and specify apackageConfig.
TEST=manual

Change-Id: I84de83494fbd2656bd5ba217723d2fdd926e8f66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319863
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-08-10 20:43:18 +00:00
Parker Lougheed 6f127b2b47 [analyzer] Update list of unverified docs
No longer marks a few error codes as unverified if the issue no longer exists or an adjustment of the offset/length was needed.

Change-Id: I78aa557dcffeafb5c3af40b978fa23ba0bc93a0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319640
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-10 20:21:08 +00:00
Konstantin Shcheglov 00b59bd878 Extension types. It is not an error to invoke members of nullable extension type.
1. It is not allowed to write a nullable type in `implements`.
2. Any methods of the extension type itself are OK to invoke.

I start to doubt what is the meaning of isNonNullable() to extension types.
For now I will add a workaround, to be reconsidered if isNonNullable() is
clarified.

Change-Id: I8a9543a6b0e942ae4de3ce673eeee1aa9b0a5230
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319862
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-10 20:14:57 +00:00
Nicholas Shahan 3c75002cee [ddc] Stop modifying the native JavaScript Object prototype
With this change the Dart Core Object members (`.hashCode`, 
`.runtimeType`, `.noSuchMethod()`, `.toString()`, and 
`operator ==`) are no longer installed onto the native JavaScript
Object prototype. This is done because the Object prototype will be 
sealed as a security precaution in some environments to avoid 
prototype pollution exploits.

This means that dispatching to these APIs will change when the 
compiler cannot know if the receiver may be null or a value from 
JavaScript interop. In those cases a call to a helper method is 
inserted instead. The helpers will probe for the API on the value, 
call it if available or execute a default version.

NOTE: Many other native JavaScript prototypes are still modified. This
change is only for the Object prototype.

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

Change-Id: Iddb3a48e790dd414aa3254d729535c4408e99b3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310971
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-08-10 19:45:59 +00:00
Nicholas Shahan 3cff63ff26 [ddc] Seal the native Object prototype in test infra
Update tests to avoid getting or setting `.__proto__`.

Change-Id: I2e80dfc32f162de4f5b3fe5ac74a9e6818a7e55e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317845
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-08-10 19:45:59 +00:00
Nicholas Shahan 30869bf7c4 [js] Add Dart Object API tests for interop objects
Change-Id: I806ef3e5ed2468eecd91427a3e28cc0859aa81fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317844
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-08-10 19:44:00 +00:00
Danny Tuppeny 846049965a [analysis_server] Fix flaky test
This test was writing a package_config after starting the analysis server which causes the context roots to be rebuilt (during which there is a period when there are no roots/drivers), and then not waiting.

This change creates the file before server initialisation.

Change-Id: Id0111f16200a905dd538e217199133122be84246
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319801
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-10 19:01:24 +00:00
Ryan Macnak be3d5ff3cc [vm] Shrink the surface of app_snapshot.h.
TEST=ci
Change-Id: I902eb21c89fb2344bd1870cab2436f204817bdef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319580
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-08-10 18:53:37 +00:00
Konstantin Shcheglov 53cccf9c8b Extension types. Report when implemented extension type representation is not a supertype of the declared extention type.
Change-Id: Iebb19c3f57046db600305993cc69dae04946889d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319861
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-10 18:38:04 +00:00
Danny Tuppeny acefe9ab6d [analysis_server] Extract LSP registration options from ServerCapabilitiesComputer
This is a non-functional refactor that extracts the growing set of capabilities and options from ServerCapabilitiesComputer into files alongside the handlers they relate to.

The motivation for this is that for LSP-over-Legacy we'll need to accept client capabilities (and return server capabilities). The server capabilities will be different to the standard LSP ones (they will be a subset, and we might not support dynamic registration - at least initially). However the features we do support will have the same registration options, so to avoid duplicating them this moves the registration options away from the creation of the ServerCapabilities.

In future, we might consider further wrapping up a "feature" (which consists of these registration options, and the related handlers), but this change is already quite large and I just wanted to progress capabilities for LSP-over-Legacy so we can handle things like Code Actions (which require executeCommand and possible reverse-requests for applyEdit).

Change-Id: Iecd0aa36626fa44826f7d4dbd6e6c0d758075239
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-10 17:10:48 +00:00
Konstantin Shcheglov 94a0ce7757 Extension types. Report CONFLICTING_GENERIC_INTERFACES.
Change-Id: Idd4a844ba5ee993b70c08aa9227e2f3a95fcc2f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319782
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-08-10 17:01:31 +00:00
Brian Wilkerson 98608662e7 Move more of KeywordContributor to the new framework
Change-Id: I2b257545a3af7fa2f803e8f954d14cd3679c35c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319781
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-10 16:58:51 +00:00
Joshua Litt fc35778ff7 [dart2wasm] Fix bug with print kernel.
Change-Id: I8ad7e1815af519dc511afc192f2e44621fa90be5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319820
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Auto-Submit: Joshua Litt <joshualitt@google.com>
2023-08-10 16:31:56 +00:00
Stephen Adams 7f08f8e494 [dart2js] Add interceptors for JavaScript Symbol and BigInt
The interceptors provide a Dart `toString` method that uses the JavaScript `toString` method.

Issue: #53106

Change-Id: I1cf1df9e24fb4fd2d79679f1f014f39f083be7e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319563
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-08-10 14:42:38 +00:00
Jens Johansen aba5663d0a [analyzer] Deduplicate _Info* instances
When having several contexts we'll end up having many copies of the same
_Info* instances. This CL deduplicates it.
TL;DR: On flutter/flutter (82 contexts) this, when run from a clean
cache, reduces the memory usage by 600-800 MB (~15%).

Details:

All numbers from runs made from analyzer source with a clean cache on
flutter/flutter (82 contexts), memory usage after a forced GC:

Runtime:
No difference proven at 95.0% confidence

Current memory (GB):
Difference at 95.0% confidence
        -0.683333 +/- 0.0627592
        -13.3987% +/- 1.23057%
        (Student's t, pooled s = 0.0276887)

Peak memory (GB):
Difference at 95.0% confidence
        -0.643333 +/- 0.0746028
        -12.5243% +/- 1.45236%
        (Student's t, pooled s = 0.032914)

Heap (used) (GB):
Difference at 95.0% confidence
        -0.77 +/- 0
        -17.5799% +/- 0%
        (Student's t, pooled s = 0)

Heap (capacity) (GB):
Difference at 95.0% confidence
        -0.69 +/- 0.05552
        -15.2993% +/- 1.23104%
        (Student's t, pooled s = 0.0244949)

_List (MB):
Difference at 95.0% confidence
        -59.2333 +/- 0.0925333
        -6.91547% +/- 0.0108032%
        (Student's t, pooled s = 0.0408248)

_Uint32List (MB):
Difference at 95.0% confidence
        -105.433 +/- 1.06715
        -17.3382% +/- 0.175489%
        (Student's t, pooled s = 0.470815)

_OneByteString (MB):
Difference at 95.0% confidence
        -403.667 +/- 2.37542
        -58.1206% +/- 0.342017%
        (Student's t, pooled s = 1.04801)

Raw data:

NOW:

Runtime (ms): 151855
current memory	4.46GB
peak memory	4.54GB
heap 3.61GB of 3.86GB
797.3 MB 6067774 _List
503.1 MB 2574937 _Uint32List
291.7 MB 2233396 _OneByteString
233.0 MB 338029 _Uint8List
158.7 MB 3466691 Reference
116.1 MB 1901830 _Map

Runtime (ms): 152410
current memory	4.40GB
peak memory	4.49GB
heap 3.61GB of 3.80GB
797.3 MB 6067637 _List
503.0 MB 2574976 _Uint32List
290.7 MB 2232326 _OneByteString
226.8 MB 339447 _Uint8List
158.7 MB 3466691 Reference
116.1 MB 1901830 _Map

Runtime (ms): 153205
current memory	4.39GB
peak memory	4.45GB
heap 3.61GB of 3.80GB
797.3 MB 6067638 _List
501.9 MB 2556644 _Uint32List
290.2 MB 2235718 _OneByteString
226.7 MB 338584 _Uint8List
158.7 MB 3466691 Reference
116.1 MB 1901830 _Map




BEFORE:

Runtime (ms): 159178
current memory	5.09GB
peak memory	5.15GB
heap 4.38GB of 4.51GB
856.6 MB 7366027 _List
696.0 MB 3780593 _OneByteString
608.1 MB 5239817 _Uint32List
226.9 MB 341102 _Uint8List
158.7 MB 3466691 Reference
116.1 MB 1901829 _Map

Runtime (ms): 153913
current memory	5.11GB
peak memory	5.13GB
heap 4.38GB of 4.51GB
856.5 MB 7366249 _List
693.8 MB 3730773 _OneByteString
608.1 MB 5239925 _Uint32List
233.0 MB 338205 _Uint8List
158.7 MB 3466691 Reference
116.1 MB 1901829 _Map

Runtime (ms): 157729
current memory	5.10GB
peak memory	5.13GB
heap 4.38GB of 4.51GB
856.5 MB 7366221 _List
693.8 MB 3730773 _OneByteString
608.1 MB 5239924 _Uint32List
233.0 MB 337860 _Uint8List
158.7 MB 3466691 Reference
116.1 MB 1901829 _Map

Change-Id: I5697ff0efd40c9325f7f15d8092655b80b4876ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318940
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-08-10 09:58:31 +00:00
Mayank Patke 4c1bafa809 Reland "[dart2js] Add runtime type check for await."
This is a reland of commit c81711bdda

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: Ida3258ee3768e8bff0161019511647db8b161473
Bug: #50601
Bug: b/295131730
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319462
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-08-09 23:17:18 +00:00
pq fd97cd45ef enforce @redeclare annotation target restrictions
See: https://github.com/dart-lang/sdk/issues/53121

Change-Id: I994aac6c733704ac7adc4a7923ee733cdc77aacb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319561
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-09 22:45:43 +00:00
pq f72c1eba83 update analyzer owners
Change-Id: I5618b46dfa7412c52733a7ad4211aaa1438421e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319602
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-09 22:44:26 +00:00
Konstantin Shcheglov 4dffed5065 Extension types. Report when implemented not extension type superinterface is not a supertype of the representation type erasure.
Change-Id: Ib1f2bfcfe51edb6bcbc54d7165f148810e3df4ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-09 22:18:27 +00:00
Parker Lougheed 6f645c8f1c [analysis_server] Fix TODO in diagnostic_describe_all_properties test
Change-Id: Id81194e0bf07aaa90777055597a9dba914060d3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319620
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-09 22:04:58 +00:00
Konstantin Shcheglov e5a16ae775 Extension types. Report self reference in implements clause.
Change-Id: Icd26dcd6cf7521e075d6a8f13a985f3185c02369
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319584
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-09 20:56:25 +00:00
pq 8db531a948 update mocked package:meta to 1.10
Change-Id: I6d3afd37a31302855d426085547eda67a145efd8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319385
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-08-09 20:23:48 +00:00
Danny Tuppeny aee6d0af18 [analysis_server] Restore use of pathContext.fromUri() for parsing file URIs in the LSP server
This reverts be4189f047 plus adds an additional test to verify pkg:path to behaviour (to catch future regressions or if pkg:path has to be reverted, this will need reverting too).

This relies on the fix made at https://github.com/dart-lang/path/issues/148 which rolled into the SDK in f1de897762.

Change-Id: I1dea45e2017f7505bc4aca97f6c07c1a6e445a5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319523
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-09 19:39:22 +00:00
Konstantin Shcheglov 49ec5d5e7a Extension types. Tests for type literal.
Change-Id: I552119f6d2ff913c112d89cdf892ca7cbfdbef48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319581
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-09 18:46:08 +00:00
Konstantin Shcheglov 0540ac84e1 Extension types. Report an error for super formal parameters.
Change-Id: I0e577dbe9d27913ce633951c68b2891f48699ca6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319560
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-09 18:45:51 +00:00
Konstantin Shcheglov 00e30a89ff Extension types. Test InstanceCreationExpression and secondary constructor.
Change-Id: Id9b0ab27f4f851ecb992c15d1b1bfb1742d77b84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319582
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-08-09 18:44:14 +00:00