Commit Graph

1366 Commits

Author SHA1 Message Date
jlcontreras da6cdc55b4 [cfe] Implement addHashCode to valueClass transformation
Change-Id: Ie566cee214b63f986e07c84e4ae28bfecc80e0a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162186
Commit-Queue: Javier López-Contreras <jlcontreras@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-09-11 16:05:52 +00:00
Johnni Winther 8008c8d54e [cfe] Make widget transform location field nullable
The widget transformer doesn't handle widgets with optional positional
parameters and therefore doesn't provide locations in these cases.
For this reason we leave the location field nullable and don't null check
it on construction.

Close #43371

Change-Id: I2595eb215e8fab477ab0819b70e25d9fb921ed01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162187
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-09-10 11:30:15 +00:00
jlcontreras 69b194e88f [cfe] Implements ValueClassScanner
Change-Id: I36b839280513a75d92797d5999ecb567e6999a5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162180
Commit-Queue: Javier López-Contreras <jlcontreras@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-09-09 14:10:08 +00:00
Johnni Winther a8f9f08253 [cfe] Don't find unnamed mixin application in least upper bound
InterfaceType's referring to unnamed mixin applications continuously
cause problems for backends since these might not correspond to
types supported at runtime. The LUB specification does not mention
how to handle these so it is valid skip these in the computation of
LUB.

Change-Id: I38f46bf43d5858dec473c26326b741cf36eb57d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145420
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-09-09 13:00:17 +00:00
jlcontreras 173a958d37 [cfe] Implement addEqualsOperator in value class transformation
Change-Id: I07afadfe9d23f792edb61681e794faa4de6aebb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161506
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Javier López-Contreras <jlcontreras@google.com>
2020-09-08 18:30:55 +00:00
Clement Skau 90652bc314 [VM] Fixes nested sync* w. diff. types.
Makes the synthetic sync* iterator dynamic to allow the internal,
synthetic sync* code to handle nested iterators of differing types.

Bug: https://github.com/dart-lang/sdk/issues/42234
Change-Id: I309885b27555142cd7f8ab13a5637b35545f1d44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160071
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-09-03 11:48:44 +00:00
Johnni Winther 082295a61e [cfe] Support lowering of static fields with initializers
This adds support lowering the encoding of top-level/static fields
with initializers as if they were marked as late fields. This ensures
that LateInitialization is thrown if final fields are written to during
initialization.

Closes #42956

Change-Id: I488fdddd87ebd935a0cdaf82a724e9b87d5f91ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160724
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-09-01 07:20:58 +00:00
jlcontreras 70fd140a9d [cfe] Implements addConstructor of value class transformation
Change-Id: I991c82693a6a3a44061efa7703fa89bd94f858b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158280
Commit-Queue: Javier López-Contreras <jlcontreras@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-08-31 13:24:38 +00:00
Clement Skau 4db081545e Revert "[VM] Fixes yield* exception handling in sync*."
This reverts commit 358aee331b.

Reason for revert: Appears to break service/async_generator_breakpoint_test

Original change's description:
> [VM] Fixes yield* exception handling in sync*.
> 
> This adds a mechanism similar to that used in async functions where
> exceptions are caught in the synthetic code and passed into the
> generated body to be rethrow'n.
> This ensures the exception is throw'n from the same place as the
> original yield*, as per the spec.
> 
> Bug: https://github.com/dart-lang/sdk/issues/42466
> Change-Id: I553dd89141985f6f30751913a1c8a62b1229af04
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158543
> Commit-Queue: Clement Skau <cskau@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

TBR=vegorov@google.com,cskau@google.com

Change-Id: I9df83543d41d4260e91e4a7fb8df7c2762b92429
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/42466
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160101
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-08-25 14:08:42 +00:00
Clement Skau 358aee331b [VM] Fixes yield* exception handling in sync*.
This adds a mechanism similar to that used in async functions where
exceptions are caught in the synthetic code and passed into the
generated body to be rethrow'n.
This ensures the exception is throw'n from the same place as the
original yield*, as per the spec.

Bug: https://github.com/dart-lang/sdk/issues/42466
Change-Id: I553dd89141985f6f30751913a1c8a62b1229af04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158543
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-08-25 12:40:49 +00:00
Johnni Winther 44e466c7fb [cfe] Handle dead code in Expression.getStaticTypeAsInstanceOf
Related to https://github.com/flutter/flutter/issues/64155

Change-Id: I71f1310a00a2b0cfbfb263361293bb442826199c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160061
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-08-25 10:19:10 +00:00
Jens Johansen 65968a481b [kernel] ast-to-text shows combinators for imports/exports
Change-Id: If153dded362eb1fe5f4c52a92206ff8e86579c1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159248
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-08-20 10:24:48 +00:00
Johnni Winther de224ac5f4 [cfe] Update ast-to-text to include member signature origins
Change-Id: I46e7fe831bc5e87981e78537b37565c62646210f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157961
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-08-17 13:41:49 +00:00
Johnni Winther d267906184 [cfe] Ensure that noSuchMethod forwarders are not marked as member signatures
Change-Id: Id8a093db8d757b08cee97d9c7de1baa452531bb9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158547
Reviewed-by: Jens Johansen <jensj@google.com>
2020-08-14 15:30:24 +00:00
Johnni Winther 4b2f375402 [cfe] Ensure that forwarding stub are distinct from member signatures
Change-Id: Ie5c37b55e0d636a1ab70cb77d816b977b5351451
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158385
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-08-14 11:12:40 +00:00
Johnni Winther f8e7e64fd6 [cfe] Handle constant constructor invocations in Widget factory constructors
The widget transformer would try to pass on the location injected
parameter in the factory constructor when calling constructors of its
own kind in constructor body. For instance

  class Foo extends Widget {
    factory Foo() => new Foo.internal();
    Foo.internal();
  }

would be transformed into

  class Foo extends Widget {
    factory Foo({Location loc}) => new Foo.internal(loc: loc);
    Foo.internal({Location loc}) : super(loc);
  }

This doesn't work if the constructor invocation is constant. For
instance:

  class Foo extends Widget {
    factory Foo() => const Foo.internal();
    const Foo.internal();
  }

which would be transformed into

  class Foo extends Widget {
    factory Foo({Location loc}) => const Foo.internal(loc: loc);
    const Foo.internal({Location loc}) : super(loc);
  }

Here the reading of the injected factory parameter [loc] is not a
valid constant, leading to a compile-time error during constant
evaluation.

To handle this, const constructor invocations within factories do
not pass on the location from the surrounding constructor but
uses their own. For instance:

  class Foo extends Widget {
    factory Foo() => const Foo.internal();
    Foo.internal();
  }

will be transformed into

  class Foo extends Widget {
    factory Foo({Location loc})
      => const Foo.internal(loc: const Location());
    Foo.internal({Location loc}) : super(loc);
  }

This does mean that these constant widgets will all have a
location based on the factory constructor declaration and _not_
one per invocation of the factory constructor.

Related to https://github.com/flutter/flutter/issues/63335

Change-Id: Ie3300d3ba81324d5fbd7fb6ab72b9d83d7afcf22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158395
Reviewed-by: Jens Johansen <jensj@google.com>
2020-08-14 10:15:12 +00:00
Johnni Winther e597681d22 [cfe] Update messages for failures to opt in to non-nullable experiment
Change-Id: I16d71feeb51a7eee13048195898adfe7bf5761d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157482
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-08-14 09:01:07 +00:00
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