Commit Graph

43220 Commits

Author SHA1 Message Date
Johnni Winther 9b42e2d166 [cfe] Generate covariant checks in pattern matching
Closes #52192

Change-Id: Iaac816273fb80eaf166fc300b2b3367f1a592d3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302223
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-05-09 11:02:45 +00:00
Chloe Stefantsova 40d99bc981 [cfe] Remove extra conditions on await-for in non-async body check
Additionally, report the error on the 'await' keyword instead of 'in'

Change-Id: I0ccd156f19997eb18b5df004a75f86e616b23864
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301021
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-05-09 06:56:44 +00:00
pq 23d65641fb + convert_to_boolean_expression correction
Fixes: https://github.com/dart-lang/sdk/issues/52304

Change-Id: Ic080188be5abc70fe1f0da0a7117f31d64a16aa2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302121
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-09 03:44:37 +00:00
Sigmund Cherem 941b50f3d8 [dart2js]: delete DoesNotCompleteType.
This was added before null safety, and before we had fully
defined the difference between Null, Bottom, and Never types.

I believe now this and Never.nonNullable are equivalent and
the distinction is no longer important to make. Hence, I'm
deleting it to reduce tech debt.

Originally this was added in https://dart-review.googlesource.com/c/sdk/+/88961

Change-Id: I64b3a8b01833bc60305eaecf430bfb249c8d2c98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301820
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2023-05-09 02:56:57 +00:00
Kallen Tu 6de1afdb3a [analyzer] Disallow implementing a legacy library subclass of a final class.
Checks an interface's supertypes for final classes and produces an error if the implementing bypasses a legacy library.

This behaviour should only happen when a post-feature library implements
a pre-feature library declaration that has a final class as a super
declaration.

Similar error to https://dart-review.googlesource.com/c/sdk/+/298320

Bug: https://github.com/dart-lang/sdk/issues/52078
Change-Id: Ie16edb2b231957dad7502fdab3d5faba93bc6773
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/300861
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-05-08 23:16:53 +00:00
Brian Wilkerson 5a046ceedd Convert library prefix completion tests
Change-Id: I2c433ed634d70bb3e03f343503c4e0052ef4df4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302140
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-05-08 22:34:54 +00:00
Keerti Parthasarathy 261fa6fb3a Wire up argument_type_not_assignable for data driven fixes.
Fix nits in documentation.

Add support for data driven fix for change parameter to non null.


Change-Id: I3120c74eb13e06640aa6ff0b9538e5552f7ae9f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/298261
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-08 22:02:20 +00:00
Brian Wilkerson b6ecad0f03 Convert label completion tests
Change-Id: I35fad846602bf23116c499272068728176f9efbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301729
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-05-08 21:40:29 +00:00
Konstantin Shcheglov 1e626dc929 Issue 52306. Don't report UNNECESSARY_IMPORT when deprecated exports.
Bug: https://github.com/dart-lang/sdk/issues/52306
Change-Id: I20a36ea355df463857b56cb05bcef0ef72f6850d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302080
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-08 19:50:29 +00:00
Konstantin Shcheglov 2e6bdc29de Add InvalidType, InvalidTypeImpl, but don't resolve to it yet.
I ran the CL that does resolve with it in google3, it is mostly
green, but there are a few clients that extend TypeVisitor directly.
So, I want to publish the interface `InvalidType` first, update the
clients, and only then update the resolution.

Bug: https://github.com/dart-lang/sdk/issues/36697
Change-Id: I1f1c995a36849ebbde2c526bb8761d86be87b4ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301481
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-08 19:48:03 +00:00
Paul Berry 3713c0e264 Patterns parser: prohibit variable/identifier patterns named when/as.
In https://dart-review.googlesource.com/c/sdk/+/299400, the parser was
adjusted so that it no longer accepts `when` and `as` as the names for
variable patterns in cases where there is a possible ambiguity
(e.g. `int when` is not accepted as a pattern because `int` is a
legitimate pattern, therefore `when` could introduce a guard
clause). This change further prohibits `when` and `as` from being the
names of variable patterns or identifier patterns even in the case
where there is no ambiguity. This is in line with the discussion at
https://github.com/dart-lang/sdk/issues/52199#issuecomment-1526297771,
and the spec change at
https://github.com/dart-lang/language/pull/3033.

Three new error codes are introduced, to cover the three circumstances
in which `when` or `as` might be used illegally: in a declared
variable pattern, in an assigned variable pattern, or in an identifier
pattern. I've also added analyzer tests to ensure that the parser
recovers from these errors nicely. Unfortunately, nice error recovery
is only feasible in the non-ambiguous cases.

I've also updated the language test expectations in
`tests/language/patterns/version_2_32_changes_error_test.dart` to
reflect the new error messages, and added a few more examples of uses
of `when` and `as` that are still permitted.

Fixes #52260.

Bug: https://github.com/dart-lang/sdk/issues/52260
Change-Id: I229f627aa639659c30b83c74895759207da279f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301482
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-05-08 19:06:02 +00:00
yanok@google.com 6e18b083dd Support non-function type aliases
I'm actually not sure we are doing the right thing for general
aliases (that can now be nested arbitrarily deep), but at least
this commit avoids throwing an exception.

Change-Id: Ide3f7035b476f79fff5c542e2ddbb342045a874e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301983
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
2023-05-08 15:50:28 +00:00
yanok@google.com c15d215653 Don't force target type equality for null-aware extension method calls
Null-aware calls, like `v?.extMethod()` don't require `v` to be
non-nullable, even if `extMethod` was declared on a non-nullable type.

Tested: added a new test.
Change-Id: I113ecde21e480bcd467367d0954b721c2ad9f7e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301982
Reviewed-by: Paul Berry <paulberry@google.com>
2023-05-08 15:50:28 +00:00
Ilya Yanok a84e6461b2 Fix a test failing at HEAD
It looks like it's failing as a result of my previous changes
to make public function/method arguments nullable by default.

I probably missed it, since it doesn't run with assertions
enabled.

Change-Id: Ifcf045d778302a0be771c3a75c94cec97cbf8060
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301981
Reviewed-by: Paul Berry <paulberry@google.com>
2023-05-08 15:50:28 +00:00
Konstantin Shcheglov 757d9ae199 Issue 52280. Use the URI as LibraryElement.toString()
Bug: https://github.com/dart-lang/sdk/issues/52280
Change-Id: I15fa5a9cdc2017d91f6d75da17430c060624695e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301726
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-08 15:41:23 +00:00
Konstantin Shcheglov 44ba2eba08 Issue 52258. Ignore 'int' and 'double' pairs, are the same in JavaScript.
Bug: https://github.com/dart-lang/sdk/issues/52258
Change-Id: I01f167bf597f11cb8dec7864c3074d16ad44c2d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301725
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-08 15:39:52 +00:00
Daco Harkes 8beb778e64 [analyzer/ffi] Fix spurious FFI errors
Closes: https://github.com/dart-lang/sdk/issues/52298
Change-Id: Ibfccd34a877d5786f4720790b5ff88dcc643c9d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301980
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-05-08 15:16:05 +00:00
Derek Xu 8ccece520f [DDS] Prepare to publish package:dds 2.8.1
Fixes: https://github.com/dart-lang/sdk/issues/52270
Change-Id: I08ef372653adfd04eab9d45da225a5bfda74531c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302000
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-05-08 15:14:44 +00:00
Konstantin Shcheglov bf5bdc97ff Issue 52296. Fix NPE in AddTypeAnnotation, when formal parameter without name.
Bug: https://github.com/dart-lang/sdk/issues/52296
Change-Id: I6f3952faa9f3fc9e7f9e1d83c4699222be8dbcdc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301731
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-08 14:54:48 +00:00
Konstantin Shcheglov c63263cbf5 Issue 51855. Add debug output.
Bug: https://github.com/dart-lang/sdk/issues/51855
Change-Id: Ifd8f3cf1f4e82536b475fb7460c27d1ba73672e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301732
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-08 14:47:32 +00:00
Konstantin Shcheglov 8c97d0cfe3 Add static invocation case for EXTENSION highlighting.
Change-Id: Ibc4065b95ac8902f50fafe14ecd451abf8fb3c8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301733
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-08 14:40:38 +00:00
Konstantin Shcheglov 036b8cafad Add AnalysisError.tmp() constructor, deprecate the default one.
Bug: https://github.com/dart-lang/sdk/issues/51985
Change-Id: I1204c71a4c5ea62d32d65662ecb5274dacb0bfae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301730
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-08 14:39:29 +00:00
Johnni Winther 3e0672ae7c [_fe_analyzer_shared] Handle nullable type variables in exhaustiveness checking
Closes #52212

Change-Id: Ie81f873c59db7859c5a1075563d5c0ac00c94bfb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301441
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2023-05-08 09:15:01 +00:00
Johnni Winther 13c4ad23c5 [kernel] Add SwitchStatement.expressionType
This adds the static type of the switch statement expression to
the AST to better support optimizations based on the possible
runtime values of the switch expression.

TEST=existing

Change-Id: Ief35b687150401100d8c96721a026e9f0911b3b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301063
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2023-05-08 07:39:02 +00:00
Konstantin Shcheglov f572144809 Issue 52271. Report FINAL_CLASS_EXTENDED_OUTSIDE_OF_LIBRARY when via library before class-modifiers.
Bug: https://github.com/dart-lang/sdk/issues/52271
Change-Id: I94049f8702647fc604c42ce353afce9d19322d8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301506
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-06 17:16:28 +00:00
Brian Wilkerson 1906adea11 Rewrite completion tests for extension methods
Change-Id: Icda038d078519f7eb5018d7f6089620dd6931c52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301660
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-05-05 21:17:19 +00:00
Nicholas Shahan b18efe2891 [ddc] Update type parameter representations
Previously type tests involving type parameter types would
be replaced with native primitive tests when the type parameter
was bounded by a type with a native representation. This isn't
always correct because the type parameter can always be inhabited
by the bottom type at runtime. So code like `x is T` would be true
when `T` is instantiated as `Never` and `x` is any primitive value
like a number, string, or bool.

This change removes the incorrect optimization that allowed type
parameters to be replaced with their bound when that bound was
represented by a native type when performing an `is` operation.

Fixes: https://github.com/dart-lang/sdk/issues/52243
Change-Id: I57cebef7bb533d71831ef84415b3d91369758476
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/300820
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
2023-05-05 21:13:40 +00:00
Brian Wilkerson aa75db8cb2 Fix race condition in analytics
I don't know how to write a test that ensures that we will attempt to
modify the collections after entering the for loop. Suggestions welcome.

Bug: https://github.com/dart-lang/sdk/issues/52263
Change-Id: Ifc13e80594bd08f6c485d8898eb7c75b31172992
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301780
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-05-05 21:02:29 +00:00
Konstantin Shcheglov f90c3d0423 Issue 52272. Report DEPRECATED_MIXIN_FUNCTION in more places.
Bug: https://github.com/dart-lang/sdk/issues/52272
Change-Id: I02133f8685adf6a1e4fa16288948cc31afeb1bd4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301560
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-05 20:02:28 +00:00
pq f03e5b424a remove invalid failing test
(This test makes no sense.)

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

Change-Id: I9fb25a9f6252f1b67e9b559997d26683fd8f758b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301720
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-05-05 17:56:00 +00:00
Sigmund Cherem 1c59f30d7b [dart2js] fix crash with records and null-assertions.
Our helper function to detect whether a null-assertion was required
didn't include a case to check for record types.

The null-assertion flag is likely to go away soon, since it's
only valuable for mixed applications.

Fixes #52276

Change-Id: Ief4515b8c3eaae5343012da4220e6051bb5a2f19
Fixed: 52276
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301680
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2023-05-05 17:20:13 +00:00
pq 7e175b7863 + completion suggestions for pubspec "screenshots"
Fixes: https://github.com/dart-lang/sdk/issues/50179

Change-Id: I34a07d3ad28085d75d4ac2fa24f5b4d2e2dad7b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301483
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-05 16:54:24 +00:00
Konstantin Shcheglov 4d6f49b1cd Update ExtensionOverride to use ImportPrefixReference and name token.
Change-Id: Ifc5852c775a95908992d33a7949b4f4bea396d66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/299920
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-05 15:42:36 +00:00
Stephen Adams d3da4311c0 [dart2js] Lower String.codeUnitAt to charCodeAt
Change-Id: Id4408a761304fc2fcb7ce3bd353c626958971ffb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/300500
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-05-05 15:27:11 +00:00
Konstantin Shcheglov 40de1ab1ab Issue 46514. Report an error for using extension methods in a prefix or binary constant expressions.
Bug: https://github.com/dart-lang/sdk/issues/46514
Change-Id: I59ed3bd754043302632f31aedeaedd7824b8a8c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301505
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-05 02:31:19 +00:00
Mark Zhou b6870138ee [ddc] Extending library-to-module resolution to include libraries referenced in the current component
Required for upcoming deferred loading changes.

Our previous only stored this resolution logic for all componets except the
current component, which resulted in some empty deferred loads when referencing
modules in the main component.

Also adds a small type signature update missed in a previous commit.

Change-Id: I8511a39b26e1864919cc4882a6c008d2010354a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/299381
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2023-05-05 01:14:41 +00:00
pq 3edd793682 + pubspec "topics" code completion suggestions
See: https://github.com/dart-lang/sdk/issues/52256

Change-Id: I06ed28bf7280e5c6d8762d73b0d7b085a6ca08c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301181
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-04 22:28:19 +00:00
Derek Xu 33ab02b064 [DDS] Add getPerfettoVMTimelineWithCpuSamples RPC
Change-Id: I3d8e5c48f5482e787ab9d561692d416c50f37a8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301541
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-05-04 20:23:09 +00:00
Derek Xu cd83aa8494 [VM/Service] Prepare to publish package:vm_service 11.5.0
TEST=`dart pub publish --dry-run`

Change-Id: I6ef1c8175f39a086716be859068518d124124718
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301540
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-05-04 20:20:58 +00:00
Ömer Sinan Ağacan e20d2d2103 [dart2wasm] Fix completer.future type in for-in lowering
Currently the `InstanceGet` node result type for for
`Completer<bool>.future` is `Future<bool> Function()`, but it should be
`Future<bool>`.

This causes problems in CL 301020 where we generate temporaries for
nested `await` expressions and use the expression type for the types of
those temporaries. Incorrect expression type in `completer.future`
causes a temporary with incorrect type to be generated.

Change-Id: Ib8193c66afee9454a275c00fb958c11fd35cd3eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301382
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-05-04 19:15:28 +00:00
Alexander Markov c1f9930f5b [vm] Restore InstanceKind.TypeRef in the VM-service API for backwards compatibility
TEST=doc/comment change
Change-Id: I0fcb9d418a9c95e6ce57a03eb693aefb9e245d2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301501
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-05-04 18:04:13 +00:00
Konstantin Shcheglov 193316584f Issue 52255. Avoid crashing in AddExplicitCast when the expression is not real.
Bug: https://github.com/dart-lang/sdk/issues/52255
Change-Id: I7ae2fd183cbd73b9d9bb4e5c4dc13e1c0c0ef062
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301201
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-04 16:19:29 +00:00
Srujan Gaddam ceca7aae56 [pkg:js] Update min sdk version to 3.1.0-66.0.dev
This is the minimum version with this CL:
https://github.com/dart-lang/sdk/commit/c4d354dc2a514fa3af6929a3513a9d7fa4fe8206.
Since this CL removes package:js annotations and redefines the meaning
of dart:_js_annotations @JS annotation, we need to make sure new
versions of the package don't run with old versions of the SDK.

Change-Id: Id8af568fc5b65737c6dd69359e51abae8cc43e9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301280
Commit-Queue: Joshua Litt <joshualitt@google.com>
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-05-04 15:56:41 +00:00
Jens Johansen adb38d2eca [CFE] Create maps in scopes lazily
When compiling `compile.dart` 74054 non-const scopes are created;
~78% have empty locals and ~99% have empty setters.
This CL creates the maps lazily instead, thus potentially saving ~130k
map creations (and possibly an unknown number of lookups in empty maps
etc).

In measurements (on AOT when compiling `compile.dart`) this has resulted
in changes in runtime ranging from -1.81601% +/- 1.39701% to
-4.60653% +/- 1.68463%, the latest run gave this:

Difference at 95.0% confidence
        -0.151 +/- 0.0557737
        -3.90231% +/- 1.44137%
        (Student's t, pooled s = 0.0871402)

Change-Id: Ic65eeca253dccb871585c221798b59852de80616
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301064
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2023-05-04 12:35:27 +00:00
Johnni Winther d07d8f59fc [cfe] Support inline class constructor tear-off
Closes #52240

Change-Id: If3474b85f1ebcdd5d0f4e68eafd4f706b7fd38fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301386
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-05-04 12:33:58 +00:00
Johnni Winther 0c7281fee0 [cfe] Remove SourceLibraryBuilder.inferredTypes
Change-Id: Ide19449f113f3b18e1685c7de6ee0239fe67c715
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301383
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-05-04 12:14:20 +00:00
Johnni Winther 52df013834 [cfe] Move BodyBuilderContext implementation into subclasses
This moves the implementation of BodyBuilderContext into the subclasses
where the methods are supported. Additionally a
BodyBuilderDeclarationContext for the implementation based on the
(enclosing) declaration/class builder.

Change-Id: I5084e87ae0c0882db94e4021971d86f8a149daa4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301360
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-05-04 10:17:49 +00:00
Jens Johansen c0c9c98787 [flow analysis] Don't create a new empty map for every FlowModel
Currently every FlowModel creates a new empty map that's just supposed
to be empty. When compiling `compile.dart` (from the CFE) this creates
more than 200,000 maps for seemingly no reason.

This CL removes it, thus saving the creation of (...instrumenting the
platform...) 229,472 maps when compiling `compile.dart` (from the CFE).

Thinking it was done to avoid some polymorphism I have gone over the
created flowgraphs for the file in both JIT and AOT and found only
improvements.

AOT compiled `compile.dart` then compiling itself improves by ~3.5%:

```
Difference at 95.0% confidence
        -0.1365 +/- 0.0576111
        -3.55191% +/- 1.49912%
        (Student's t, pooled s = 0.090011)
```

Change-Id: Ifdbb57e9aa3c23b2af512a2104aaf6caf72831ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301061
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2023-05-04 06:25:28 +00:00
Johnni Winther 8ea8160cd8 [cfe] Create *BodyBuilderContext at root
This adds individual [BodyBuilderContext] classes for the different
contexts and passes these at the root of the BodyBuilder creation.
Currently these are simple subtypes [BodyBuilderContext] but the plan
is to move implementation into the subclasses where the functionality
is actually supported.

Change-Id: I8ea22c5f563d9fa539cbd17ed02c919647a1aecd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301000
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-05-04 06:22:21 +00:00
Konstantin Shcheglov b06b994a4e Use errorType for element type when an error in for-in.
Change-Id: I8be4c1521a819f26d249d688f72dc672ee4994fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/300561
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-03 21:17:08 +00:00