Fixes https://github.com/dart-lang/sdk/issues/54801
Object literal constructors need to be explicitly handled when
determining a member is JS interop or not in dart2js as it does
not require any @JS annotations.
Change-Id: Iee99375439057844485aa3f5cd88f85f5d03ae06
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349840
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Previously we would specify parameter offset and base register and
use SpecialParameter instruction to represent values passed in
registers.
This CL simplifies and merges these concepts: now every Parameter
instruction simply carries around its Location.
This CL also tweaks printing of stack slot locations so that they
are easier to read: `S+1` becomes `fp[1]` or `sp[1]` depending on the
base register, DS+1 becomes `dword fp[1]` / `dword sp[1]` and `QS+1`
expands to `qword fp[1]`/`qword sp[1]`.
Additionally we clean `BlockBuilder` API a bit - instead of
passing `with_frame` to `AddParameter` we make this the
property of the builder itself, set at construction time.
Issue https://github.com/dart-lang/sdk/issues/54955
Closes https://github.com/dart-lang/sdk/issues/31956
TEST=ci
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-release-arm64-try,vm-aot-linux-release-simarm_x64-try,vm-ffi-qemu-linux-release-arm-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-linux-product-x64-try,vm-aot-mac-release-x64-try
Change-Id: Ie24dc6b6c47b3a45db722813218bc53c3a06c91d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353081
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
This CL contains several small bug fixes:
- The context is only used for type inference if it is a record type
with the same shape as the record literal. Previously, if the
context was a record type with a different shape than the record
literal, the analyzer would attempt to do an approximate match
(using the context from any matching named fields, and from all the
positional fields that were in common between the context and the
literal). At first glance, it might seem like this would only matter
for erroneous code (since record shape mismatches typically lead to
compile-time errors). But if the context arises from a local
variable promotion, then a mismatch doesn't lead to a compile-time
error; it simply leads to a demotion. So the difference is
observable for non-erroneous code.
- If one of the fields is implicitly downcast from `dynamic`, the
static type of the field's expression remains `dynamic`. This makes
the behavior of dynamic downcasts inside field literals consistent
with all other implicit dynamic downcasts.
- If one of the fields is implicitly downcast from `dynamic`, the
downcast is made to the greatest closure of the context. Previously,
the downcast was made to the context itself, which meant that it was
possible to create static types containing the unknown type,
violating one of the key assumptions of the Dart type system.
- If one of the fields has a static type of `dynamic`, and `dynamic`
is a subtype of the greatest closure of the context (e.g. because
the context is `Object?`), no dynamic downcast is
performed. Previously, a dynamic downcast _was_ performed, meaning
that the static type of the resulting record literal would have
`dynamic` in a spot where `Object?` should be.
This brings the analyzer behavior into line with the spec and the
front end, with one minor exception:
- When the front end uses the greatest closure of the context to
implicitly downcast a field from dynamic, it uses a modified
greatest closure algorithm where covariant instances of `_` are
replaced with `dynamic` instead of `Object?`.
The front end's behavior in this rare case doesn't agree with the
spec; I'll address this in a future CL.
Change-Id: Ib1ab7ee4d0f63a152480704e2c0d5332446a613c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350983
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
NOTE: the tests view better if you turn off whitespaces on the diff.
This command will start a DTD instance that has the FileSystem service restrictions disabled. Which can be used in development environments.
Bug: https://github.com/dart-lang/sdk/issues/54762
Change-Id: I829f83d7c7afc7dd83732fc8a600cb41ffe36f63
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352921
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Commit-Queue: Dan Chevalier <danchevalier@google.com>
This was an apparently error when moving to the SDK DAPs. The original DAPs performed 100 toStrings() (and 100 is the batch size for VS Code, so the user wouldn't usually see the limit) but we'd done 10 (actually 11) here.
Fixes https://github.com/Dart-Code/Dart-Code/issues/4995
Change-Id: Ie3ca74c9189a725adb971646db2defaf1ffa9627
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353104
Reviewed-by: Helin Shiah <helinx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Fix vm service tests which are racy as dds is spawned as an external
process and the testee process might have exited before dds
connects to it.
Change-Id: I514e20c84c6041cb1b65854494698911a34eb50e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352464
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
The analyzer team has decided to adopt the convention of using `TODO`
comments to document long term issues that should persist in the
codebase, and `FIXME` comments to document short term issues that need
immediate attention (see
https://dart-review.googlesource.com/c/sdk/+/295662). They may even
consider adding a presubmit hook to ensure that `FIXME` comments are
only used during local development.
We didn't consider `HACK` comments at the time, but IMHO it makes
sense to treat them the same as `FIXME` comments; that is, as a rule
we don't include them in checked in code.
This change restores the analysis server to a state of having a clean
"problems" view when edited using Visual Studio code.
Change-Id: Icd6079cb1eb47e02d9084332d0bad0e3afa04177
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353200
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This aligns this code better with Effective Dart and prepares for the
upcoming lint rule change at https://dart-review.googlesource.com/c/sdk/+/353140.
Change-Id: Ibfb4736ae01a6e2d843f9faf19eba08c16ff6c92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353222
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
PR https://github.com/dart-lang/language/pull/3560 and
https://github.com/dart-lang/language/pull/3598 updated the feature
specification of extension types to define a notion of types being
'incompatible with await'. This CL adds a test to verify that various
types are being classified correctly, and errors are hence reported
as expected for expressions of the form `await e`.
Change-Id: I39e992b4317ef49fbc2267819481d71d87b56aca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351143
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
This aligns this code better with Effective Dart and prepares for the
upcoming lint rule change at https://dart-review.googlesource.com/c/sdk/+/353140.
Change-Id: I96e77d5c49c17fe0dfcbef7e997cb9d634f1e648
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353201
Reviewed-by: Ömer Ağacan <omersa@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
This aligns this code better with Effective Dart and prepares for the
upcoming lint rule change at https://dart-review.googlesource.com/c/sdk/+/353140.
Change-Id: I1b3ff4a4f85ec2182d06a67acf0e43fbc45129f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353220
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Some tests that are run as part of the giant iso-stress test are relying
on `package:expect/config.config` getters, which in return rely on the
test configuration being set as part of the compilation from the app
=> We pass valid JIT & AOT configurations when compiling the giant iso
stress test files.
TEST=May fix the iso-stress failures.
Change-Id: Icacbfe941eb01030c010670f35848a76c9a8ee12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353102
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Based on abandoned change #264261.
Changes to that PR: compare and show file paths, improve part parsing, include analyzer expectations from other files as well as CFE expectations, update unit tests.
Add end to end tests. The simplest case "library_failure_test.dart" passes before this PR, all others require the change in this PR to pick up expectations in other files.
Change-Id: Ia71b78a8f0dced83f603309877132f261b47c5a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345541
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Morgan :) <davidmorgan@google.com>
Unused object, closure, context and record allocations can be always
eliminated, even when allocation sinking is disabled due to a
'try' block.
TearOff.Inlined.InTry benchmark +534-1481%
TEST=runtime/tests/vm/dart/eliminate_allocations_il_test.dart
Issue: https://github.com/dart-lang/sdk/issues/54808
Change-Id: I5a4094b391079fd0d63af48bec4594179806fdf5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350341
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
This reverts commit a8cf0a0825.
Reason for revert: The CL broke a few places in google3.
Original change's description:
> [analyzer][cfe] Expand TypeAnalyzerOperations. Part 1
>
> This CL adds more of the type operations required in the subtype
> constraint gathering algorithm into the shared type operation
> class. The added operations are used in the constraint gathering
> algorithms in the Analyzer and the CFE.
>
> Part of https://github.com/dart-lang/sdk/issues/54902
>
> Change-Id: Ia895fc84bd7ab666330a4ab32b6e759f0977e750
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346840
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Paul Berry <paulberry@google.com>
> Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Change-Id: Ibf75bb6dda4a4f5f36a2265036703977b28a4333
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353160
Auto-Submit: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
E.g. running
```
out/ReleaseX64/dart pkg/_fe_analyzer_shared/test/macros/executor/executor_test.dart
```
(which is apparently the wrong executable) fails after 12 minutes (!)
with "TimeoutException after 0:12:00.000000: Test timed out after 12
minutes."
With this instead it runs in a few seconds because the stuff that makes
it wait forever throws instead.
Change-Id: Idd8be08438863511769b4cace1a492d613cadb03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352301
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Fixes https://github.com/dart-lang/linter/issues/4457
In the previous code, we set a Scope on the SwitchStatement for the
first `memberGroup`, and then _overwrite_ that Scope for each
subsequent `memberGroup`. This manifests in
`ScopeResolverVisitor.getNodeNameScope` using a scope from one switch
member that does not know about the variables declared in the relevant
switch member.
Change-Id: Ic88a800db339712b83a66d4d647b20005b2b8305
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348900
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This adds support for generating the merged augmentation library in the
CFE. In order to get the right file offsets in the generated AST the
MacroExecutor.buildArgumentationLibrary function is extended to compute
a list of spans the describe what each segment of the generated source
code contains. These spans are used to compute the offset relation
between the intermediate augmentation libraries and the merged
augmentation libraries.
Change-Id: Ie5b9c23130da67ac874fb824b82827bfd6b88880
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349864
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
This adds a `forErrorHandling` to the `Throw` node. This is used that the `throw` is *not* present in the source code but added to ensure
correctness and/or soundness of the generated code.
This is used for instance in the lowering for handling duplicate writes
to a late final field or for pattern assignments that don't match.
In response to https://github.com/dart-lang/sdk/issues/53519
TEST=updated ast-to-text
Change-Id: Ie103829d98fda9cd7b64e9e3d893e77d1e86d7d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347900
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
This CL adds more of the type operations required in the subtype
constraint gathering algorithm into the shared type operation
class. The added operations are used in the constraint gathering
algorithms in the Analyzer and the CFE.
Part of https://github.com/dart-lang/sdk/issues/54902
Change-Id: Ia895fc84bd7ab666330a4ab32b6e759f0977e750
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346840
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
The type parameter was a left-over from a pre-nnbd encoding of the visitors, but Flutter dependency on the code prevented its removal.
TEST=existing
Change-Id: I02657a469290f169077faa1167cf59b75de13c9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350840
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
This code is no longer used now that the new runtime types are always
enabled.
Change-Id: I0c7d627199a10e023d5d1afa581812b360e9a0f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344609
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
There is a performance impact in:
`stdout.lineTerminator = "\r\n";`
For small writes (<100 chars), the performance loss is lost in the noise of the `write` system call.
For writes of ~500 chars, the performance is about half of that without line terminator translation. But, on a M2 Mac laptop, ~80M characters can be written per second.
Bug: https://github.com/dart-lang/sdk/issues/53161
Change-Id: Icfa0f981dcf6edb856d8aac5e0e270bc0148d498
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326761
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Fixes https://github.com/dart-lang/sdk/issues/54792
Added disclaimers to use dart:js_interop going forward instead
and linked to the documentation. Preps for publish.
Change-Id: I62bd65dd879e3569b8cc0d575701f412e63db7c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352964
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>