Commit Graph

1349 Commits

Author SHA1 Message Date
Johnni Winther 65e48e423a [cfe] Add a member signature origin to member signatures
Adds a member signature origin to member signatures and includes
an additional reference to these in MethodInvocation, PropertyGet,
PropertySet, etc.

This enables the VM to bypass the member signatures when loading the
AST.

Change-Id: I5cae11f4434bc052d0ba0acf0670dd002c6f3df1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157498
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-08-11 08:16:59 +00:00
Johnni Winther b9c5118c73 [cfe] Don't mark external methods as abstract
Closes #31233
Related to flutter/flutter#62887

Change-Id: I96e5a1b8045f75f1ad02fb47e5e41fe402dc3dc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157481
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-08-06 16:29:09 +00:00
jlcontreras 0f0e04ec3a Add empty value class transformer.
Change-Id: I8e532c1699785ed75c7eff7a3187a4ca3a2032e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156880
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Javier López-Contreras <jlcontreras@google.com>
2020-08-03 14:14:42 +00:00
Mayank Patke ca743398c2 Ensure CFE provides correct setter name to instantiateInvocation.
All of the backends (dart2js, DDC, VM) were checking if the invocation
name was tagged with "set:" and appending "=" to the name if so.
Instead, we can simply have the CFE perform this logic at the callsite.

Note that the name of the setter itself is still unchanged. Backends may
still need to generate the correct name themselves when handling NSMs
via code paths other than instantiateInvocation.

Change-Id: Iae42c849d3557be3e3b77c3af6f3993347ba0b6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156142
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-07-30 06:21:20 +00:00
Dmitry Stefantsov 1b2c267bb2 [cfe] Use unwrapping of nullability constructor in upper bound
Previously to unwrap a type in isTop method the declared nullability
was set to Nullability.nonNullable.  This doesn't work for
intersection type because .withDeclaredNullability() doesn't work for
them.  This CL introduces a method that simulates the removal of the
top-level nullability type constructor from a type term, and uses the
method in isTop to account for intersection types and other possible
similar cases in future.

Change-Id: I3e6f30b5d93850b2cf92475a89d09d6d9255089f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156193
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-07-29 14:24:05 +00:00
Johnni Winther 8e7e400a00 [cfe] Use legacy erasure in LUB computation in opt-out libraries
Closes #42836

Change-Id: Ibe6d8e54e082ffb204ccc18f438809c7776c1cd4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156001
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-29 07:36:34 +00:00
Johnni Winther fffd0d04b1 [cfe] Handle Null/Never-ish spread element types
Closes #42758

Change-Id: I0b25a5a1abc0896300f61fc98f514f1ed1a63e31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155447
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-28 06:29:36 +00:00
Johnni Winther da663d6eb0 [cfe] Fix bad supertype substitution in mixin check.
Closes #42792

Change-Id: I21757f0f8417ad677d075e8417e390e1fa532a2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155444
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-27 18:43:25 +00:00
Johnni Winther 1d092219a3 [cfe] Move LUB computation to package:kernel
Change-Id: I06951e5367dbf5e84d897e38d38ec00fa6115db7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155325
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-27 18:41:12 +00:00
Johnni Winther 33378492e5 [cfe] Implement new static types for arithmetic operations
Closes #41559
Closes #42577

Change-Id: I22da02731c106ec354d72a649c5b6ac6091b9292
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155324
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-27 18:40:24 +00:00
Johnni Winther 37c8c709bf Move BytesBuilder class and implementation to dart:typed_data.
Change-Id: Ic4fe1944ef4af19732f23c389845b6a74af0bc32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154682
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-07-24 11:37:21 +00:00
Konstantin Shcheglov 58b6f40c73 Issue 42797. Understand in legacy libraries that a function returning Never (in Null Safety library) never returns. (reland)
Initial: https://dart-review.googlesource.com/c/sdk/+/155500
Reverted: https://dart-review.googlesource.com/c/sdk/+/155540

Bug: https://github.com/dart-lang/sdk/issues/42797

Change-Id: I5f0f1df594ac678718f347ee80b1764f971e42e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155541
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-07-23 00:01:12 +00:00
William Hesse f88ce7aef5 Increase Dart version to 2.10
Change-Id: Ic6b556f935602834564aca24690608aa624efa43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155440
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-22 13:22:07 +00:00
Dmitry Stefantsov 6bfdd5239b [cfe] Remove best-effort testing of round-trip text serialization
Tests are now run over entire libraries instead of their sub-trees
that are deemed to be ready for the serialization by the verifier.
The update revealed two scoping bugs.  This CL fixes them as well,
namely the following:

  * Result expression of a block expression should be in the scope of
    the block.  That is, the variables declared in the block are
    visible in the result expression.

  * Local function declarations should be visible in the blocks they
    are declared in.  Accidentally, the Bind combinator was used
    instead of Rebind, resulting in local functions being visible in
    their own bodies, but not in the blocks they are declared in.

Change-Id: I856045464caa934228d5f259a4d2d582e77deb88
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155124
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-07-21 11:01:41 +00:00
jlcontreras 96a25bdfa1 Fix a typo in the comment on a transformer.
Change-Id: I9d34f5d3bfbeb75b0b5f122ef334b9b0b629aace
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154882
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Javier López-Contreras <jlcontreras@google.com>
2020-07-20 10:50:24 +00:00
Dmitry Stefantsov 7909babc75 [cfe] Fix scope bug for initializers in text serialization
The initializers are in the scope of the parameters of constructor's
FunctionNode, but they aren't children nodes of that FunctionNode.

Change-Id: I48c5876f50ae186db47b3ba222a469ef311ce62c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154692
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-07-17 13:24:28 +00:00
Johnni Winther ab958bee57 [cfe,flutter] Make widget transformer location parameters optional
The location parameters added to Widgets was created as required
and non-nullable when opting flutter in to null-safety. This leads
to incremental compilation failing because already transformed
constructors require parameters that cannot be passed by user code.

Fixes https://github.com/flutter/flutter/issues/60269

Change-Id: I91cbeaa455e67e82983ebb17f93da13b46376da2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153085
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Jacob Richman <jacobr@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-16 06:12:13 +00:00
Johnni Winther e637f7054e [cfe] Add support for keeping const locals during constant evaluation
With this CL backends can opt in to retain constant local variables
in the AST that would otherwise have been removed through inlining.

Change-Id: I377a8679c89fe012d2ec4c7e087274a8052979ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153965
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-14 12:17:39 +00:00
Dmitry Stefantsov d6dfbda0d3 [cfe] Complete basic implementation of round-trip text serialization
The future non-basic version is to include the following:

  * adding missing annotations on nodes
  * adding URIs and file offsets to the nodes
  * adding nullability markers to types
  * stylistic changes
  * optimizations
  * better surface syntax
  * better error messages

Change-Id: If2fc51e4932d9043dd1719b766bd23ff4e0fc1ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154001
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-07-13 14:13:55 +00:00
Dmitry Stefantsov 060d948339 [cfe] Add support for classes to round-trip text serialization
Supplementary changes for handling Classes done in this CL are the
following:

  * handling Supertypes
  * handling Constructors
  * handling remaining kinds of Procedure
  * serializing AsyncMarker the same way as flags
  * eliminating the need to wrap flags into IntLiteral

Change-Id: Id69c6e37f093cf80206f4657b649f79c75484775
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154000
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-07-10 12:49:27 +00:00
Dmitry Stefantsov 99b693ba88 [cfe] Add support for constructor initializers to text serialization
Change-Id: I1a311978460bee2f554a3bddbaf329698d1d33c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153779
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-07-10 08:32:58 +00:00
Dmitry Stefantsov 145d4585e7 [cfe] Add support for Fields to round-trip text serialization
The flags on the fields are serialized as lists of flag names,
allowing for any combination of the flags in any order.  Similar
technique is used in this CL to serialize the flags on Procedures and
VariableDeclarations.  This is in the contrast with the previous
approach for those nodes, when the flags were the part of the
serialized name of the node (such as "static-method" for static
Procedures or "final" for final VariableDeclarations).

Change-Id: I02eb5ac92f6273542f08f269aee8e6519d3085e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153766
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-07-10 07:23:08 +00:00
Dmitry Stefantsov f75a982361 [cfe] Complete support for statements in text serialization.
This CL adds round-trip serialization support for FunctionDeclarations
and the remining kinds of VariableDeclarations, completing the support
for statements.  Additionally, the CL fixes a variable scope issue in
Catch clauses, namely that the exception and the stack trace variables
should be visible in the body.

Change-Id: I3843d491b85a65c4953d6fc10a59ecbde5017029
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153611
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-07-10 07:23:08 +00:00
Dmitry Stefantsov 2e5e03fe8d [cfe] Add support for Switch statements to text serialization
Also handle TryCatch and TryFinally.

Change-Id: I68e64161500c036bc0e1d39723baf2a88f7a3cc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153603
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-07-08 09:46:54 +00:00
Dmitry Stefantsov 2eee76303f [cfe] Add support for constants to Kernel text serialization
The CL also finalizes the support for expressions because the constant
expressions can now be serialized.

Change-Id: I7bc98fc974d3be1d4b9f1712cf67f9fbe6496e01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153461
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-07-07 15:22:01 +00:00
Dmitry Stefantsov e196354481 [cfe] Support more Expression nodes in text serialization
The following nodes are now supported:
* SetConcatenation
* MapConcatenation
* FileUriExpression
* BlockExpression
* ListConcatenation
* NullCheck
* Instantiation
* CheckLibraryIsLoaded
* LoadLibrary

Change-Id: Ia269196c36facb211995d0ef8cd8a68cbf836e37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153346
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-07-07 09:32:29 +00:00
Dmitry Stefantsov da8712394b [cfe] Support LabeledStatement and Break in text serialization
In addition to supporting the nodes, the notion of Binder is
reworked.  It doesn't store the computed local distinct name on the
node itself now, as it's not always possible (which is the case of
LabeledStatement), but keep it in a map.

Change-Id: I04c08875cbcac3a547d62afbe5b17f023e6f1035
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153342
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-07-07 09:32:29 +00:00
Clement Skau 0ce83987d6 Reland "[SDK] Adds an SDK hash to kernels and the VM."
Note: This is a reland of https://dart-review.googlesource.com/c/sdk/+/150343

Adds a new SDK hash to kernels and the VM which is optionally checked
to verify kernels are built for the same SDK as the VM.
This helps catch incompatibilities that are currently causing
subtle bugs and (not so subtle) crashes.

The SDK hash is encoded in kernels as a new field in components.
The hash is derived from the 10 byte git short hash.

This new check can be disabled via:
  tools/gn.py ... --no-verify-sdk-hash

This CL bumps the min. (and max.) supported kernel format version,
making the VM backwards incompatible from this point back.

This also bumps the min. and current ABI version.

Bug: https://github.com/dart-lang/sdk/issues/41802
Change-Id: I2f85945045a603eb9dcfd1f2c0d0d024bd84a956
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152802
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-07 06:08:20 +00:00
Johnni Winther 5d1fbe0497 [cfe] Handle unforseen type parameter intersections
Closes #42089

Change-Id: Ifb0dc0073e004051ae40aed51db24b0d4b10f50d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152646
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-06 10:09:00 +00:00
Johnni Winther 34f5c9d0b4 [cfe] Implement new async return rules
Closes #41800
Closes #41900
Closes #42134
Closes #42282
Closes #42236
Closes #42169

Change-Id: Ia994bc07fba4e2342fcb59d44fc77608198a328b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152150
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-06 07:04:40 +00:00
Dmitry Stefantsov af124aeb9b [cfe] Fix bug in dart type equivalence regarding typedef types
Change-Id: I0fc7d9227bd63401edfab46777c0ed8f30db5cbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153083
Auto-Submit: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-07-01 17:11:41 +00:00
Johnni Winther 236f3f820d [cfe] Fix flow analysis in initializers
The handling of null shorting in the variable initializer interfered with
the declaration of the variable, making subsequent flow potentially
losing track of promotions.

Closes #42504

Change-Id: Idb17920ffe8746983825714f76160abcca54751b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152760
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-01 08:57:18 +00:00
Erik Ernst 41c9fb6a19 [CFE] Type infer aliased factory invocations.
This CL adds support for type inference on type aliased invocations of
factory constructors, redirected as well as non-redirected, and it adds
some tests using this feature.

Additionally, this CL resolves a couple of issues that arose when the
directory nonfunction_type_aliases was migrated to null-safety (by
means of two single line fixes, in 'usage*_test.dart').

Still missing: The shadow nodes should be eliminated in
_unaliasTypeAliasedConstructorInvocations and
_unaliasTypeAliasedFactoryInvocations, this will be done in a separate
CL.

Change-Id: Ic146bd16a02ca8f79c46b7df7c8dff7712f21189
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152740
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-07-01 07:19:08 +00:00
asiva bb8d145616 Revert "[SDK] Adds an SDK hash to kernels and the VM."
This reverts commit edde575dcd.

Reason for revert: Breaks the Dart to Flutter roll and golem

Original change's description:
> [SDK] Adds an SDK hash to kernels and the VM.
>
> Adds a new SDK hash to kernels and the VM which is optionally checked
> to verify kernels are built for the same SDK as the VM.
> This helps catch incompatibilities that are currently causing
> subtle bugs and (not so subtle) crashes.
>
> The SDK hash is encoded in kernels as a new field in components.
> The hash is derived from the 10 byte git short hash.
>
> This new check can be disabled via:
>   tools/gn.py ... --no-verify-sdk-hash
>
> This CL bumps the min. (and max.) supported kernel format version,
> making the VM backwards incompatible from this point back.
>
> Bug: https://github.com/dart-lang/sdk/issues/41802
> Change-Id: I3cbb2d481239ee64dafdaa0e4aac36c80281931b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150343
> Commit-Queue: Clement Skau <cskau@google.com>
> Reviewed-by: Jens Johansen <jensj@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,jensj@google.com,cskau@google.com

Change-Id: I34cc7d378e2babdaaca4d932d19c19d0f35422fc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/41802
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152703
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-06-26 18:54:17 +00:00
Clement Skau edde575dcd [SDK] Adds an SDK hash to kernels and the VM.
Adds a new SDK hash to kernels and the VM which is optionally checked
to verify kernels are built for the same SDK as the VM.
This helps catch incompatibilities that are currently causing
subtle bugs and (not so subtle) crashes.

The SDK hash is encoded in kernels as a new field in components.
The hash is derived from the 10 byte git short hash.

This new check can be disabled via:
  tools/gn.py ... --no-verify-sdk-hash

This CL bumps the min. (and max.) supported kernel format version,
making the VM backwards incompatible from this point back.

Bug: https://github.com/dart-lang/sdk/issues/41802
Change-Id: I3cbb2d481239ee64dafdaa0e4aac36c80281931b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150343
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-26 13:35:42 +00:00
Dmitry Stefantsov 8e0b0d5fa0 [cfe] Add NNBD-aware constraint gathering and solving
Closes #41105
Closes #41106
Closes #41447

Bug: http://dartbug.com/41105
Bug: http://dartbug.com/41106
Bug: http://dartbug.com/41447
Change-Id: I041c4a861fa580a9a9da77416308300206f4774e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151393
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-06-24 14:35:01 +00:00
Erik Ernst 5a6c1e5158 Type aliased inference of generative constructor invocation.
This CL adds some infrastructure that makes it possible to defer the
inference of type arguments for a type alias which is used to specify
an instance creation:

  class B<X, Y> {}
  class C<X> implements B<String, X> {}
  typedef T<X> = C<List<X>>;

  void main() {
    B<Object, Iterable<num>> c = T(); // Infer `T<num>()`.
  }

The CL contains an implementation for type inference in the case
where the target is a non-redirecting constructor.

There is not yet an implementation of type inference for the case
where the type alias ultimately resolves to a redirecting factory
constructor, and the shadow nodes are eliminated as null.

Change-Id: I9721b293dce37313e046a8339359e51c2d54b4c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150301
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-06-23 14:14:11 +00:00
Daco Harkes 7eac9f355e [vm/ffi] Expose a subset of dart_(native_)api.h for dynamic linking.
This CL introduces dart_api_dl.h which exposes a subset of dart_api.h
and dart_native_api.h for dynamic linking at runtime through the FFI.
Dynamic linking is done through including dart_api_dl.cc in a shared
library and passing NativeApi.initializeApiDLData to the init function.

This CL also includes Native API versioning to deal with possible
version skew between native api version against which native libraries
are compiled and the version in the DartVM the code is run on.

The subset of symbols in the CL includes handle related symbols, error
related symbols, handle scope symbols, and native port sumbols.

Design: http://go/dart-ffi-expose-dart-api

Closes: https://github.com/dart-lang/sdk/issues/40607
Closes: https://github.com/dart-lang/sdk/issues/36858
Closes: https://github.com/dart-lang/sdk/issues/41319
Closes: https://github.com/flutter/flutter/issues/46887
Closes: https://github.com/flutter/flutter/issues/47061

Misc:
Closes: https://github.com/dart-lang/sdk/issues/42260

Change-Id: I9e557808dbc99b341f23964cbddbb05f26d7a6c5
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-mac-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-nnbd-linux-debug-x64-try,analyzer-nnbd-linux-release-try,front-end-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145592
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-06-18 07:30:43 +00:00
Johnni Winther 7fce125300 [cfe,kernel] Add AstPrinter
This CL adds a Node.toText method together with an AstPrinter. These
facility and better toString implementation on AST nodes while allowing
for toString independent printing of AST to use in testing. This also
add support for an integrated toString of custom/internal nodes.

Some work is still needed in bringing the toString implementation on
all nodes to the old quality, and not all internal nodes have
customized textual representations yet. This work is left for future
CLs.

Change-Id: Ib0bf8a0bc02f489dfacdc8aa5f96da9c52f26058
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150923
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-06-16 17:15:10 +00:00
Johnni Winther 28606d040b [cfe] Recompute type parameter type nullability after substitution
Closes #41697

Change-Id: Ib4977aa3f8d97defa7884036a0f561d6ecb4c3ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149587
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2020-06-15 13:24:26 +00:00
Dmitry Stefantsov 929d5e4a98 [cfe,ddc,dart2js,vm] Add FutureOrType
This CL is the sum of the following 5 CLs:
* https://dart-review.googlesource.com/c/sdk/+/149297/
* https://dart-review.googlesource.com/c/sdk/+/149299/
* https://dart-review.googlesource.com/c/sdk/+/149320/
* https://dart-review.googlesource.com/c/sdk/+/149321/
* https://dart-review.googlesource.com/c/sdk/+/149323/

The reason for landing the 5 CLs as one CL is to prevent potential
troubles with bisecting over the branch because the change is fully
functional only with all 5 CLs.

Closes #40123.

Bug: https://github.com/dart-lang/sdk/issues/40123
Change-Id: Ice52250a98acfe455b1d7fa5bb0624c115ca5dac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150934
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-06-15 12:18:46 +00:00
Dmitry Stefantsov 363ac11c1f [cfe] Support more statements in round-trip serialization
* async-version of ForInStatement
* AssertBlock
* AssertStatement
* ReturnStatement without return expressions

Change-Id: Ic1dcff70913c37fc09e31f4608eff8a47037eaa1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150924
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-06-11 10:10:08 +00:00
Dmitry Stefantsov b5e7966dee [cfe] Add DartTypeComparator
The utility class DartTypeComparator allows to compare two dart types
under various assumptions, such as ignoring nullability at the
top-level type node or equating all top types.

Change-Id: I998e4a0a3ac236077cd1bcd12a5ad146ff10bb1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149427
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-06-08 16:58:31 +00:00
Jens Johansen 652bac12b4 [CFE/VM] Fix 'reject' when using experimental invalidation strategy
Change-Id: Ib7c75584dec6fa605f82487a5b0291894964bed0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150026
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-06-08 12:02:43 +00:00
Johnni Winther 3a021a6545 [cfe] Remove EvaluationMode.legacy
This is no longer valid. Since the SDK is agnostic we should default to weak mode.

Change-Id: Ia9fbf911e7ebb595c93a71afe3bb8de7495cebba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149065
Reviewed-by: Jens Johansen <jensj@google.com>
2020-05-30 09:47:02 +00:00
Jens Johansen 0f80f51859 [kernel] Allow merging nnbd disabled + nnbd weak
Allow loading a dill that contains both nnbd disabled and nnbd weak.

Fixes https://github.com/flutter/flutter/issues/58126

Change-Id: Ic188bd1d377aa9d660e8803869713342f3a814c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149424
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-05-29 14:40:36 +00:00
Dmitry Stefantsov 142d09fed7 [cfe] Provide better context in verifier's diagnostics
Change-Id: I599eb100acab431fc5630305951120dfe98e79b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148763
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-26 10:02:05 +00:00
Jens Johansen 857fca710f [kernel/VM] Fix 'infinite' loop with memory crash on specific invalid dill
The dill file has an index at the end. The last 4 bytes of that index is
a size that indicates how big the file is. This is done to support
concatenated dill files. If the dill is invalid and the size is read as 0
both the VM and the dart kernel reader will go into an infinite loop where
it allocates another list entry on every loop iteration (making the whole
loop not infinate because we will run out of ram soon enough).

This CL fixes the issue by checking the size to be possitive.

Change-Id: I42da0557c6d4a274fdbe1a729fdaf5b8f149b187
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148538
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-05-26 08:24:05 +00:00
Jens Johansen 53ac4d53f2 [CFE] Set compilation mode if no main found
Change-Id: I2c3121e54f6c12b7ecdd8784851ca0611ff0b9d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148401
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-20 10:29:42 +00:00
Johnni Winther 6708394f03 [cfe] Add predicates to detect late lowered fields.
Needed for https://github.com/dart-lang/sdk/issues/41892

Change-Id: I049e76655cf62a5558c18319e80ab9702c7a3c22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148321
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-05-19 08:55:20 +00:00