Commit graph

90732 commits

Author SHA1 Message Date
Sam Rawlins 9833cb477c [analyzer] Move 4 more HintCodes to be WarningCodes, NON_CONST*, NULL_CHECK*, STRICT_RAW_TYPE
Bug: https://github.com/dart-lang/sdk/issues/50796
Change-Id: Idcac3ddb582e5b46263fd017c39402b1c11914d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289447
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-03-18 01:48:49 +00:00
Konstantin Shcheglov 35b7f2dd97 Update to expect either 'dynamic' or a subtype in irrefutable context.
https://github.com/dart-lang/language/pull/2926

Change-Id: Ic9fd0b097ca70c15a184269a10e8a87eb34bb79d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289440
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-03-18 00:30:08 +00:00
Srujan Gaddam 9ce261faec [pkg:js] Update SDK upper constraint to 4.0.0
Change-Id: Ia41ee7f1f8705e06c4d75f7a2c4e673d92d64af2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289446
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-03-17 23:08:31 +00:00
Robert Nystrom 6de72778ff Add tests for where coercions do and don't happen in patterns.
These tests reflect the intended behavior after
https://github.com/dart-lang/language/pull/2926 lands.

Change-Id: I7ce1991dfc9b247b0c6ce6ee2714b5f207a4040d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289404
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2023-03-17 23:04:25 +00:00
Nate Biggs 71a6e8be8f [dart2js] Add unit tests for RecordTypeMask operations.
Change-Id: I03d988ffda39fa2416f429f464cb23aedbd1f44f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289083
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-03-17 22:50:44 +00:00
Nate Biggs a2719b5552 [dart2js] Make use of new RecordTypeMask for creation of record literals/constants as well as record field accesses.
All calls on records are no longer treated as essentially dynamic calls.  So a call to `record.foo` will not pull all `foo` members into the program (including unused ones). For example in the below test the getter `any` was causing `JSArray.any` to be included in the program. After this change it is no longer pulled in.
https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Records/members_A04_t02.dart#L39

Change-Id: If1f9eac1abadeeed80dca917a8912129d090643e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287681
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-03-17 22:50:44 +00:00
Nate Biggs 2e05ad2fda [dart2js] Add RecordTypeMask to type mask domain.
This implements all the subtyping relationships for records as well as any other predicates needed for the abstract value domain.

In the next CL we make use of this new mask when constructing the types for record literals and when accessing fields of a record.

Change-Id: Ibf12b95e439e2c12be9e4db51f5023df379d48f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288101
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-03-17 22:50:44 +00:00
Mayank Patke 0d583f707c [dart2js] Add failing test for issue #49588.
Bug: #49588
Change-Id: If19b956642ff55ca6d54e7b9df21cbc516d05d93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253710
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2023-03-17 21:32:22 +00:00
Nicholas Shahan bd62be296c [tests] Avoid imports across null safety suites
Updates imports in `tests/lib_2` from `tests/language` to use the
version in `tests/language_2` instead.

I think it is also a little awkward to import libraries across
tests suites period but that is an issue for another day.

Change-Id: Ib61bb1e1790926f92ee2650a6497916f2edce7ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289407
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-03-17 20:03:37 +00:00
Mayank Patke a2307a1110 [dart2js] Use CFE static types for variables in null-safe libraries.
Fixes: #49588
Change-Id: Ib0de059f17660450385253061dc1e313a5671309
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289060
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-03-17 19:44:34 +00:00
Mayank Patke 62e3c47e45 [dart2js] Don't rely on == null promoting to Null in rti.dart.
Although the true branch of `x != null` and the false branch of `x ==
null` promote `x` to non-nullable, the opposing branches do not promote
`x` to `Null` in the current flow analysis spec, which applies to the
CFE.

When switching from the dart2js static type computation to the CFE
static type computation, attempting to use `x` in these branches may
generate an unintended type check, which can overflow the stack if this
occurs in code responsible for performing type checks. The fix is fairly
straightforward - we can simply use an unchecked cast (via `JS`) instead.

See https://github.com/dart-lang/language/issues/1505 for discussion on
why the expected promotion does not (yet) occur.

Change-Id: Ia9cca4e1aa8e9c67b42c60189f0d3811afb61360
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289061
Reviewed-by: Stephen Adams <sra@google.com>
2023-03-17 19:44:34 +00:00
Nate Bosch 6f45c8534e Bump matcher to dc310d95663da10a90e7898cd4e322695f693d4f
Changes:
```
> git log --format="%C(auto) %h %s" c1a0704..dc310d9
 https://dart.googlesource.com/matcher.git/+/dc310d9 Export more APIs through the expect library (213)
 https://dart.googlesource.com/matcher.git/+/7538872 Make the arguments to `expect` dynamic again (212)
 https://dart.googlesource.com/matcher.git/+/52e232e Fix import and broken tests (211)
 https://dart.googlesource.com/matcher.git/+/985e4ef Improve mismatch description of `contains` (206)
 https://dart.googlesource.com/matcher.git/+/5bc765d Copy expect and async matchers from test package (210)

```

Diff: https://dart.googlesource.com/matcher.git/+/c1a07043de3da4968e1736fcde1c521802821859..dc310d95663da10a90e7898cd4e322695f693d4f/
Change-Id: I11b074e97c9c49ba46760da44a99f795523d3008
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289445
Commit-Queue: Kevin Moore <kevmoo@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2023-03-17 19:44:30 +00:00
Daco Harkes 1755f89092 [vm/ffi] Add class modifiers
Adds class modifiers to `dart:ffi`.

Migrates all user-defined subclasses of `Struct`, `Union`, `Opaque`,
and `AbiSpecificInteger` to be `final class`es.

Does not remove the manual error checking, so some errors will show up
twice now in language version 3.0. In language version <3.0, only the
FFI-specific error will show up.

In a follow-up CL, we will try to make the language-errors to show up
also <3.0 so that we can remove the FFI-specific errors.

Examples of duplicated errors:
pkg/analyzer/test/src/diagnostics/subtype_of_ffi_class_test.dart

TEST=pkg/analyzer/test/ (for the analyzer)
TEST=pkg/front_end/testcases/ (for the CFE)
TEST=test/ffi/ (for the VM)

CoreLibraryReviewExempt: No need for dart2js to review.
Bug: https://github.com/dart-lang/sdk/issues/51683
Change-Id: I2964ceccb7db59fbdaf6be5319f5e4ec2dabe0f3
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-win-release-try,pkg-mac-release-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-reload-rollback-linux-debug-x64-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289223
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-03-17 19:29:41 +00:00
Mark Zhou 80c2b02bd0 [ddc] Adding a runtime flag for real deferred loading in DDC
Change-Id: If50f7437c827a32829f5093cb3a14cbc5e55f7a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289340
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
2023-03-17 18:04:48 +00:00
Jake Macdonald 2cec283bd0 update covariant setter test to test mixin class behavior also
Change-Id: I8f87f5d2d7745719462e0782176b04a595cdd5f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289521
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-03-17 17:38:49 +00:00
Ilya Yanok d190e16766 Fix handling of @Injectable functions
Recent changes that made migration tool more conservative affected
functions used in Angular's DI: functions annotated with `@Injectable`
must have non-nullable non-annotated arguments. Previously that
worked just because there was no reason to make them nullable.

Make such functions' arguments explicitly non-nullable.

Bug: b/250862403
Change-Id: I27207994b058ba845aafd7776d14380e8104e8f8
Tested: added a test
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289505
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
2023-03-17 17:28:41 +00:00
Johnni Winther 7cc2553fa1 [_fe_shared_analyzer] Use real exhaustiveness checking algorithm
This changes the analyzer and CFE to use the real exhaustiveness
checking algorithm. The fallback algorithm is kept and will be
removed once we know that the real exhaustiveness algorithm sticks.

Change-Id: Ic9df92c1ca9f7dec4cbdfa138dc6ed39ef2d4df5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288703
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-03-17 16:45:35 +00:00
Konstantin Shcheglov 771042f5ca Prepare to publish analyzer 5.8.0 and _fe_analyzer_shared 56.0.0
Change-Id: I09c65e9897fb8fe77c668fac8044da9b73b0f41a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289441
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-03-17 16:36:59 +00:00
Nicholas Shahan cf7d78cc2c [dart2js] Run modular steps with sound null safety
Update the dart2js and kernel worker steps themselves to run
with sound null safety. This is separate from the code being compiled
in the step which will be migrated in another change.

Change-Id: Idbaaeb255209e79bb34aa34aedeb020be097c1c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289408
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2023-03-17 16:26:10 +00:00
Ivan Inozemtsev 4c70caf4df [deps] rev http
http (805a147..74f9d3d):
  74f9d3d  2023-03-09  Brian Quinlan  Add conformances test that verify that the Client works in Isolates (#889)
  ee03604  2023-03-09  Brian Quinlan  Add a flag to allow the default Client to be tree shaken away. (#868)
  2039fb3  2023-03-09  Brian Quinlan  Fix a reference count race with forwarded delegates. (#888)

Change-Id: I56faf5cf41ad16f6a365db66265b02e66adbc59f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289502
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Auto-Submit: Ivan Inozemtsev <iinozemtsev@google.com>
2023-03-17 16:25:08 +00:00
Jake Macdonald 3b06df241f Clean up a number of 2.19 opt outs in language tests.
This is less than half of them, will send some other chunks later.

Bug:51557
Change-Id: I4e80812a689fde99e23c34b6405aaf57cd431ce8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289261
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2023-03-17 16:17:50 +00:00
Brian Quinlan e34165c543 Reland "[io] Improve the performance of the IOSink returned by openWrite by writing eagerly and accumulating small writes."
This is a reland of commit c2bdda63f5

Original change's description:
> [io] Improve the performance of the IOSink returned by `openWrite` by writing eagerly and accumulating small writes.
>
> Benchmarks (benchmarks/FileIOSink/dart/FileIOSink.dart):
>
>  @before:
>
>   FileIOSink.Add.ManySmall(RunTime): 2341597.0 us.
>   FileIOSink.Add.OneLarge(RunTime): 111.06925927974774 us.
>   FileIOSink.Add.AlternatingAddSize(RunTime): 105.65958788898234 us.
>
>  @after
>
>   FileIOSink.Add.ManySmall(RunTime): 5007.1125 us.
>   FileIOSink.Add.OneLarge(RunTime): 98.23492468475541 us.
>   FileIOSink.Add.AlternatingAddSize(RunTime): 91.77411527720551 us.
>
> So the relative performance changes are:
>
>  FileIOSink.Add.ManySmall(RunTime): 0.00213x (MUCH faster)
>  FileIOSink.Add.OneLarge(RunTime): 0.884x (slight faster - noise?)
>  FileIOSink.Add.AlternatingAddSize(RunTime): 0.868x (slightly faster - noise?)
>
> https://golem.corp.goog/Revision?repository=dart&revision=102771&patch=17842
>
> Change-Id: Ic73f33299a570096dd05f254982f556767559966
> Bug:https://github.com/dart-lang/sdk/issues/32874
> Tested: unit tests
> CoreLibraryReviewExempt: Performance-only fix for file writes in the VM.
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285420
> Commit-Queue: Brian Quinlan <bquinlan@google.com>
> Reviewed-by: Alexander Aprelev <aam@google.com>

Bug: https://github.com/dart-lang/sdk/issues/32874
Change-Id: I758f3159e85c837d6ec4a0f3e470b519825ee142
Tested: unit tests
CoreLibraryReviewExempt: Performance-only fix for file writes in the VM.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288545
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2023-03-17 16:13:19 +00:00
Ben Konyi dcd65d0122 [ Benchmarks ] Update SDKArtifactSizes benchmarks to include dart2wasm and DevTools
TEST=N/A

Change-Id: I8633762410c9df753f147b3010294ed56e82e6ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289520
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Sigurd Meldgaard <sigurdm@google.com>
2023-03-17 16:08:02 +00:00
Konstantin Shcheglov d362996c9c Issue 51758. Don't consider not ClassElement to be a supertype of a class type alias.
Bug: https://github.com/dart-lang/sdk/issues/51758
Change-Id: I9ffd2b1fc539a569d8ec89c6885359594dd54c0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289403
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-03-17 15:53:38 +00:00
Ilya Yanok 43b74160e0 Fix crash when trying to do cast X to FutureOr<X>
Bug: b/273826476
Change-Id: Ifcaa5c936c87ea494658a547a7514e0fbd0c0b7f
Tested: added a test
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289504
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Ilya Yanok <yanok@google.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
2023-03-17 15:36:34 +00:00
Modestas Valauskas 337d2cc8b1 [ANTLR] Move optional trailing question mark up.
Closes https://github.com/dart-lang/sdk/pull/51742

GitOrigin-RevId: 8aed1ba4ebbd14aa88a74f4f23464e2c24a10c38
Change-Id: I8184a2edc66acc79c51d3838b0849c4a414784fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288981
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2023-03-17 11:33:59 +00:00
Sergey G. Grekhov 8912e03797 [co19] Roll co19 to e8141111c3315b0a9c151fcac0e14656dcfddac5
2023-03-16 sgrekhov22@gmail.com Fixes dart-lang/co19#1933. Generic function instantiation during pattern matching is a compile error (dart-lang/co19#1938)
2023-03-16 sgrekhov22@gmail.com Fixes dart-lang/co19#1939. Missed line added to variable_declaration_A04_t03.dart (dart-lang/co19#1943)
2023-03-16 sgrekhov22@gmail.com Fixes dart-lang/co19#1941. Typo fixed in type_inference_A26_t01.dart (dart-lang/co19#1942)
2023-03-16 sgrekhov22@gmail.com dart-lang/co19#1401. Matching tests for record and object patterns (dart-lang/co19#1934)
2023-03-15 sgrekhov22@gmail.com dart-lang/co19#1401. Matching tests for list pattern (dart-lang/co19#1920)
2023-03-14 sgrekhov22@gmail.com Fixes dart-lang/co19#1930. Make runtime type of collection not assignable to the tested pattern (dart-lang/co19#1936)
2023-03-14 sgrekhov22@gmail.com Fixes dart-lang/co19#1932. Fix compile-time error in matching_logical_and_A02_t02.dart (dart-lang/co19#1935)
2023-03-13 sgrekhov22@gmail.com Fixes dart-lang/co19#1896.Explicit type arguments added (dart-lang/co19#1926)
2023-03-13 sgrekhov22@gmail.com Fixes dart-lang/co19#1925. Missing type arguments added (dart-lang/co19#1927)

Change-Id: I8b10d553f666b96e0b0039a946b7ec821b230951
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289460
Reviewed-by: Alexander Thomas <athom@google.com>
2023-03-17 09:19:24 +00:00
Johnni Winther bf68f9320b [_fe_analyzer_shared] Improve exhaustiveness for cast pattern
This uses the context type when creating the space for a cast pattern
to include the implicitly covered subtypes in the space. This is done
when the context type is a sealed type which means that we can reason
about which of the subtypes of the sealed type that are implicitly
handled by the throw of the cast.

Change-Id: I3a4f14bf6ca82f59a2c2a3c27bb472a8f38c1613
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289222
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-03-17 08:10:53 +00:00
Nate Biggs 21737a6c2e [dart2js] Fix type variable detection for interfaces nested in records for RTI.
Change-Id: I9661498582eb170077eb3d58d8a84fab2e2d8bf6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289380
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2023-03-17 03:30:14 +00:00
Sam Rawlins fbe4cbf69f Bump linter to 07c4d17, just before new deprecated_member rule
Bug: https://github.com/dart-lang/sdk/issues/50796
Change-Id: I11d1ad107d8da147dd05329938bbe34325dfbb77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289341
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-03-17 03:14:17 +00:00
Konstantin Shcheglov 5604db5fc9 Issue 51661. Fix for SwitchExpression in serialized expressions.
Change-Id: I64a56c8349898b7e2795df9ef1513f9288286668
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288548
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-03-17 00:57:59 +00:00
Joshua Litt 743caee6f0 [js_types] Migrate Dart2Wasm internal interop classes to JS types.
Change-Id: I0cd2ca8d7b254372818beb5af66662dc276dd29e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288640
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-03-16 22:50:05 +00:00
Danny Tuppeny 539dad5657 [analysis_server] Support moving sealed classes in "Move to File" refactor
Change-Id: Idc7b48c5f972a139b0675876d193fbed157ce27b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288701
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-03-16 20:54:34 +00:00
Konstantin Shcheglov 3802bc7e32 Support for RecordTypeAnnotation in constants, in summaries.
Change-Id: I3569b719f61de9e10a80e251918c512f52958d3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289301
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-03-16 20:41:22 +00:00
Sam Rawlins f46c9afc12 [analysis_server] Add type arguments to remaining raw types
The Maps are all JSON, so they become `Map<Object?, Object?>`.

Most other types get a `Object` or `Object?` type argument, and a
few also get `dynamic`.

Change-Id: I097318defed55360b5b0d910bd2d085a121e97b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287673
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-03-16 20:37:57 +00:00
Danny Tuppeny 454219b371 [analysis_server] Retain body's leading comments when adding curly braces
Fixes https://github.com/Dart-Code/Dart-Code/issues/4440.

Change-Id: Ibff7c0d0a04f3c122d3ffa2297ab3da6c5532ee0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-03-16 19:29:33 +00:00
Kallen Tu 26311db0b5 [cfe] Avoid reporting subtype modifier errors on final supertypes outside of library.
Change-Id: Ib923df6e9fcfb48e3c16a3edd4e308547cdb4348
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288607
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-03-16 19:01:17 +00:00
Sam Rawlins c761de6e3e [analyzer] Move 3 more HintCodes to be WarningCodes, UNNECESSARY_N*
Bug: https://github.com/dart-lang/sdk/issues/50796
Change-Id: I04e8428a45428c02a05e8370a6cb1e9c4cf8030c
TEST=trybots
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289029
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-03-16 18:52:18 +00:00
Janice Collins 68353d76a4 Add a flag to disable the new unified_analytics for a single session.
- Adds a new flag, `--suppress-analytics` to the `dart` command to
  disable both the unified and the legacy analytics for a single
  session while deprecating the existing flag, `--[no-]analytics` used
  for disabling the legacy analytics on a single pass.
- Pipelines the flag from `dart` through `dart analyze` and `dart fix`
  to the execution of the analysis server.
- Updates all applicable uses of `dart analyze`, `dart fix`, and the
  analysis_server binary entry points in the SDK to disable analytics
  for the test infrastructure.

Bug: https://github.com/dart-lang/sdk/issues/49445
Change-Id: I1302cad7e04b21454aa7d9e8ee72a876b231377d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287661
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
2023-03-16 18:00:57 +00:00
Derek Xu ec39319bf7 [VM/Timeline] Add a synchronization monitor to TimelineTrackMetadataRace test
The test is still timing out on many configurations. Hopefully changing
the spin lock to a monitor fixes this.

TEST=TSAN, CI

Issue: https://github.com/dart-lang/sdk/issues/51654
Change-Id: I03d1199c18a225bbd621613211ef6a4ceee93ac7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289000
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-03-16 17:46:28 +00:00
Jake Macdonald 51d5eb6e93 Remove build_daemon constraint from web template.
Having this hard coded means that older SDKs will forever put in a bad constraint, which will ultimately cause webdev to fail initially for all new projects created by those SDKs.

Bug:https://github.com/dart-lang/sdk/issues/51732
Change-Id: Icfbeda77662f62124e350b0f55c5a59b864c689f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289260
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2023-03-16 17:15:52 +00:00
Joshua Litt c828440c79 [js] Erase types in _skwasm_impl.
Change-Id: If6375a383b84c4eeb2ad90a8bf544d725d9502a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289025
Auto-Submit: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
2023-03-16 17:04:17 +00:00
Devon Carew f910c3d92b [libraries.dart] update and normalize the libraries.dart file
Change-Id: Iee3f9439fd77d2d65b9017b55a552cfeb372685e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289065
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-03-16 16:59:55 +00:00
Daco Harkes 1f598154a0 [beta][vm] Fix Dart_CObject_Type breaking change
https://dart-review.googlesource.com/c/sdk/+/257925 added a new entry
in the middle of the `Dart_CObject_Type` enum, which changed the
value of the entries below. However, this enum is part of
`dart_api_dl.h` and versioned by `dart_version.h`.

New entries to `Dart_CObject_Type` should be added at the end of the
enum to avoid making breaking changes to the type.

TEST=tests/ffi/vmspecific_handle_dynamically_linked_test.dart

Bug: https://github.com/dart-lang/sdk/issues/51459
Bug: https://github.com/dart-lang/sdk/issues/51615
Cherry-Pick: https://dart-review.googlesource.com/c/sdk/+/284161
Change-Id: Ic3e37255bdbc2d75af7b9894a61293c84428e042
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286741
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-03-16 16:28:43 +00:00
Johnni Winther 31f168daaa [cfe] Report error on identical keys in map patterns
Change-Id: I30b7da4470e00c511a42861137e07f1cb88c7e84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288901
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-03-16 15:40:59 +00:00
Alexander Markov c2d664a5e9 [vm/compiler] Take cid into account when deciding if CheckClass is needed during inlining
The recent change [1] improved availability of static types.
While that change improved performance on a lot of benchmarks,
it also caused a regression of SkeletalAnimationSIMD
benchmark in JIT mode.

The benchmark regressed because:
* When inlining a recognized method in call specializer,
  compiler checks if an extra CheckClass instruction should be
  inserted using FlowGraph::CheckForInstanceCall.
* CheckForInstanceCall has been looking only at the static type of
  the receiver. When static type is absent, it is calculated from cid.
  For a method lookup, cid is more precise compared to a static type.
  So, when static type becomes available since [1], cid was no longer
  used and extra CheckClass instructions were inserted to the IL.
* During inlining, extra CheckClass instructions increased callee size
  and a useful inlining didn't happen, prohibiting other optimizations
  and causing the regression.

This change fixes CheckForInstanceCall to look at the cid
first before looking at the static type.

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

TEST=SkeletalAnimationSIMD benchmark

Change-Id: I8cb496dee443eab9db828f1e28ba1efe7ea3f8ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289020
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-03-16 14:35:58 +00:00
Sam Rawlins 2b17d6d883 Report CAST_FROM_NULL_ALWAYS_FAILS in CastPatterns
Bug: https://github.com/dart-lang/sdk/issues/51750
Change-Id: I71372456878beee9cfb0a16a025ca0f6d432d622
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289240
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-03-16 14:29:57 +00:00
Chloe Stefantsova 21bf3b60b6 [cfe] Utilize analyzePatternForIn in the CFE
Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: I259bb247e08542d8d5ba7785b02fd916adc28ed0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288760
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-03-16 14:10:31 +00:00
Johnni Winther 712930e834 [cfe] Remove ConstantEvaluator.libraryOf
Instead of finding the current library through the parents relation
we use the static type context which already had access to the
library.

Change-Id: Ia2116160b24b701ffa0794b9ccc9a59506c3adc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288840
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-03-16 13:37:19 +00:00
Johnni Winther c62534fc03 [cfe] Clean up properties on Pattern classes
This removes the "unset" values and uses nullable types instead.
The names and uses of the pattern fields are normalized, using
`matchedValueType`, `requiredType` and `lookupType` consistently
between [Pattern] subclasses.

TEST=existing

Change-Id: Ic79ce17075aa8ce252e1c223b59bef660f32bb7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288704
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-03-16 11:43:58 +00:00