Commit Graph

1972 Commits

Author SHA1 Message Date
Johnni Winther 13556d623f [cfe] Add DartType.toNonNull
Add helper on DartType to compute the `NonNull` of a type and use this
instead of `withDeclaredNullability(Nullability.nonNullable).

Includes a fix in the computation of NonNull of FutureOr.

TEST=existing

Change-Id: I3399cbf89c7d3f3e90f1315b01f40957e798a1b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193400
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-03-30 10:25:28 +00:00
Johnni Winther 57f18c6d38 [cfe] Add tests for issue 45376
These tests show that we handle >> and >>> similarly wrt to allowing
integer operations on double constants with integer values.

https://github.com/dart-lang/sdk/issues/45438 proposes to disallow these,
but that requires a new js evaluation strategy and the issue in 45376
is therefore just a consequence of the current approach.

Change-Id: I703b57d5a6562ff1c1410858b22a96655f59dc4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193406
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-03-30 10:25:08 +00:00
Kallen Tu 5b3a5acf01 [cfe] Switch statements for const functions.
Change-Id: I1194f9091b74ba3e288d5e7bd386c204fa25c837
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193360
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2021-03-30 03:56:58 +00:00
Daco Harkes 4ba4fd3f1d [analyzer/ffi] Inline array annotation const dimensions
Moves the Array forwarding constructors and _ArraySize class out of
the patch files so that the analyzer can reason about them.
(The analyzer does not include patch files, because it does not know
whether it's analyzing for VM or JS backend.)

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

Change-Id: Ia0eb4bbca40b906a1e636714f53c5c73dcfc3cad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193403
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-03-30 00:28:57 +00:00
Dmitry Stefantsov 9008fc0eaf Revert "[cfe] Remember built TypedefTypes for late bounds checks"
This reverts commit ce841aa40c.

Reason for revert: a crash in google3.

Original change's description:
> [cfe] Remember built TypedefTypes for late bounds checks
>
> Bug: https://github.com/dart-lang/sdk/issues/45334
> Change-Id: Idbc823ecc688f2679134c757dcf7a7ad12a02e24
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192146
> Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: https://github.com/dart-lang/sdk/issues/45334
Change-Id: I9ba9d02a29e17b58ddbf313dce70af8c9498c1a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193305
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-03-29 13:27:47 +00:00
Dmitry Stefantsov ce841aa40c [cfe] Remember built TypedefTypes for late bounds checks
Bug: https://github.com/dart-lang/sdk/issues/45334
Change-Id: Idbc823ecc688f2679134c757dcf7a7ad12a02e24
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192146
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-03-25 20:31:24 +00:00
Dmitry Stefantsov e9d7ad78e4 [cfe] Check bounds in aliased constructor calls
Bug: https://github.com/dart-lang/sdk/issues/45334
Change-Id: Ia2a9d154dba21d445f8f821988580fbf4249cf24
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192925
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-03-25 18:04:04 +00:00
Jens Johansen ac9b4aab8d [parser] More specific error messages when recovering new/const/Map/Set/List with said literals
Follow-up to https://dart-review.googlesource.com/c/sdk/+/190022

Change-Id: Id42336216267dcbf481ae6e111177e6296ea6779
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190881
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-03-25 13:27:03 +00:00
Kallen Tu 045813c1f3 [cfe] Asserts for const functions.
Basic assert statements, inline functions in the future. AssertBlocks are not supported with const functions.

Change-Id: Ic831fc4d76db0403a30577b9d00c629237148581
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192800
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2021-03-24 16:38:41 +00:00
Jens Johansen 9d5f3187ad [CFE] Crash reproductions
Change-Id: Iddf58c3af16fd56aa7cc9bd1a988ec45a4a042a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175243
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-03-24 13:45:31 +00:00
Johnni Winther 92e237c835 [cfe,dartdevc,dart2js] Use InstanceGetterInvocation for getter/field invocation
The web compilers don't support getter/field invocation encoded as a
FunctionInvocation on an InstanceGet because it doesn't work for
getter/field invocation of js-interop properties, since the InstanceGet
wouldn't result in a Dart function but just JavaScript function.

To support this in the new method invocation encoding, a special
expression, InstanceGetterInvocation, is used to encode getter/field
invocations in dart2js and ddc.

Change-Id: I21da8e8686f66ae4ce4d44245073b9e424f975b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192181
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-03-23 09:49:06 +00:00
Johnni Winther 0de315c146 [cfe] Compute variance for type parameters on duplicate typedefs
Change-Id: I6e4a05911c77d26f1fb440ec8e90c13e783926e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192147
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-03-23 07:32:26 +00:00
Kallen Tu 9e5a6c1568 [cfe] Do-while statements for const functions.
Change-Id: I881fb535ef76e564ab76c5fc661d3adbbe5aed0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192401
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-03-22 22:19:45 +00:00
Jens Johansen 86e296f3ce [CFE] Make fuzz testing work also when not skipping VM
Also "roll up" fuzz errors/craches to pass if not fuzzing.

Change-Id: Ie044f0c014504f11939d4ce50971bf31930f1193
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192144
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-03-22 10:12:52 +00:00
Kallen Tu 45c9d8a25e [cfe] Enable recursive function calls for const functions.
Change-Id: Ia164adaf5da313cae4db2b3b326a909e57d8c07c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192200
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2021-03-19 17:56:17 +00:00
Johnni Winther 5c65c68669 [cfe] Handle cyclic bounds on generic function types as type arguments
This also handles reporting of cyclic bounds in parts and sets the
bound of a cyclic type parameter to InvalidType to avoid looping on
the bound later, as for instance in computation of NORM.

Closes #45330

Change-Id: Ida20dc5b44b08a6f8674a402d801314a9172fa8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192142
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-03-19 17:54:37 +00:00
Daco Harkes 77dc74bcd5 [vm/ffi] Support packed Structs
Closes: https://github.com/dart-lang/sdk/issues/38158

This CL implements unaligned access for float/double on arm32, but does
not expose it in an API. Rather it only uses these loads/stores inside
the getters and setters of packed structs.
Bug: https://github.com/dart-lang/sdk/issues/45009

Besides unaligned access for float/double, this CL is mostly a CFE
change. The only VM change is reading the packing in the
`_FfiStructLayout` annotation.

The implementation of using the packing in the VM, and analyzer changes
have landed separately in earlier CLs.

tools/test.py ffi ffi_2
TEST=tests/ffi(_2)/(.*)by_value_(*.)_test.dart

Change-Id: Ic3106ecc626d2e30674a49bf03f65ae12d2b3502
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,analyzer-analysis-server-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186143
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-03-19 15:34:42 +00:00
Johnni Winther 9ad76fe7bd [cfe] Support annotations on function type parameters
The fix includes processing of type parameters elsewhere and also
adding support for annotations on extensions.

Closes #28981

TEST=existing

Change-Id: I71ab5640bd3a16f4a024b6edd047a525eed1c399
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191404
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-03-19 11:52:57 +00:00
Kallen Tu 3c5c1cd3f4 [cfe] Break, continues and labels for const functions.
Change-Id: Id8fce4088042b4acf9eadebe7aa99abd5565a471
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191680
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2021-03-18 17:06:13 +00:00
Johnni Winther d59c8bc4fd [cfe,dart2js] Handle LocalFunctionInvocation in ListFactorySpecializer
The CloneVisitorNotMembers contains a mapping from variables to their
corresponding clones. The ListFactorySpecializer special cased access
to this mapping to support conditional cloning. When dart2js switchted
to used the new method invocation encoding, this left the
LocalFunctionInvocation unhandled, leading to null check error when
local functions where invoked in the closure passed to List.generate.

This CL makes this mapping private and adds getter/setter methods for
lookup and registration. The ListFactorySpecializer now instead overrides
the getter to support conditional cloning instead of handling each use
case.

Bug: b/183083319
Change-Id: I2fd3b79137c51a424f17127b502e6a945c6796a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191901
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-03-18 14:34:33 +00:00
Daco Harkes 55082199e7 [vm/ffi] Fix Array<Pointer> loads and stores
Closes: https://github.com/dart-lang/sdk/issues/45198

TEST=tests/ffi(_2)/regress_45198_test.dart

Change-Id: I15cf5a4d48b1bfb33de039cc8b17be8e01fba752
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191881
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-03-18 12:26:38 +00:00
Johnni Winther 12f510fbd1 [dart2js] Use new method invocation encoding
Change-Id: Iab73f25a19fe8718cb68327fef5878d25b735030
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188523
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2021-03-17 17:26:25 +00:00
Kallen Tu 7ff1aebc2d [cfe] While loops for const functions.
Change-Id: I7979fa8b50a74f9e423f19805a793a0c25609abd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191580
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2021-03-17 16:11:43 +00:00
Kallen Tu 54f8b6fb54 [cfe] Basic for loops for const functions.
Basic for loops with tests, breaks/continues coming in a later CL.

Change-Id: I28f832ef80689a562da99f60d682bf8e4c630697
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191340
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2021-03-17 14:53:22 +00:00
Dmitry Stefantsov e64daf805f [cfe] Handle boudness type variables in results from i2b
Closes #45317.

Bug: https://github.com/dart-lang/sdk/issues/45317
Change-Id: Ib6144778a11dc837c74b4b7992c41dbe2d654946
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191260
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-03-17 10:48:31 +00:00
Jacob MacDonald 3f5384bd08 Roll dart_style 2.0.0 into the repo.
There are no formatting changes aside from adding support for generic
metadata annotations, which are not yet used. Changes are:

- Migrated to null safety.
- Return exit code from FormatCommand.run().

Change-Id: I8892f6551541f673b8e49045665e2371ba40b026
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191182
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-03-16 15:22:21 +00:00
Kallen Tu c906133967 [cfe] Multi-call const function tests to existing behavior.
Change-Id: Id03250e5eeb38d9c69b629c239e573a1d838820f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190980
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2021-03-15 18:09:13 +00:00
Dmitry Stefantsov d6b79dab6c [cfe] Correct argument count in extension member errors
Closes #45204.

Bug: https://github.com/dart-lang/sdk/issues/45204
Change-Id: I5295704a8d470e639fe346dbbbf80ad28ff614a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190520
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-03-15 10:46:00 +00:00
Kallen Tu a7e5965495 [cfe] If statements for const functions.
Change-Id: If4449eb6613c7a2b53119ed2e8d3f3042624ccd1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190800
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-03-12 21:09:08 +00:00
Kallen Tu ef01825d44 [cfe] Const function tests removed SharedOptions.
Change-Id: I51ceedf4b140f6aef2af407058c5e7c23860c850
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190801
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2021-03-12 16:20:17 +00:00
Jens Johansen 31acdc9d92 [parser] Recovery of of new/const/Map/Set/List with said literals
E.g. recover `Map<int, int>{}` by ignoring the map (i.e. it's
just a literal map), recover `new {}` as just `{}` etc.

Fixes #45251.

Change-Id: I44e67ca6d3b9b068014b8e28822a61063c794d57
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190022
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-03-12 10:41:06 +00:00
Kallen Tu 494aaaab39 [cfe] Variable assignments (VariableSet) for const functions.
Change-Id: Iab23493fc09b8fdad78968d905ac8f28e1236aa4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190620
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2021-03-11 23:14:41 +00:00
Paul Berry c509ad1e41 Change "could not" to "couldn't" in error messages
See comments at
https://dart-review.googlesource.com/c/sdk/+/186320/4/pkg/analyzer/lib/src/generated/resolver.dart#3423.
On the recommendation of the documentation team, we use a more
informal tone in messages.

Change-Id: I0c243669ebd91b8f4a745530582e0f829769a754
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189100
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-03-10 15:26:38 +00:00
Kallen Tu 3210fb4306 [cfe] Environment parents and block tests for const functions.
Fixed up block environment and added tests for them.

Change-Id: I97375c90c9244f6dcf8294dc11b0d4e70697d114
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190320
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2021-03-10 15:23:18 +00:00
Jens Johansen 3794264427 [CFE] Forgotten test for external fields and advanced invalidation fix
This CL is a test I forgot to include in
https://dart-review.googlesource.com/c/sdk/+/188461
even though I wrote it and used it to verify the fix.
Better late than never.

Change-Id: I6371719ce0d447f6ef9aeb6ebed2b7615c911b6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190480
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-03-10 14:13:59 +00:00
Kallen Tu d1fd3c6cb6 [cfe] Local functions for const functions.
Change-Id: I9ad3c36c4d515afe1def3f32244dc15b291d4011
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189980
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-03-10 01:07:32 +00:00
Dmitry Stefantsov a65f9357f8 [cfe] Add resolution for other member kinds for extension types
Change-Id: Ief5b7da1e06d0b37327fb62d29c967bcfb2cbdf6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189208
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-03-09 12:49:40 +00:00
Daco Harkes ffa5d16ae7 [vm/ffi] Support multi-dimensional inline arrays
This CL only changes dart:ffi API, CFE, and analyzer. No VM changes
were needed because the dimensions of inline arrays can be flattened
before passing them to the VM. The multi-dimensionality does not
impact the ABI.

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

TEST=pkg/analyzer/test/src/diagnostics/size_annotation_dimensions_test.dart
TEST=pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart
TEST=tests/ffi/function_structs_by_value_generated_test.dart
TEST=tests/ffi/inline_array_multi_dimensional_test.dart

Change-Id: Ica2c01fccbea7e513879365b34086d8968b54c5b
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,analyzer-analysis-server-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188286
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-03-09 10:50:17 +00:00
Johnni Winther 2d63f26ef5 Reland "[cfe] Encode field references as @getters and @setters"
This removes the @fields and @=fields canonical name
encodings that allowed for encoding of conflicting members
and didn't support field<->getter/setter conversion
between dills or between outline and full dill.

TEST=existing tests+add aot expectation tests

Change-Id: I119b0c95f90e456356146cdc2d9241de4c1b4fff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186680
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-03-09 05:47:16 +00:00
Kallen Tu 0ac716d098 [cfe] Variable declarations for const functions.
Change-Id: I085d789125e80dd2b45df9a55f4eaea28c98fd66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189400
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2021-03-08 23:34:23 +00:00
Johnni Winther 01b0947a6d [kernel] Update kernel encodings
* Add InstanceGetterInvocation for getter/field invocation in web
  backends
* Add localFunction getter to LocalFunctionInvocation
* Remove isNot from EqualsCall and EqualsNull - the encoding didn't
  carry its weight.
* Remove uses of Name.name
* Remove BottomType code from VM

TEST=existing

Change-Id: I99d05d35b9ef193d092cc151c99ad472dbd60834
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188725
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-03-08 11:29:51 +00:00
Dmitry Stefantsov 0be5ac538b [cfe] Add a test with nested generic arguments and bounds
Change-Id: I65ab1bab6624bb63bf36a6f09c582384fa89a73a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189203
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-03-05 12:21:37 +00:00
Paul Berry 219fe27e3e Front end: Fix follow-on error arising from ill-typed spread element.
When the CFE encounters an ill-typed spread element in an ambiguous
set/map literal, it replaces it with a synthetic MapEntry object
pointing to an InvalidExpression.  If there is no non-synthetic
MapEntry in the set/map, and it is decided to disambiguate to a set,
then all of the entries are fed into the `convertToElement` method.
Before this CL, this method would see the synthetic MapEntry and
assume the user had explicitly written a key-value pair in a set
literal, so it would try to report the error `Expected ',' before
this` at the location of the `:` in the key-value pair.  But since the
MapEntry was synthetic, there was no `:` and the message was very
confusing.

This CL changes `convertToElement` so that it detects when a MapEntry
has arisen from an error, and avoids creating a follow-on error.

Fixes #45174.

Bug: https://github.com/dart-lang/sdk/issues/45174
Change-Id: I37dc82a130b4bf858b3fb7411bb9c64f7450bd16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188940
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-03-04 15:52:57 +00:00
Dmitry Stefantsov c83d8792a2 [cfe] Allow generic types in arguments and bounds under a flag
The flag that enables the feature is the 'generic-metadata' experiment
flag.

Bug: https://github.com/dart-lang/sdk/issues/44916
Change-Id: I2770c672280831bf5af6643fde9cb0f1be3083b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188701
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-03-04 14:09:46 +00:00
Johnni Winther 50cda7c5e3 [cfe] Support text serialization of new method invocation encodings
Change-Id: Ie106341331f685650ac886f4b00218b806644ed5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188722
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-03-04 11:06:46 +00:00
Johnni Winther dd1c3a3233 [vm] Make async transform resilient in context of invalid type and never type of iterables
The CFE can invoke transformations despite having compile-time errors.
The async transform was crashing the compiler if it hits for-in
iterables that have an invalid type or never type.

In case of an invalid type, the program has a compile-time error and
won't be able to run propertly. So we'll replace the entire for-in with
an invalid expression statement if the iterable is an invalid
expression.

In case of a never type, the program should compile fine, which this CL
also fixes.

This makes the newly added tests no longer result in DartkCrash but
rather in a compile-time error (invalid expression) or runtime-error
(never type).

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

Change-Id: Ic50f68400b67b57dd4a2c0a125b08f0f3e0d8dd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188463
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-03-03 11:58:08 +00:00
Johnni Winther 7cbdc2f3a2 [kernel] Merge to InvalidType when either input is invalid
Change-Id: I9c41988b725cba5f3b8a0cef21132e409dd7e261
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188289
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-03-02 12:11:12 +00:00
Kallen Tu 696057e70e Simple static method invocation frontend test.
Follow up for initial static method invocation work for const functions.
Relevant language test duplicated to frontend tests.

Change-Id: I0ef7bd6e1d14de01478dbac415015e957361aa93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188320
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2021-03-01 18:53:10 +00:00
Dmitry Stefantsov e0f45c2cdf [cfe] Allow type aliases in redirecting factories
Closes #45051.

Bug: https://github.com/dart-lang/sdk/issues/45051
Change-Id: Ic4c9da303d910000d5d00ec5fb7b451baeb29e8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188285
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-03-01 15:13:30 +00:00
Dmitry Stefantsov be8196b312 [cfe] Add method resolution for extension types
Change-Id: I23577cf2083ccf03c56e4d1130039afbce8d5f27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188020
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-03-01 13:43:09 +00:00