Moving this enum to its own file breaks a dependency of the element
maps on SSA.
Change-Id: If66d1ddf0af6ccdc5380b4f65d5e447e3cebd8de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248081
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This CL remove the support for mixing in classes that don't extend
Object. An error has been report by the analyzer for some time and
now also by the CFE.
This puts the breaking change https://github.com/dart-lang/sdk/issues/48167 into effect.
TEST=pkg/front_end/testcases/general/issue48167.dart
Change-Id: Ia7715a27dc1aa18a7c85b24ed86d19a91b6924d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247551
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Let me know if there are other parameters that we should collect
information about. I thought about open/close, to correspond to the
number of priority files tracked for the legacy protocol, but I thought
it would be too noisy. Happy to discuss if you think otherwise.
Change-Id: Id1b8bc043052570c706dc19ea31c33c2b19177ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247480
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This adds a _MapLiteralEntryOffsets class used to collect information
during map entry inferences instead of passing it through fields
on the visitor itself.
Change-Id: Id575bc56b8fce707fb038a695bfe347ca4d6432d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247964
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
I would like to remove releaseAndClearRemovedIds(), so that methods
of FileResolver call it when necessary, as linkLibraries2(),
dispose() do it.
Change-Id: I494abaffa7a5b8a8360c2750efb5b88b4b5535e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247926
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
This is a re-land of https://dart-review.googlesource.com/c/sdk/+/247601 with some additional changes to allow for certain null uris in some previously migrated package:front_end code.
Note that nulls were flowing through these apis already, this just acknowledges that fact :).
Bug: https://github.com/dart-lang/sdk/issues/49212
Change-Id: I4528bfdec1bc9114715afd3fea06d1249054d2a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247765
Commit-Queue: Jake Macdonald <jakemac@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
From Dart language specification (17.15 Function Invocation):
If execution of the body returns an object, o is completed with that
object. If it completes normally or returns without an object,
o is completed with the null object (17.4), and if it throws
an exception e and stack trace t, o is completed with the error e and
stack trace t. If execution of the body throws before the body suspends
the first time, completion of o happens at some future time after the
invocation has returned. The caller needs time to set up error handling
for the returned future, so the future is not completed with
an error before it has been returned.
So far, implementation of async functions in Dart VM postponed
completion of the Future both with the value and with an error
if execution has not reached the first await. This change modifies
the behavior to compile future with value immediately even if
the first await was not reached. Completion with an error is still
postponed.
This change in behavior will let us improve performance of
async/await in certain cases.
The new behavior still conforms to the Dart language specification.
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: I0e80a1d0dd0c3cd6acbc640681e7b06bbf81c19c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243101
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This option was enabled by default in https://dart-review.googlesource.com/c/sdk/+/149288
This change removes old logic behind --no-lazy-async-stacks
and makes --lazy-async-stacks/--no-lazy-async-stacks options no-op.
TEST=ci
Change-Id: I5726690e90e78dd2ac37d8c5944e388042fc3acf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247780
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Also makes table type explicit and fixes a bug in element serialization
for tables beyond index 0.
Change-Id: I7c27071e00331c41010da771ae0075e798e457a9
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247545
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
This reverts commit 3b111d5e0d.
Reason for revert: Wrong design, will rework.
Original change's description:
> Add AnalysisDriver.contextRoot, deprecate configure().
>
> In the future AnalysisDriver.analysisContext will be removed, and
> AnalysisDriver will implement AnalysisContext. At the same time we
> will remove DriverBasedAnalysisContext.
>
> Google3 looks green.
> https://fusion2.corp.google.com/presubmit/tap/453818030
>
> Change-Id: Iaa6bf85e27c3be5d0ecb40126d6b857fe6f2aa64
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247626
> Reviewed-by: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
TBR=scheglov@google.com,brianwilkerson@google.com,srawlins@google.com
Change-Id: I2eb567c6343636d3affd48bb4bfb0b4b1aa788b6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247861
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
This reverts commit 5875a9ba9d.
Reason for revert: We seem to have some cbuild failures, logs can be found here 5875a9ba9d
Original change's description:
> Avoid computing the URI scanner tables at runtime.
>
> Precompute the table and store it as a String literal.
>
> Fixes#49108.
>
> Bug: https://dartbug.com/49108
> Change-Id: I33d3e768ad2013ad2edec3558fcd3da39b3f4f32
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247383
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>
> Auto-Submit: Lasse Nielsen <lrn@google.com>
TBR=lrn@google.com,vegorov@google.com,kustermann@google.com
Change-Id: I3c2609aad7944ea9118af14733c3e99db9902297
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://dartbug.com/49108
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247860
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
This small change brings the modular test closer to the behavior we have
internally in our bazel rules.
Turns out that recently we discovered a bug in the static erasure
transformation when emitting the full dill generated by DDC. This change
will allow us to detect these kind of failures in our SDK repo as well.
Change-Id: I9032d2563f741692ae03035b9fc9be59ab4b3a38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247761
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
C compilers don't enforce nesting rules. `dart:ffi` was enforcing these
rules causing issues for binding to C libraries having looser packing
for nested structs than outer structs.
This CL completely removes the error from the analyzer and CFE.
(As an alternative we could have kept a hint/lint, but this might create
more noise than value.)
TEST=pkg/analyzer/test/src/diagnostics/packed_nesting_non_packed_test.dart
Closes: https://github.com/dart-lang/sdk/issues/46644
Change-Id: Iae2d5c885546f7799bc6dea2f8cd7dd508216a0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247382
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
AOT compiler can remove pragma class from ObjectStore.
This change fixes Library::FindPragma to handle this situation.
TEST=service_2/pause_on_unhandled_exceptions_catcherror_test
Change-Id: I5f58ebcb0f1e3b1c2e658ad19bfdea4c72577a7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247763
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
In the future AnalysisDriver.analysisContext will be removed, and
AnalysisDriver will implement AnalysisContext. At the same time we
will remove DriverBasedAnalysisContext.
Google3 looks green.
https://fusion2.corp.google.com/presubmit/tap/453818030
Change-Id: Iaa6bf85e27c3be5d0ecb40126d6b857fe6f2aa64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247626
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reduces the number of libraries that must be migrated to null safety
atomically.
Change-Id: I498f2956471be0435558c1b1a4badcba619f15de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247521
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This reverts commit 69f32d6ad7.
Reason for revert: We seem to have a number of tests failing with timeouts in CBUILD after this change, please see logs at
69f32d6ad7
Original change's description:
> Refactor `_Future`.
>
> This is a major rewrite of the `_Future` class,
> which is the default implementation of the `Future` interface.
>
> The main goal was to reduce the number of expensive type checks
> in the internal passing around of data.
> Expensive type checks are things like
> * `is _Future<T>` (more expensive than just `is _Future`, the latter
> can be a single class-ID check.
> * Covariant generic parameter checks (using `T` covariantly in a
> parameter forces a run-time type check).
>
> Also removed some plain unnecessary casts and turned some
> implicit casts from `dynamic` into `unsafeCast`s.
>
> This seems to be an success, at least on very primitive benchmarks, according to Golem:
> FutureCatchErrorTest 41.22% (1.9 noise)
> FutureValueTest 46.51% (2.8 noise)
> EmptyFutureTest 59.15% (3.1 noise)
> FutureWhenCompleteTest 51.10% (3.2 noise)
>
> A secondary goal was to clean up a very old and messy class,
> and make it clearer for other `dart:async` how to interact
> with the future.
>
> The change has a memory cost: The `_FutureListener<S,T>` class,
> which represents a `then`, `catchError` or `whenComplete`
> call on a `_Future`, now contains a reference to its source future,
> the one which provides the inputs to the callbacks,
> as well as the result future returned by the call.
> That's one extra memory slot per listener.
>
> In return, the `_FutureListener` now does not need to
> get its source future as an argument, which needs a covariant
> generic type check, and the methods of `_Future` can be written
> in a way which ignores the type parameters of both `_Future`
> and `_FutureListener`, which reduces complex type checks
> significantly.
>
> In general, typed code is in `_FutureListener`, which knows both
> the source and target types of the listener callbacks, and which
> contains the futures already at that type, so no extra type checking
> is needed.
> The `_Future` class is mostly untyped, except for its "public"
> API, called by other classes, which checks inputs,
> and code interacting with non-native futures.
> Invariants ensure that only correctly typed values
> are stored in the untyped shared `_resultOrListeners` field
> on `_Future`, as determined by its `_state` integer.
> (This was already partially true, and has simply been made
> more consistent.)
>
> Further, we now throw an error in a situation that was previously
> unhandled: When a `_Future` is completed with *itself*.
> That would ensure that the future would never complete
> (it waits for itself to complete before it can complete),
> and may potentially have caused weird loops in the representation.
> In practice, it probably never happens. Now it makes the error
> fail with an error.
> Currently a private `_FutureCyclicDependencyError` which presents
> as an `UnsupportedError`.
> That avoids code like
> ```dart
> import "dart:async";
> void main() {
> var c = Completer();
> c.complete(c.future); // bad.
> print("well!");
> var d = Completer();
> d.complete(c.future);
> print("shucks!");
> }
> ```
> from hanging the runtime by busily searching for the end of a cycle.
>
> See https://github.com/dart-lang/sdk/issues/48225
> Fixes#48225
>
> TEST= refactoring covered by existing tests, few new tests.
>
> Change-Id: Id9fc5af5fe011deb0af3e1e8a4ea3a91799f9da4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244241
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>
TBR=lrn@google.com,kustermann@google.com,sra@google.com,sigmund@google.com,nshahan@google.com
Change-Id: I455be5a04b4c346df26d4ded0fa7388baccb0f8c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247762
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
This adds the capability to trigger inference through
TypeBuilder.build when it is passed a ClassHierarchyBase object.
TypeBuilder.isExplicit is added to signal when a type can be built
without the need for inference. NamedTypedBuilder and
FunctionTypeBuilder are split into _Explicit* and _Inferred* subtype
the latter of which support late building of the type.
The new _Inferred* builders are not used yet.
Change-Id: I66fd669ae47e6eb3079461af31477215c262dcbb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247220
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>