When a local variable is promoted to a record type, and then an
assignment statement is used to assign a record literal to that local
variable, if the fields of the new record literal are not assignable
to the fields of the promoted record type, that's not a problem; both
the analyzer and front end agree that the local variable is simply
demoted.
But the spec implies that if the old and new record _shapes_ are the
same, then a compile-time error will occur instead of a demotion. I've
created https://github.com/dart-lang/language/pull/3613 to bring the
spec in line with the implementations. This test demonstrates the
current behavior of the implementations, and makes sure that it
doesn't regress.
Change-Id: I0eacd7ca7f6579a35dbc34687113a2112418f368
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352462
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Prior to this CL, the CFE used a nullable type schema for null-aware
spread operators in list literals, but a non-nullable type schema for
null-aware spread operators in set and map literals. This was clearly
an oversight; a nullable type schema should be used for for null-aware
spread operators in all kinds of collection literals.
This change brings the CFE into alignment with the analyzer.
Fixes https://github.com/dart-lang/sdk/issues/54828.
Change-Id: I0d5aa128656c22211228f0dd35ccee40925b4ef0
Bug: https://github.com/dart-lang/sdk/issues/54828
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349921
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
This significantly speeds up certain operations as it avoids calling
complex closure equality logic in the hashmap operations.
See also [0] regarding us leaking those closures.
[0] https://github.com/dart-lang/sdk/issues/54908
Change-Id: I046063884b88fbe53bc3cb397b0087693c9b928a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352520
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This will be paired with a hotfix to land in google3. Updating the
DEPS to use the latest version of package:web will be done in a
future commit.
Change-Id: Ia09b34e14250c9b2c2586d1dc369e9ccbab8b331
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349960
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
- Reorganize conditional impacts/uses so that unused impacts only overwrite nodes that no other member condition is satisfying.
- Use `isMemberProcessed` instead of `isLiveInstanceMember` since some member conditions might be static members.
- Update deferred load algorithm to account for conditional uses.
Change-Id: I53ce6d283c5b79e0a7c9e7562fdcfe744e37bbc7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352180
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
This test appears to be timing out consistently in windows.
We split the test in two shards (sound vs unsound null safety)
as an attempt to address this issue.
Fixes https://github.com/dart-lang/sdk/issues/54894
Change-Id: I2230be95b1685ef1e5656eae2e740a94a0eeb320
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352049
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This is a reland of commit 244f8cee87
with fixes for the file URIs passed on the command line.
Original change's description:
> [ddc] Fix running d8 with test.py
>
> - Add build targets to compile .dill outlines for common test
> dependencies using kernel_worker.dart.
> - Build ddc modules for common test dependencies and move amd versions
> to a separate subdirectory.
>
> Change-Id: I126b5821f6aea00b753d83560c76f00c6c5edc61
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350081
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Nicholas Shahan <nshahan@google.com>
Change-Id: I5a77512984fda1d91c812f1e240e9c10609914f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351622
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
ZoneHandles out-live the HANDLESCOPE for class finalization, and can accumulate a lot of objects during FinalizeAllClasses.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/54886
Change-Id: Ia1330e0f27770c1a786a1b70e56881127cd936b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352052
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
- devtools server can now take the dtd uri as a parameter on startup
- dtdUri is passed to the server handler so that devtools can request it.
- FileService is implemented inside the Dart Tooling Daemon (dtd_impl)
- Added FileService.setProjectRoots
- Added unit tests and rpc exceptions
- on startup dtd now prints { uri, secret } so that the caller has the secret that allows them to call FileService.setProjectRoots
Fixes: https://github.com/dart-lang/sdk/issues/54790
Change-Id: I7a66aca2f8f06f6a611a46c727a9d5c2485fbe3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346922
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Dan Chevalier <danchevalier@google.com>
Previously, when taking a tear-off, a separate Context object was
allocated in order to capture receiver. Now, receiver is stored directly
in the Closure object in the 'context' field. This saves 1 object
allocation per tear-off and makes tear-offs cheaper compared to
explicit closures which can share context with other closures.
Benchmarks in AOT mode:
x64:
TearOff.NotInlined +40%
TearOff.NotInlined.InTry +43%
TearOff.Inlined.InTry +47%
arm64:
TearOff.NotInlined +27-43%
TearOff.NotInlined.InTry +29-43%
TearOff.Inlined.InTry +58-94%
arm64c:
TearOff.NotInlined +71%
TearOff.NotInlined.InTry +72%
TearOff.Inlined.InTry +96%
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/54808
Change-Id: I3ad95e8a8a4fc23f856bbc0fe238da58a9d25b8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350945
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This reverts commit 093271880a.
Reason for revert: Breaks some analyzer tests.
Original change's description:
> [macros] Tweak diagnostic for unexpected macro implementation exception.
>
> The only expected exceptions at this point are DiagnosticException and MacroException subtypes; everything else is a bug in the implementation.
>
> Tweak the diagnostic to explain that it's due to a bug in the macro. Add the exception message and stack trace as a context message, and a fix hint to contact the author.
>
> Add a language test.
>
> R=jakemac@google.com
>
> Change-Id: Ieaa6bedb3bc1646e4be61b384619152cc173b7e0
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351040
> Auto-Submit: Morgan :) <davidmorgan@google.com>
> Reviewed-by: Jens Johansen <jensj@google.com>
> Commit-Queue: Morgan :) <davidmorgan@google.com>
> Reviewed-by: Jake Macdonald <jakemac@google.com>
Change-Id: Ia64c112aad79fdcdd1f6e1a4b800616632107fc2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352260
Auto-Submit: Morgan :) <davidmorgan@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
The VM target no longer supports the `foo() native "foo";` syntax. See
final removal in [0].
Dart2Wasm has never really been using it.
* In the sdk dart2wasm uses `external` functions with
recognizion in the compiler based on the name of the method.
* JS interop is using `@JS` based mechanism.
* Wasm to Wasm interop is based on `@Native<>()` annotations.
This means that only dart2js/ddc are remaining users of the
`foo() native;` syntax (without following string).
So we can clean up some code.
[0] https://dart-review.googlesource.com/c/sdk/+/266387
Issue https://github.com/dart-lang/sdk/issues/28791
TEST=ci
Change-Id: I929789f7a1ea5ed5423b0db0c6a306406e2db2af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351083
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
The only expected exceptions at this point are DiagnosticException and MacroException subtypes; everything else is a bug in the implementation.
Tweak the diagnostic to explain that it's due to a bug in the macro. Add the exception message and stack trace as a context message, and a fix hint to contact the author.
Add a language test.
R=jakemac@google.com
Change-Id: Ieaa6bedb3bc1646e4be61b384619152cc173b7e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351040
Auto-Submit: Morgan :) <davidmorgan@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Morgan :) <davidmorgan@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
For instance before this CL one might just be told
```
1 failed:
lint/front_end/lib/src/fasta/type_inference/type_constraint_gatherer/ExplicitType: Fail
```
which isn't very actionable.
With this CL it will also print the error, giving something like
```
[...]/pkg/front_end/lib/src/fasta/type_inference/type_constraint_gatherer.dart:136:5: No explicit type.
var isMatch = _isNullabilityObliviousSubtypeMatch(subtype, supertype);
^^^
1 failed:
lint/front_end/lib/src/fasta/type_inference/type_constraint_gatherer/ExplicitType: Fail
```
which is actually actionable.
Change-Id: I1e906a899b14678ae4f8625da6dc32d295a32ec6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352223
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Change-Id: I261e5f08ad9af05d7c265948762c391314377d02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352105
Auto-Submit: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Jacob Richman <jacobr@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jacob Richman <jacobr@google.com>
Replaced a few local helpers with pre-existing global ones.
Change-Id: I40e2955ae353bf0ef7f21388b1f4b06bd08069a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352051
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
...and split long methods into smaller ones.
Change-Id: I7bdd5ea7851000ef0fd27735b90eed5199186e13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352101
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
The behavior in the "then" case (calling `dispatchExpression(element,
context?.elementType ?? operations.unknownType)`) was exactly the same
as the behavior of `ExpressionImpl.resolveElement`, so there's no need
for a special case at all; we can simply call `element.resolveElement`
and let virtual dispatch take care of the rest.
Change-Id: I32db32661375846bff5189c6dc95eb1496b34ce1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351801
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Previous attempt to use AST and builder was removed.
Also, after talk with Brian, removed scopes, and replaced with more
course grained, but simpler collision detection. If there is a declaration with the same name as prefixed, the name stays prefixed. Similarly, if there is an unprefixed invocation.
Change-Id: If2b0ce530ac81482e5bfd066d6df43e1a5d34799
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350683
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Closures cannot be declared native, so code which handles the
case of native function being closure function is dead.
TEST=ci
Change-Id: I47e124eecf4e778ad9fd3751a7b62459a032e800
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351560
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
1. Add '_' to libs that are not exported.
2. Remove references from src to root libs.
3. Remove not used code.
No code changes.
Change-Id: Ie344fb7e41decb0ebf6e50d59dc843fb04ca683b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350692
Commit-Queue: Polina Cherkasova <polinach@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>