Commit graph

86859 commits

Author SHA1 Message Date
Sigurd Meldgaard 2559aba219 Revert "Bump pub to ec35d46261b610e558dfd0d8525ca3fc8387b4b7"
This reverts commit 78636aaea9.

Reason for revert: This breaks the google3 roll. We need to roll frontend_server_client first.

Original change's description:
> Bump pub to ec35d46261b610e558dfd0d8525ca3fc8387b4b7
>
> Changes:
> ```
> > git log --format="%C(auto) %h %s" ac7db6c..ec35d46
>  https://dart.googlesource.com/pub.git/+/ec35d462 Fix null-safety warning in dart.dart (#3514)
>  https://dart.googlesource.com/pub.git/+/7d30cf0b Allow pubspec key 'funding' (#3529)
>  https://dart.googlesource.com/pub.git/+/8ff63a8e Fix remaining usages of path.prettyUri on git uris (#3524)
>  https://dart.googlesource.com/pub.git/+/bc32a30e Fix typo "exitcode" (#3511)
>
> ```
>
> Diff: https://dart.googlesource.com/pub.git/+/ac7db6c07318efa4a8712110275eaf70f96a6d00~..ec35d46261b610e558dfd0d8525ca3fc8387b4b7/
> Change-Id: I535f4fab8940ee8400ef75369d35fb4c1ee3adab
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255990
> Reviewed-by: Sarah Zakarias <zarah@google.com>
> Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>

TBR=sigurdm@google.com,zarah@google.com

Change-Id: I9f46b5a63f8c3f0b11a9fe1d348696b1f988e5ca
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256080
Reviewed-by: Sigurd Meldgaard <sigurdm@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
2022-08-23 09:58:30 +00:00
Sigurd Meldgaard 78636aaea9 Bump pub to ec35d46261b610e558dfd0d8525ca3fc8387b4b7
Changes:
```
> git log --format="%C(auto) %h %s" ac7db6c..ec35d46
 https://dart.googlesource.com/pub.git/+/ec35d462 Fix null-safety warning in dart.dart (#3514)
 https://dart.googlesource.com/pub.git/+/7d30cf0b Allow pubspec key 'funding' (#3529)
 https://dart.googlesource.com/pub.git/+/8ff63a8e Fix remaining usages of path.prettyUri on git uris (#3524)
 https://dart.googlesource.com/pub.git/+/bc32a30e Fix typo "exitcode" (#3511)

```

Diff: https://dart.googlesource.com/pub.git/+/ac7db6c07318efa4a8712110275eaf70f96a6d00~..ec35d46261b610e558dfd0d8525ca3fc8387b4b7/
Change-Id: I535f4fab8940ee8400ef75369d35fb4c1ee3adab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255990
Reviewed-by: Sarah Zakarias <zarah@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2022-08-23 08:44:09 +00:00
Alexander Thomas 560749e126 [infra] Upgrade checked-in SDKs to 2.18.0-271.7.beta
Change-Id: I8e7dc1d6241783d47c1e0b62fe039a7fef16ca44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256000
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2022-08-23 07:59:19 +00:00
Martin Kustermann 3669086a40 [vm] Fix field index information in heap snapshots in AOT
In AOT we can have unboxed fields that will not be visited by GC
visitors and as such are also not reported as <obj>.references when
producing heap snapshots.

Though the heapsnapshot's <class>.fields will contain entries
for unboxed fields, which causes the fields index calculation to be
incorrect.

This can cause various confusing things, e.g. incorrectly caluclated
retaining paths, since the <class>.fields.index doesn't match the
index in <obj>.references.

To fix this this CL will change the visiting code to emit dummy
references for unboxed fields.

The written test uncovered a few other issues:

  - report type_arguments and native_fields in <class>.fields
    => the visitors already visit those fields

  - fix `Class::next_{host,target}_field_offset` for classes
    with native fields
    => this will also shrink size of `NativeWrapperClass` subclasses

  - ensure classes with vm-defined layout are finalized
    => we assume objects should only exist in heap if their class
       is finalized

  - fix `FfiNativeFunction` type_argument offset

  - fixes for object fields list
    => add missing entries, fix existing entries

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

TEST=vm/dart{,_2}/heap_snapshot_regress_49711_test

Change-Id: I8e25680b2c0c8c49caafbb8da57b0b6419e89c4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255814
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-08-23 05:17:49 +00:00
Paul Berry b1130abfb2 Migration: make warnOnWeakCode flag non-nullable.
The migration of the migration tool was done hastily (because it was
not expected to need much more maintenance) so it contains a lot of
nullable fields that don't need to be nullable.  I've been cleaning
them up as I run across them in order to unblock other work.  This is
one such cleanup.

Bug: https://github.com/dart-lang/sdk/issues/49601
Change-Id: I68413e23f565bc9d38af3345d28059d734a3c689
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256021
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-08-23 00:55:50 +00:00
Paul Berry 2b06ac466d Flow analysis: rework some testing logic in preparation for pattern support.
- Variable types are no longer specified in the call to the `Var`
  constructor; they are now specified in the call to `declare`.  This
  paves the way for supporting variable pattern syntax, in which a
  single variable might appear in multiple variable patterns, and have
  its type specified in each pattern.  The properties `isFinal` and
  `isLate` are also moved to `declare` for consistency.

- Variables with inferred types are now specified by simply not
  including a type in `declare`; it's no longer necessary to specify
  `isImplicitlyTyped: true`.

- `declare` now supports an `expectInferredType` argument to allow the
  inferred type of an implicitly typed variable to be tested.

- The tests now check that variables are assigned a type before flow
  analysis requests it; previously this was not tested, and the flow
  analysis tests sometimes did things in the wrong order.  (The
  analyzer and CFE have always done this in the proper order though).

- The tests now support some of the crazy types that arise during type
  parameter promotion, e.g. they can now distinguish `(T&int)?` from
  `T&(int?)`.

- Flow analysis tests now properly replicate the analyzer and CFE
  behaviors for converting the static type of an initializer
  expression to the corresponding inferred variable type: (a) `Null`
  is converted to `dynamic`, and (b) type parameter promotions are
  dropped.

Note that this last behavior (dropping type parameter promotions) has
a lot of subtleties, and I'm not convinced the CFE and analyzer do it
soundly in all cases (I've already found one such soundness bug:
https://github.com/dart-lang/sdk/issues/49691).  In a later CL, I plan
to add a more thorough set of language tests to verify that we don't
have other lurking soundness issues.

Change-Id: I6f2cd20db1f07b34e0ad4e7002351c8de846b125
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255600
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-08-22 22:59:26 +00:00
Ryan Macnak fabbac4afd [vm] Fix -Werror=format-overflow when building with gcc.
TEST=ci
Change-Id: I9bb9d2658ab81322a07ee2892ddc9ac82332424e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256024
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-08-22 22:10:49 +00:00
Joshua Litt 8009c39d61 [dart2wasm] Implement dynamic naively.
Change-Id: I905a81faead20b4339309521018291d0b4d90dda
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250786
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-08-22 21:33:29 +00:00
Konstantin Shcheglov 7857a1a3b1 Use shared typeString() from StringTypes mixin.
Change-Id: Ic1a8a5ce9e9497a924754939cf6e6a1de98d16bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256022
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-08-22 21:09:05 +00:00
DEPS Autoroller 44b800d8f1 Roll Dart Protobuf Support from 9cf05f6e9f53 to 8337a7910fef (2 revisions)
https://dart.googlesource.com/protobuf/+log/9cf05f6e9f53..8337a7910fef

2022-08-22 omersa@google.com Rename _reportTruncatedMessage -> _throwTruncatedMessageError (#737)
2022-08-22 omersa@google.com Add GrpcServiceName annotation to gRPC classes (#733)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/dart-protobuf-dart-sdk
Please CC dart-ecosystem-gardener@grotations.appspotmail.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Dart Protobuf Support: https://github.com/dart-lang/protobuf/issues
To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Tbr: dart-ecosystem-gardener@grotations.appspotmail.com
Change-Id: Idc3d5a834fb6c9f08a73b11a4b1ac3b889001282
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255842
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2022-08-22 20:55:49 +00:00
Joshua Litt 1d6407fc3f [dart2wasm] Align semantics of jsify / dartify.
Change-Id: If4a5fc90093c35476a58e5f4755ef58ed9d9d889
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255766
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-08-22 19:54:29 +00:00
Joshua Litt 6052fe0ca2 [dart2wasm] Implement await / for as lowering.
Change-Id: Ic41f016490c993f27c3e5873ad1a4b3e8a902f13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255822
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-08-22 18:08:31 +00:00
Ryan Macnak ae57447189 [vm] Simplify creating ByteData from the embedding API.
TEST=ci
Change-Id: I0d5093c0eee6ab477e73a368179aba9a23d9600f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255817
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-22 17:50:45 +00:00
Kallen Tu 64c3ea27da Eliminate dynamic calls to remove and tagName.
Additionally, fixed the template for html_dart2js so the generator would generate the correct code.

Change-Id: I2172bb10db413169b86690faa027365ff72e3d68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255763
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-08-22 17:27:39 +00:00
Paul Berry b7567b1799 Flag additional code as unreachable due to types Null and Never.
Several unusual constructs that lead to unreachable code are now
recognized by flow analysis:

- Control flow after an expression of the form `e ?? other` or `e ??=
  other`, where `e` has static type `Null` and `other` has static type
  `Never`, is considered unreachable.

- Control flow predicated on an expression of the form `e is Never`
  evaluating to `true` is considered unreachable.

- Control flow predicated on an expression of the form `e is! Never`
  evaluating to `false` is considered unreachable.

- Control flow on the RHS of a null-aware access such as
  `e?.property...`, `e?.property = ...` or `e?.method(...)`, where `e`
  has static type `Null`, is considered unreachable (Note: this can
  arise in the presence of extension methods).

Previously, these behaviors only took effect if `e` was a reference to
a local variable.

Note: the change to `regress/issue_31180` is because I’ve corrected
the behavior of implicit temporary variables to not undergo a type
change from `Null` to `dynamic`, so the dead code part of `null?[1]`
is now erroneous.  (I had to make this change in order for the last
bullet above to work properly; without it, the type change to
`dynamic` prevents flow analysis from recognizing that the code to the
right of `?.` is unreachable.)  There's no behavioral change to
correct code, but I've captured the behavioral change to incorrect
code in
`tests/language_2/null_aware/null_aware_index_on_null_error_test.dart`.

Bug: https://github.com/dart-lang/sdk/issues/49635
Change-Id: I8b24b3b040a34f897c0b61dcb9bd105be6d0af6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251280
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-08-22 16:50:19 +00:00
Alexander Markov 8bd77bc510 [vm/aot/tfa] Tree-shake unused late final instance fields with initializer
Previously, tree shaker conservatively treated such fields as used if
constructor of the class was used.

Tree shaker would still keep late final instance fields without
initializer as it doesn't track how many times the field was
assigned/initialized and repeatitive assignment to a late final field
without initializer throws an exception.

TEST=pkg/vm/testcases/transformations/type_flow/transformer/write_only_field3_nnbd.dart

Change-Id: I859a4e864e2186e754ba4387a50d1ad9a901e6ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255542
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-08-22 16:24:19 +00:00
Alexander Markov 65b7d62bf1 [vm/aot/tfa] Cleanup obsolete handling of instance fields of enum classes
Enum index and name instance fields were moved to a base class (_Enum)
and tree shaker no longer needs to keep instance fields of enum classes.

TEST=ci

Change-Id: I2426a0bc37f11e51ca00aa24f981e4663d5fb358
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255543
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-08-22 16:20:59 +00:00
Gabriel Terwesten e2d6cb69fb Reland "[vm/compiler] Optimize switch statements"
This is a reland of commit f5228127f8

Original change's description:
> [vm/compiler] Optimize switch statements
>
> Switch statements that either contain only integers or only enum values of the same type can be optimized.
>
> Depending on the number of switch expressions and the number of holes that the range of switch expressions contains, either a binary search or a jump table is used.
>
> TEST=runtime/test/vm/dart{,_2}/optimized_switch
> TEST=tests/language{,_2}/switch
>
> Fixes: https://github.com/dart-lang/sdk/issues/49585
>
> Co-authored-by: Gabriel Terwesten gabriel@terwesten.net
>
> Change-Id: I62dcdb7843107f03de7e468c60b4db52ec78f676
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253787
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

TEST=runtime/test/vm/dart{,_2}/optimized_switch
TEST=tests/language{,_2}/switch

Change-Id: Ie96e5ff41dce33e2425ba9ad15ecd931d09bec6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255700
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-08-22 15:09:17 +00:00
Alexander Markov 5f985eb3e6 Reland "[vm/compiler] Initial implementation of IL binary serialization"
This is a reland of commit 9700458975

Original change's description:
> [vm/compiler] Initial implementation of IL binary serialization
>
> This change adds binary serialization/deserialization of flow graphs.
> It supports all IL instructions and certain objects which can be
> referenced from IL instructions. IL binary serialization is a useful
> machanism which would allow us to split compilation into multiple parts
> in order to parallelize AOT compilation.
>
> The program structure (libraries/classes/functions/fields) is not
> serialized. It is assumed that reader and writer use the same
> program structure.
>
> Caveats:
> * FFI callbacks are not supported yet.
> * Closure functions are not re-created when reading flow graph.
> * Flow graph should be in SSA form (unoptimized flow graphs are not
>   supported).
> * JIT mode is not supported (serializer currently assumes lazy
>   linking of native methods and empty ICData).
>
> In order to test IL serialization, --test_il_serialization VM option is
> added to serialize and deserialize flow graph before generating code.

TEST=vm/dart/splay_test now runs with --test_il_serialization.
TEST=Manual run of vm-kernel-precomp-linux-debug-x64-try with
--test_il_serialization enabled (only ffi tests failed).
TEST=gcc build on dart-sdk-linux-try bot.

Issue: https://github.com/dart-lang/sdk/issues/43299

> Change-Id: I7bbfd9e3a301e00c9cfbffa06b8f1f6c78a78470
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254941
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>

Change-Id: I64ff9747f761496a096371e490ef070a14023256
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255840
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-08-22 15:07:47 +00:00
Daco Harkes d099086c39 [cfe/ffi] FfiNative on getters/setters
Procedure names were used unconditionally to generate 'unique' fields.
But the names were equal for getters and setters. This CL adds a kind
postfix.

TEST=pkg/vm/testcases/transformations/ffi/ffinative.dart
TEST=pkg/vm/test/transformations/ffi_test.dart

Closes: 49770
Change-Id: I5c99da4ee50852bdfd67fc999a2b659d050a48f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255995
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-08-22 13:17:37 +00:00
Michael Thomsen 111dfc1844 Add readme for swarm
Bug: None
Change-Id: Ib5447eb038545a6b34f54201ad2e8d5a7e7ae5c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255991
Reviewed-by: Jonas Termansen <sortie@google.com>
2022-08-22 11:43:51 +00:00
William Hesse 321c4970ed Update CHANGELOG.md for 2.17.7 patch release
This is a patch release that:

- Fixes a crash in the debugger (issue [#49430][]).

[#49430]: https://github.com/dart-lang/sdk/issues/49430

Bug: https://github.com/dart-lang/sdk/issues/49430
Change-Id: I9b1e4f7422be502a08ab7f199effed3e799311ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255985
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2022-08-22 08:36:37 +00:00
Johnni Winther dcaebaa793 [cfe] Add Field.isEnumElement
This adds the flag `isEnumElement` to the `Field` node and uses it
to recognize enum elements for the exhaustiveness computation on
switch statements.

Closes #49697

TEST=pkg/front_end/testcases/general/issue49697/main.dart

Change-Id: I21852f3b063329e043639c825054f538c8ed6536
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255808
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2022-08-22 05:44:57 +00:00
Konstantin Shcheglov 490c03002b Add Record class to MockSdk, test with ConditionalExpression.
Change-Id: I49ae5de9b373b0a8582acc0cdcba67b3d8a26bc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255960
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-08-21 03:01:46 +00:00
Konstantin Shcheglov 6785c2deb7 Resolve RecordTypeAnnotation AST.
Change-Id: I5eac632ea3badf5dbce35fb842b17c9898bb02cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255818
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-08-20 02:43:35 +00:00
Konstantin Shcheglov b138d6b3ae Tests for parsing with trailing comma.
Change-Id: Ie4e10393f8c7840afcbe14d6d3d434a4b19ca507
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255900
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-08-20 02:29:45 +00:00
Konstantin Shcheglov 78f31f0ac5 Remove record nodes from AstTestFactory, parse instead.
Change-Id: I1872a2e41130ab3dc00a47f00c97656125414c42
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255883
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-08-19 22:50:35 +00:00
Brian Wilkerson c306096cd2 Remove the comma field from record type fields
Change-Id: Ia6c056b12f3a3fc191e208457c84ccaa85bb8194
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255882
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-08-19 21:50:25 +00:00
Konstantin Shcheglov 2bc155e6e7 Build RecordType(s) for RecordTypeAnnotation(s) in element model.
Change-Id: I4c42ffe10d2f51796d98d4901e04115fc3be6e83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255881
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-08-19 21:49:05 +00:00
Paul Berry 162091bd92 Migration: consider null-aware access an indication of nullability for parameters on public methods.
If a parameter of a public method is accessed using null-aware access
(`?.`), the migration tool now considers that to be an indication that
the parameter should be nullable.

Rationale: when migration doesn't have access to the entire code base,
the migration tool's approach of propagating nullability forward
through the program doesn't always work, because it's possible that
the sources of nulls are not visible to the migration tool.  This has
often resulted in the migration tool marking a function parameter as
non-nullable, in spite of the fact that the use of `?.` in the method
body makes it clear that it's intended to be nullable.

This new heuristic is only applied to public methods; for private
methods there's no chance of there being callers outside of the code
that's immediately visible to the migration tool, so the problem
doesn't arise.  For local functions and closures, the situation is
less clear-cut, but of the examples I've looked through so far in
Google's internal code base, it seems like more often than not, the
better behavior is to continue erring on the side of non-nullability.

Bug: https://github.com/dart-lang/sdk/issues/49601
Change-Id: I76531591ce0b3eb9fe62273130aa45eb4ff6d456
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253864
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-08-19 21:40:45 +00:00
Devon Carew 8b4e9c38a0 [deps] rev crypto, ffi, http, test, web_socket_channel, and webdev
Change-Id: I118b5147666a56d6048890f00702080b01d95d03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255880
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-08-19 21:34:45 +00:00
Brian Wilkerson 04535fa727 Add support to AstBuilder to build record type annotations
Change-Id: I621c15077a990b8f631d7861c7d4e54718809cdf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255824
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-08-19 20:55:55 +00:00
Konstantin Shcheglov e04a9e80ce Issue 49766. Fix memory leak with enum constants and Expando.
Instead of using Expando, we store this data in an object that
lives as long, as we need it to compute diagnostics.

Bug: https://github.com/dart-lang/sdk/issues/49766
Change-Id: I0c2a2e15f9e1ea92a415bae6e13bbbd373dc613b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255825
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-08-19 20:47:55 +00:00
Paul Berry e0cebd838e Flow analysis: handle promotable field accessed on a non-promotable field
A get of a promotable field on a non-promotable field shouldn't
promote, otherwise this code would be unsound:

    class C {
      D get _field1 => D();
    }
    class D {
      final int? _field2 = randomBool() ? 1 : null;
    }
    main() {
      var c = C();
      if (c._field1._field2 != null) {
        // Problem: `c._field1` returns a different `D` each time, so there's
        // no guarantee that `c._field1._field2` is non-null the second time we
        // access it!
        print(c._field1._field2.isEven);
      }
    }

This change has no user-visible effect because field promotion is not
yet enabled.

Bug: https://github.com/dart-lang/language/issues/2020
Change-Id: I9a60cd343dff14cded03df700d7c2b62a251487a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255821
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-08-19 19:38:05 +00:00
Ilya Yanok 4f504e4533 Revert "[deps] rev crypto, file, http, test, web_socket_channel, and webdev"
This reverts commit 0715df3d00.

Reason for revert: Could we please revert this temporarily? This breaks copies into G3 (b/243151015). Ivan will be back on Monday and hopefully we will fix it.

Original change's description:
> [deps] rev crypto, file, http, test, web_socket_channel, and webdev
>
> Change-Id: Icc92e4dce84183bac747375b644922845fe908a9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255767
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Commit-Queue: Devon Carew <devoncarew@google.com>

TBR=devoncarew@google.com,nbosch@google.com

Change-Id: I6b14d00ce3227995f8e285a559d8ba9968452961
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255860
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Ilya Yanok <yanok@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-08-19 19:31:55 +00:00
Paul Berry 39a8a19071 Flow analysis: Rework PromotionKeyStore using a single internal list.
A single internal list pointing to a simple data structure is easier
to reason about than a bunch of parallel lists, and it reduces the
performance cost if we have to add more data to the internal data
structure in the future.

Bug: https://github.com/dart-lang/language/issues/2020
Change-Id: I348cae86781c4d1f15520160a674df381fe2e38f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255815
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-08-19 18:20:15 +00:00
Ryan Macnak b3a569ea8d [vm] Prevent Dart_NewSendPort from bypassing the arbitrary object checks.
In particular this affects SendPorts from dart:io's IOService and Flutter's IsolateNameServer.

TEST=ci
Bug: https://github.com/flutter/flutter/issues/109248
Change-Id: I28ed3073a6fe5583729637ae7914d914edc709e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255261
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-08-19 18:10:15 +00:00
Srujan Gaddam 9f10a3bc16 [pkg:js] Add JsInteropChecks to Wasm backend
Also cleans up and unifies some behavior across the backends:

- avoiding reinstantiating JsInteropChecks for every library
- having the native classes as a member instead of recomputing on dart2js

Now that these checks exist, we can add lib/js/static_interop_test to
the test directories the wasm trybot runs.

Change-Id: I912aae988afe7915e80cc13d00b8c47818dfa520
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255760
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2022-08-19 17:48:38 +00:00
William Hesse 0872189d94 Enable general issue template
Add YAML metadata to the general issue creation template, so
it shows up in the list of issue creation options for users
on the GitHub issue creation page.

Change-Id: I72f546c1dfd407e41ad75e9abcf080cb5c9ea5ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255661
Reviewed-by: Kevin Chisholm <kevinjchisholm@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
2022-08-19 17:45:10 +00:00
Konstantin Shcheglov b7837289ad Add tokens leftParenthesis/rightParenthesis to RecordTypeAnnotation.
Change-Id: Ib2f45c2d46a709d6b0c2c67c641c1566c5b9503e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255823
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-19 17:28:52 +00:00
Devon Carew 0715df3d00 [deps] rev crypto, file, http, test, web_socket_channel, and webdev
Change-Id: Icc92e4dce84183bac747375b644922845fe908a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255767
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-08-19 17:10:45 +00:00
Nate Biggs 876fb36c82 [dart2js] Apply correct readers and lookups for deserializing cached entities.
Since we are reading data in the context of a different reader, we should make sure that we use that reader's helpers.

Change-Id: Id7fbf3662104d131c1b31bff080a171bd3d38a88
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255800
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-08-19 16:55:06 +00:00
Martin Kustermann d68ca2cc57 [vm] Avoid repeating fields in heapsnapshot class descriptions
Fixes https://github.com/dart-lang/sdk/issues/49710

TEST=tests/vm/dart{,_2}/heap_snapshot_regress_49710_test.dart

Change-Id: Ib2c31a582381dcfaf12739b9d0c7e28d98063791
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255813
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-08-19 16:51:45 +00:00
Brian Wilkerson 325e401bd2 Add visitor support for record type AST nodes
Change-Id: I81f158eac128cdabe7848d1111f67e41777a7f45
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255803
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-08-19 16:39:45 +00:00
Konstantin Shcheglov c020a09a68 Restore code in RecordLiteralTest.
Change-Id: I7391cdea3cb3fccaa536fc34677242d2cb2a19ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255806
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-08-19 16:26:05 +00:00
Johnni Winther 3efb70762e [cfe] Use signature type for super access in inference
This uses the `Procedure.signatureType` for checking super access
instead of the types derived from `Procedure.function`. This fixes
the checking of super access in face semi-stubs where the parameter
types have a more restrictive but covariant type.

Change-Id: I8b21238687bcec8e5e42a999c5a94d0e65cac28c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255660
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-08-19 10:52:45 +00:00
Jens Johansen 9c4725f3fa [CFE] Change test to fix weekly bot #104
The test used an unnamed extension effectively making it private,
meaning that the fuzz test that splits the file up doesn't work.
There seem to be no reason for it to be unnamed so this CL names it,
thus fixing the failure when fuzzing.

Change-Id: Iaeb01739dad50f1894a619fe18b81408fa646ce3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255811
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-08-19 09:58:45 +00:00
Aske Simon Christensen a85157e233 [dart2wasm] Convert to/from externref via Wasm instructions
This adds support for the newly added `extern.externalize` and
`extern.internalize` instructions and uses these for converting to/from
`externref` instead of a JS round-trip.

Change-Id: If18d8f44ddf013d4c26bf1597be91bcd0db41c5a
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255462
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-08-19 07:11:18 +00:00
Aske Simon Christensen 1638b75d77 Update d8 to 10.6.182
This version adds support for the `extern.externalize` and
`external.internalize` Wasm instructions.

Change-Id: I2285217feff0afa8107ec6685eeec91487667254
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255461
Reviewed-by: Stephen Adams <sra@google.com>
2022-08-19 07:11:18 +00:00
Aske Simon Christensen 02d1255d75 Update d8 to 10.6.166
The API for the JS Promise integration API has changed to be part of
the `new WebAssembly.Function` constructor. This requires parameter
types to be specified explicitly. Apparently, these types currently
must be all `externref`.

Change-Id: Ifae634f65cfa377441be4b2dc0643c34b702fbe7
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255061
Reviewed-by: Stephen Adams <sra@google.com>
2022-08-19 07:11:18 +00:00