Also should cache on `serializedId` rather than just the `name`.
Change-Id: I16e095fea5f320d39d55374ce354b9302c3a1e75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346024
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Fixes the for loop lowering to JavaScript when there are function
expressions in the loop initialization, condition, or updates.
Manually assign source mapping information on js_ast nodes to
make stepping in the Dart debugger make as much sense as possible.
With these mappings three steps are required on each loop variable
on each iteration but it ensures that the mapping always points to the
variable instead of some random line of code in or around the original
for loop.
Fixes the failure on language/loop/for_variable_capture_test.
Issue: https://github.com/dart-lang/language/issues/3539
Change-Id: I755b88faef11804986fb3d1b2c328da3dd08fe8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345145
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
In https://dart-review.googlesource.com/c/sdk/+/345082, type erasure
was added to the handling of relational patterns, to address some co19
failures, e.g.:
extension type const BoolET1(bool _) {}
const True1 = BoolET1(true);
String testStatement1(bool b) {
switch (b) {
case == True1:
...
}
}
This was failing because the type of `True1` (`BoolET1`) is not
assignable to the argument type of `operator==`, which is
`Object`. (This is because extension types do not, by default, extend
`Object`; they extend `Object?`).
Adding type erasure elimited the co19 failure, but it caused other
code to be allowed that shouldn't be allowed, such as:
extension type const E(int representation) implements Object {}
class A {
bool operator <(int other) => ...;
}
const E0 = E(0);
test(A a) {
if (a case < E0) ...;
}
This shouldn't be allowed because the type expected by `A.<` is `int`;
allowing `E0` to be passed to this operator breaks extension type
encapsulation.
The correct fix is for assignability checks for `operator==` to use
`S?` rather than `S`, where `S` is the argument type of
`operator==`. This is consistent with the patterns specification, and
it ensures that `== null` and `!= null` are allowed, while continuing
to prohibit relational patterns that break extension type
encapsulation.
Fixes https://github.com/dart-lang/sdk/issues/54594.
Bug: https://github.com/dart-lang/sdk/issues/54594.
Change-Id: Id090f432500d75ba694383f1788d58353cd1fc72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345860
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
It also handles imports a little better than it used to: it will replace an import that has the same URI and prefix with an updated one with appropriate show and hide combinators.
Bug: https://github.com/dart-lang/sdk/issues/54496
Change-Id: Ib53275f2d58c19085fe02cb83267c8dc0c23838b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344940
Commit-Queue: Greg Spencer <gspencer@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Greg Spencer <gspencer@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Improves binary -> json conversion from >900s to ~52s for a large program.
This change contains 2 major fixes:
1) Make element name deduping be O(1) rather than O(n) by using a hash map. I didn't calculate how many duplicated names there were but this change improved the runtime of the conversion process by ~10x.
2) Use chunked string writing for the json encoding/file writing process. By doing chunked conversion with buffered writes we avoid having the entire JSON blob in memory and fewer midsized write operations end up being faster. Without this the program took ~87s for the same large program.
Change-Id: I2d3cddbbb96895b68086fce2256937d567beff11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345940
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Before this change, the analyzer supported analyzing legacy code if
the (somewhat confusingly named) global variable `noSoundNullSafety`
was set to `false`. This was used to support legacy code while google3
was still migrating to null safety.
Now that the internal migration process is complete, the analyzer no
longer needs to support legacy code. As a first step in removing that
support, this change removes the `noSoundNullSafety` flag and all the
unit tests that made use of it.
From this point forward it will not be possible to use the analyzer to
analyze code that has a Dart language version less than 2.12.
Change-Id: Idce4b271d1cfc43d25251b7a899259d62b421caf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345365
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
The assert, which is only triggered if we need to generate
calls to the _nativeGetX/_nativeSetX methods, should be checking for
no error, not that there is an error.
TEST=vm-aot-linux-debug-simriscv64 builds
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-simriscv64-try
Change-Id: Ie360a067a6432503fa82ca7eb3d5f9281e0579f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346041
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Previously, they were implemented as native methods with special
replacements in the inliner.
Instead, create force-compiled versions of the original inliner
replacements and use those instead of native methods, unless the
flow graph compiler doesn't support unboxing the requested element type.
In that case, the force-compiled version just calls a native method,
and we only keep the native methods that might be needed (that is,
for double/SIMD element access).
Also, revert the change in 26911a6176, since now the _getX/_setX
methods are appropriately inlined instead of failing to inline due
to being native methods.
TEST=vm/dart/typed_list_index_checkbound_il_test
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-linux-debug-x64-try,vm-aot-linux-release-simarm_x64-try,vm-linux-release-simarm-try,vm-ffi-qemu-linux-release-arm-try
Change-Id: I4840883d1fc12b36a450803da339406bec149044
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330786
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Both `sizeOf` and `AllocatorAlloc.call` use the new type as bound.
This prevents runtime errors on trying to call these two static
methods with unsized native types. All tests testing for these runtime
errors have been deleted.
The `NativeTypes` implementing `SizedNativeType` are as follows:
* The native integer types, `Float`, and `Double`.
* `AbiSpecificInteger` and it's subtypes.
* `Struct` and `Union` and their subtypes. The
The `NativeTypes` not implementing `SizedNativeType` are as follows:
* `Void` has no size.
* `Opaque` and subtypes have unknown size.
* `Handle` is considered opaque. Cannot be used as field in compounds.
* `Array` does not carry a size in its type. Can be used as fields in
compounds with an annotation specifying the size.
* `NativeFunction` is considered opaque. Would have variable size.
* `VarArgs` is only a marker in function signatures.
`Struct`s and `Union`s can have only `SizedNativeType`s and `Array`s
as fields. Documentation for these is in flux in another CL, so we
should update it there.
This CL also replaces a bunch of `extends NativeType` with
`implements` clauses and made `NativeType` itself `abstract`.
TEST=Dart SDK build
TEST=ffi test suite
Bug: https://github.com/dart-lang/sdk/issues/54542
CoreLibraryReviewExempt: VM and dart2wasm feature only.
Change-Id: Ib4f6b58f7204bd063ace20133162798d8c9483e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345221
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
When landing https://dart-review.googlesource.com/c/sdk/+/342400
the ddc-mac builder (but not Linux and Windows) started failing.
I could reproduce on Linux though so I'm not sure why those builders
didn't fail (nor why it wasn't caught by the try bot), either way this
fixes the issues:
* Test update: E.g. a breakpoint at the end of the scope doesn't work
because it will not be inside the (wanted) scope.
* Test update: Evalating "this" now actually works.
* Scope finding update: DDC adds sourcemapping entries for the *end* of
things so e.g. the getter "c" will have offset and offset+1 added as
source mappings. When translating from javascript position to dart
position we might pick that and thus ask for the scope of offset+1,
but nothing will be found because no node has that offset.
Here I add a fall-back saying that if we get no results we ask again
for the nearest lower offset.
Change-Id: I7e4430d9954466494b514cf51d999358483c9f8c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345501
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
After lengthy consideration, I believe that this is the best policy for
the team overall. It also corresponds to what I thought we had already
agreed to in the past.
Change-Id: I952297bf966ace0bdb105a5e4539420c3c6b8983
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345748
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Replaces all uses with the equivalent `TYPE_REF()` and
`LEGACY_TYPE_REF()` because they are used in the shared dart:_rti
library and there is no need to support both.
Change-Id: I8c04eb12856cf6933a168f3e63351a45cd5d704e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344608
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Replaces all uses with the equivalent `JS_GET_FLAG` because it is
used in the shared dart:_rti library and there is no need to support
both.
Change-Id: I4e347d568444caab63e4217845c14353c429cb10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344607
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
I/O can take arbitrarily long, and open interior pointers prevent all other isolates in the group to reaching safepoints.
TEST=ci
Bug: https://github.com/flutter/flutter/issues/140763
Change-Id: I1fa732d0db31500946aee232dc31f5baf324a55e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345746
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
On WSL 1 trying to allocate memory close to the binary
by supplying a hint fails with ENOMEM for unclear reason.
Some reports suggest that this might be related to the
alignment of the hint but aligning it by 64Kb does not
make the issue go away in our experiments. Instead
just retry without any hint.
Fixes https://github.com/dart-lang/sdk/issues/54587
TEST=manually under WSL 1
Change-Id: I0adf997fbf76e470a57da00f5ce7a26bb50706f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345802
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
ffx will change the way product lookup prints out the download url,
but the original solution is less ideal and using json is definitely
better.
So using the latest test-scripts would be a must-have before updating
the fuchsia-sdk.
A drive-by change is to return proc.returncode from with_envs.py.
Change-Id: Ic4589597006226aa7f5b0e557fe1f084ad3a0a74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345567
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Zijie He <zijiehe@google.com>
This reverts commit 89bd370e95.
Reason for revert: causes Flutter roll issues.
Apparently https://github.com/dart-lang/sdk/issues/54577 is more serious.
Original change's description:
> AnalysisDriver. Produce results for all files of a library.
>
> Change-Id: I0118ccdbd4a9059eb3809cb3b6a694731621d809
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345363
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Change-Id: I9d7b98fa18a7d19853b03aeec7094f7769bc13f0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345780
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Change-Id: Ie4c3413191c14976f85614fab11ee94830a25aab
CoreLibraryReviewExempt: documentation only change in the web libraries
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345566
Auto-Submit: Devon Carew <devoncarew@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
A few test cases had to be dropped because the stronger type system of
null safe Dart would have caused them to be compile-time errors.
Change-Id: I645309c624217ea924d7c24876137e6f8c402a98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345581
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
This updates the error reporting on incorrectly applied macro
application to show if an unimplemented for syntax was the cause.
This is to help identify when macro tests fail due to missing
implementation.
The CL includes handling of simple list literals in macro
annotations, an issue brought up this kind of error.
Change-Id: I4b6f9f7140c7bc000cfec54acbc6bbfeaf3429a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345662
Reviewed-by: Morgan :) <davidmorgan@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Additional flags can be passed to the kernel compilation step via the
DART_VM_FLAGS environment variable, but there's no way to specify
additional flags to be passed to the gen_snapshot step. This CL changes
that by also passing the contents of the GEN_SNAPSHOT_FLAGS environment
variable to that step, so the tool can be invoked like:
DART_CONFIGURATION=ReleaseX64 \
GEN_SNAPSHOT_FLAGS="--redirect-isolate-log-to=tmp/graphs.log \
--print-flow-graph-optimized" \
pkg/vm/tool/precompiler2 ...
TEST=manual use
Change-Id: Iadc6a888c60ec306799885e49a39568b124a1c10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345660
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Previously the static type of the record literals was also used, which
is incorrect interpretation of the equality on records.
Closes https://github.com/dart-lang/sdk/issues/54491
Change-Id: I12fad33271e53279a3d9c8bcfd2a842ac31988a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344701
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
The CHANGELOG was missing information on the removal of
`pkg/analyzer/lib/src/generated/constant.dart` in this CL https://dart-review.googlesource.com/c/sdk/+/324342.
This CL adds that change to the change log.
Change-Id: Ib8e7276d033cbd89e8eff447d2d96826cc6c9a96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345349
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Closes https://github.com/dart-lang/sdk/pull/54562
GitOrigin-RevId: f3b2502c0124f287f3eccc021c5f1623839ae3d7
Change-Id: I6af749c16a5358e910bc883ef1ddfc65c30a0c3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345369
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
As discussed, the "context" prefix was confusing. I'm not sure "default" adds anything so I went with just `featureSet`.
Let me know what you think!
Change-Id: I3e7ca7ac86c3ab7d96f4d4eee34d58904403d2fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345600
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
- Rename some compile time errors tests to end with "error_test.dart"
- Delete runtime tests that no longer perform the operations they
claim to be testing. In many cases they do nothing at all.
Change-Id: I49c7b50d6628f56641b878635b32dbc0bc016bbb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345345
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>