Commit Graph

6018 Commits

Author SHA1 Message Date
Jens Johansen 5a6129406f [parser] Consistently disallow 'late' without 'var', 'final' or type
Fixes https://github.com/dart-lang/sdk/issues/43811
Fixes https://github.com/dart-lang/sdk/issues/43812
Fixes https://github.com/dart-lang/sdk/issues/43813

Change-Id: I39de527883d33459694ec0f91b769676eb52d54b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168641
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-10-23 06:28:51 +00:00
Jacob MacDonald 1a6539a0ee Dont add default enabled experiments to the map of parsed experiment flags,
this breaks the SDK build once NNBD is enabled by default, because it thinks
the experiment is explicitly enabled (effectively making 2.10 the release
version)

Bug: https://github.com/dart-lang/sdk/issues/43872
Change-Id: I65ac4e6499109b04c79dbd33145ede09b6b893c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168774
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2020-10-22 16:56:40 +00:00
Johnni Winther c8c87f40e5 [cfe] Update test
Unbreaks bots. The CQ missed the needed updates due to simultaneous commits.

Change-Id: I5d36806e5b30796211b4b1971c53bc81e45e3407
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168824
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-22 10:13:40 +00:00
Johnni Winther f371096b58 [cfe] Remove unneeded 2.10 annotation in CFE tests
The files are meant to be opted in and fixing the version 2.10 will
make them break when the current sdk version is changed.

Change-Id: I4124524f4c764bce4ef45e58ce15d806fb35db06
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168820
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-22 08:07:49 +00:00
Johnni Winther 89249a1de2 [cfe] Add tests in which a mixin application declares a member
The added tests exhibit forwarding stubs injected into mixin
application classes. These are currently not handled fully or
consistently throughout the CFE and can lead to crashes and errors.

Change-Id: Ib6a14c6adc48daa35f4a3a8e5b705ec3cf7f606d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168652
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-22 08:07:19 +00:00
Johnni Winther ed3b948b88 [cfe] Use origin location for member signatures
This is relanding https://dart-review.googlesource.com/c/sdk/+/168203
after it was reverted due to a problem in
https://dart-review.googlesource.com/c/sdk/+/168200

Change-Id: Id70d3e960b1edf1c5cdf92518b8e476084b1bb49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168645
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-10-22 07:45:29 +00:00
Johnni Winther 1514336465 [cfe] Use CombinedMemberSignature for creating simple legacy member signatures
This is relanding https://dart-review.googlesource.com/c/sdk/+/168202 after
it was reverted due to a problem in
https://dart-review.googlesource.com/c/sdk/+/168200

Change-Id: If84af1edc73ded3aa372efa59355569f56601352
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168644
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-10-22 07:45:29 +00:00
Johnni Winther c41fabbb48 [cfe] Use CombinedMemberSignature to create noSuchMethod forwarders
This is relanding https://dart-review.googlesource.com/c/sdk/+/168201
after it was reverted due to a problem in
https://dart-review.googlesource.com/c/sdk/+/168200

Change-Id: I350ae8af38b48d909716289c99092be2a638f3fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168643
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-10-22 07:45:29 +00:00
Johnni Winther b42f954364 [cfe] Use experiment release version when non-nullable is enabled explicitly
Even when non-nullable is enabled by default, enabling the experiment
explicitly should result in the experiment release version (and not
the experiment enabled version) to be used for opting in.

For this change, the semantics of parseExperimentalFlags was change
to _not_ normalize the flags to a full mapping including default values.
For this reason all uses of such maps are renamed to
'explicitExperimentalFlags'.

Closes #43879

Change-Id: I0d0262e68ec1403549abcfd305ae3a4404fe93e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168654
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-22 06:17:39 +00:00
Regis Crelier 0ace625d6d [VM/finalizer] Remove checks from finalizer now performed in CFE.
Also stop passing the class 'being parsed' to finalization methods.

Change-Id: I7c2256c2a8ace468021ba0ba5be10b6bfb839480
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168621
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2020-10-21 19:36:56 +00:00
Jens Johansen 38b70871e4 [CFE] Don't allow generate-messages to write empty files
Previously, if editing messages.yaml and making a mistake one could
end up with empty "codes_generated.dart" and
"fasta_codes_cfe_generated.dart" meaning that nothing could compile
before doing a `git checkout <file>` on it.

Now instead generate-messages will just not do that.

Change-Id: I072d805772201af218609e7e45e5a6a2316de593
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168648
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-10-21 14:24:03 +00:00
Johnni Winther fa6399ff81 [cfe] Add messages in preparation for enabling non-nullable by default
The added messages handle the situation in which null safety is enabled
by default but is turned off either by language version or by explicitly
passing --enable-experiment=no-non-nullable

Change-Id: Iec43daf19a80f555e838635c83542fdb243b8ed4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168647
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-21 13:51:03 +00:00
Johnni Winther 5c51990a80 [cfe] Handle void as return context in sync function expressions
Closes #43174

Change-Id: I6b1cc04cbf2d65d9b877dfabf3e0f535f2491a94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168542
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-21 13:43:03 +00:00
Johnni Winther 81e345ca64 [cfe] Add test that exercises super member override checks for covariant parameters.
The code exercised by the test is located in ClassBuilder.handleSeenCovariant

Change-Id: I140e60fff01f60461ebaa6edfe193dbb7858c641
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168642
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-21 12:55:13 +00:00
Clement Skau 7f0bd5e811 [VM] Removes _Future's and _StreamImpl's _awaiter.
Changes debugger.cc to use the 'lazy async stack' mechanism for
unwinding async stacks, which means we no longer have to manually
keep track of the caller.

This also allows us to get rid of _asyncStarListenHelper.

Bug: https://github.com/dart-lang/sdk/issues/42457
Change-Id: I536e9da4af275998140ae5f05e3a43e07c77cfc7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167561
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-21 12:38:23 +00:00
Jens Johansen 29fa4e8148 [CFE et al] Compile flutter platform as agnostic for test; set component mode more
Bug: dartbug.com/43844 dartbug.com/43807
Change-Id: Iba662f0955897244aaac86ceace73b213fa06319
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168482
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-10-21 10:04:41 +00:00
Johnni Winther 10c03da2c2 [cfe] Add regression test for issue 43864
Change-Id: Id0f6c18c5d47a1fbf234cc7c0a43abb6035a0c4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168540
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-10-21 07:58:32 +00:00
Joshua Litt 043bebcd02 [dart2js] Fixes to dart2js unit tests to support nnbd by default.
Change-Id: I440dddd34a62bfe8c0f3fd563888acb680c2b031
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168141
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-10-20 18:40:44 +00:00
Johnni Winther 137c7b6c84 [cfe] Explicitly run front_end unittest without non-nullable
This prepares front_end unittests for turning on non-nullable by default.

Change-Id: I9588a2d026ab9f5b1dcf08a140d25bd5dca3d5bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168346
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-20 13:13:33 +00:00
Michal Terepeta 5f18d498a0 Revert "[cfe] Avoid transforming members in other classes to no-such-method forwarders"
This reverts commit 87d3e03bf8.

Reason for revert: Breaks internal builds (http://b/171258924)


Revert "[cfe] Use CombinedMemberSignature to create noSuchMethod forwarders"

This reverts commit 13b7a83d57.

Reason for revert: Depends on a commit that breaks internal builds
(http://b/171258924)


Revert "[cfe] Use CombinedMemberSignature for creating simple legacy member signatures"

This reverts commit 170f05f91b.

Reason for revert: Depends on a commit that breaks internal builds
(http://b/171258924)


Revert "[cfe] Use origin location for member signatures"

This reverts commit 354dcf4386.

Reason for revert: Depends on a commit that breaks internal builds
(http://b/171258924)

Change-Id: I51f524949f259351336a77f43847bf1d0d11f104
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168487
Reviewed-by: David Morgan <davidmorgan@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Michal Terepeta <michalt@google.com>
2020-10-20 12:23:53 +00:00
Jens Johansen a7137f4e59 [CFE] Fix weird artifacts when evaluating lists/sets/maps with unevaluated constants in them
Change-Id: Id391521d2e4549cbf2b8658c2d1b07ecf77f4ab3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167340
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-10-20 10:21:12 +00:00
Johnni Winther 1d96c40dc4 [cfe] Fix static extension field lookup
Lookup of the setter of an assignable static extension field loaded
from dill failed because the DillExtensionFieldBuilder didn't identify
itself as a field.

Change-Id: I379e0002ec8180b0ac1c5b1440bf9725a87e889e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168480
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-20 07:22:02 +00:00
Anna Gringauze f04bc85e4f Refined scope calculation in expression compiler
- make sure nested blocks scopes are visited
- make sure variable definitions do not leak beyond block scopes
- properly collect scopes for loops, if statements, constructors
- add calculation of fileEndOffsets for blocks
- save block file offsets to dill
  - update binary format version
  - change kernel readers and writers to read and write block offsets
  - change vm readers to read and block offsets for new version
- add missing fileOffsets and fileEndOffsets on functions for
  late fields
- add missing fileOffsets and fileEndOffsets on functions for
  extensions
- add errors on failures to find scope
- find libraries for private fields correctly
- add more expression compilation tests
- add test to verify fileOffsets and fileEndOffsets are set for
  SDK summary (will add full dill tests later)

Closes: https://github.com/dart-lang/sdk/issues/40278
Related: https://github.com/dart-lang/sdk/issues/34942

Change-Id: I5bc1bb645543045b689d8d61069ee77dc4ee9025
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167541
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-10-20 01:44:52 +00:00
Johnni Winther 354dcf4386 [cfe] Use origin location for member signatures
Change-Id: Iee3f79db7aa7600e9116e402d2d921308b07f8f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168203
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-10-19 15:34:17 +00:00
Johnni Winther 170f05f91b [cfe] Use CombinedMemberSignature for creating simple legacy member signatures
Change-Id: I0b13b7f7c3c3cc4f52ce6590e481f9f214e0dacf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168202
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-10-19 15:34:17 +00:00
Johnni Winther 13b7a83d57 [cfe] Use CombinedMemberSignature to create noSuchMethod forwarders
Change-Id: Ic265483d1788faf65c925ea0bba512310316b182
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168201
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-10-19 15:34:17 +00:00
Johnni Winther 87d3e03bf8 [cfe] Avoid transforming members in other classes to no-such-method forwarders
Change-Id: Ic4b5e914c1ab6ae2a3bef98e9d16a3a73f5a44d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168200
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-10-19 07:59:36 +00:00
Jens Johansen a9ddd4bb96 [CFE] Change Set-literal transformation from nested let to BlockExpression
Fixes #43756.

Change-Id: Ib126ba8b91ae0d0c222383b51418b3d9f730bcfe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168022
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-10-19 07:16:36 +00:00
Daco Harkes b13c37726c [cfe/ffi] Transformation changes for structs-by-value
Changes the kernel representation of structs in two ways.
1. `_addressOf` field of `Struct` gets type `Object` because it will be
   either `TypedData` or `Pointer` in structs by value CL.
2. Subtypes of `Struct` get a pragma `vm:ffi:struct-fields` which
   contains a const list of the native types of the fields of the struct
   which will be read in the VM to do compute the locations of structs
   in the target ABI.

Split off from https://dart-review.googlesource.com/c/sdk/+/140290/23
to make that CL smaller. That CL will no longer have changes to the
kernel representation of FFI code after this CL lands separately.

These changes are not consumed in the VM in this CL, but they are tested
by the expect files.

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

Change-Id: I5d3babd5be07f78c6d2bd80bbc1fd492c51bc01f
Cq-Include-Trybots: luci.dart.try:front-end-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167280
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-16 11:16:02 +00:00
Robert Nystrom 1e5f4ecc27 Add "service_2" to CFE's list of opted out directories.
Change-Id: Ic63216b195e620e6f5d1955e37370b49efc30f17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167920
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-10-16 06:35:11 +00:00
Johnni Winther 3e0975bdc4 [cfe] Add 'knownLibraries' to the ClassHierarchy interface
+ use Uri for checking library identity in widget cache.

Change-Id: I3b8fed3994ad587b8560a0d33defbb159ca003c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167743
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-15 16:31:06 +00:00
Johnni Winther a39f93cd4c [cfe] Add non-dill test for flutter issue 68092
This issue was fixed by https://dart-review.googlesource.com/c/sdk/+/167568

The added test would have hit the same problem without the use of .dill files.

Change-Id: I32e0a32da888b7136795e7f918f8363602aa8760
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167744
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-15 14:50:46 +00:00
Johnni Winther db98b69aea [cfe] Handle duplicate late fields
Flow analysis was failing on our encoding of duplicate late variables.
We add an invalid expression as the initializer on duplicate variables
and flow analysis was seeing this as if the late variable had (declared)
initializer. Changed to use the `hasDeclaredInitializer` flag on
VariableDeclarationImpl to bypass flow analysis in the synthesized
initializer.

Closes #43689

Change-Id: I483caa3bbc3347eb547826e9615a40fe62b586d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167741
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-15 13:16:06 +00:00
jonahwilliams 1f3c76ccdd [widget_cache] lookup framework Class on each run, expose isExtended method
Invalidations below the framework layer could lead to NPEs, since the framework class types will get
recreated. To ensure this doesn't happen, look them up each time.

Instead of checking the component for subtypes, use an isExtended API and the existing mixed in API to
get the same results. This should allow this check to work correctly with the new invalidation strategy.

Bug: https://github.com/dart-lang/sdk/issues/43760
Change-Id: I439c085540403e29083c74b2add642656b3fa0a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167441
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-15 08:58:53 +00:00
Johnni Winther 16f7ce8e57 [cfe] Warn on null aware access on this and static members
Closes #43703
Closes #43461

Change-Id: I861462b5fcf31d5459c17cbe1604ce285c359dec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167563
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-15 08:48:33 +00:00
Jens Johansen 2350776a1c [CFE] Don't continuously try to verify the platform libraries
This takes co19_2 tests from ~10 minutes to <3 minutes on my machine.

Change-Id: I98c27d0692b9279cf4c7d680cfa18c50b4ab5d6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167573
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-10-15 08:04:23 +00:00
Jens Johansen 7a8beb400d [CFE] Make the batch compiler actually reuse the platform
Running co19_2 tests on my machine goes from ~21 minutes to ~10 minutes.

Change-Id: I4b298d8d1d84c0812fa983b63badccc922df6511
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167572
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-10-15 08:03:43 +00:00
Johnni Winther aa329dc0d0 [cfe] Handle named parameters correctly in TypeBuilderComputer
Fixes https://github.com/flutter/flutter/issues/68092

Change-Id: I6420b6cd9285a6c1b048c8ce8b067bf2ee99c73b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167568
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-15 07:48:53 +00:00
Johnni Winther 9ce4f5dfec [cfe] Report distinct error codes in incremental_load_from_dill testing
This changes the reported failure from Crash to something more specific
to the encounter error, like ExpectationFileMismatch. Validation errors
for the .yaml file still produce Crash, and so does a couple of the
checks on Component integrity that were also used outside
incremental_load_from_dill_suite.dart

Change-Id: I48aa8cb25198d24e986b0f354db2b370dc9b8ac8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167565
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-10-14 21:21:48 +00:00
Ryan Macnak 37ed87b038 [vm, service, observatory] Bang Bang (My Type System Shot Me Down).
Port the service tests and Observatory to Dart 3.

Change-Id: I8a8b20d8f90acd3b5f741c93f10ba99971aa0c52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154825
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-10-14 18:16:27 +00:00
Johnni Winther b5fd660dd3 [cfe] Remove old_dills
A .dill file was accidentally committed by a previous CL.

Change-Id: I64f5e25f157bef58c71e18b3593bc0e463bc2537
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167566
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-10-14 12:27:48 +00:00
Jens Johansen 1accb303f2 [CFE] Fix enableNonNullableInLibrary to take opt out tests into account
Change-Id: I1f91b1bad2b2461cddc27ddfee8c813f69d79990
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167562
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-10-14 10:38:37 +00:00
Johnni Winther 73bbb6e008 [cfe] Handle scope patch-up for getter/setter/fields
Fields might be lowered to getter/setter pairs from source to
AST. This CL makes members able to show this for correct computation
of exports and handles scope patch-up when the relation isn't 1-to-1
between source and dill builders.

Change-Id: I5e4a711cd985730d320e582c3bd9d36602030992
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167320
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-10-14 08:23:57 +00:00
Johnni Winther d8e4cdd621 [cfe] Handle bounded type variables in extension inference
Handle #43177 for the CFE.

Change-Id: I89f475a6c5dca060b75688fd4c121ab09aed9c4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160524
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-10-13 14:32:28 +00:00
Jens Johansen b3ae203907 [CFE] Add hash-code to UnevaluatedConstants and add extra canonicalization for them
This gets rid of some of the weirdness about `UnevaluatedConstant`s.

Change-Id: I5e34dedd7ad4ad5ef57b3f27e17b456f5619e14d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167281
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-10-13 12:27:37 +00:00
Jens Johansen d60fd61614 [CFE] Add strong-test for weird behavior of unevaluated constants
Change-Id: I10029ec87904ea989c527ad0c0edc6ddac990bb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166857
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-10-13 10:34:43 +00:00
Anna Gringauze a8c727a61a Use types of parameters for expression compilation
- use parameter types passed to IncrementalCompiler.compileExpression
  for compilation of the synthetic function containing the expression
- updated expression compiler tests

Note: some expressions that previously compiled wouldn't now
Example:

** package:test/library.dart **

class TestLibraryClass {
  final int field;
  final int _field;
  TestLibraryClass(this.field, this._field);
}

** main.dart **

import 'package:test/library.dart';

void main() {
  var instance = TestLibraryClass(1, 2);
  print('$instance'); // Breakpoint here
}

Expression:

`instance._field`

Previously, the incremental compiler would compile the expression
to kernel due to the type of instance being Dynamic. That compilation
result made it impossible for dartdevc to generate correct code due
 to missing type information.

Now, the compilation will fail with "Getter isn't defined"
error. To properly evaluate private fields now, we would need
the CFE to support a special mode for expression compilation
where private fields from other libraries are allowed.

Closes: https://github.com/dart-lang/sdk/issues/43469
Change-Id: Id8015c5e334115a82049fb2d1725db54dd3ea3dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166925
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2020-10-13 01:44:02 +00:00
Jens Johansen 4e0d5feca6 [CFE] Skip re-evaluating unevaluated constants if there's still no environment
This CL stops trying to evaluate unevaluated constants if there's
(still) no environment, something that would happen before, e.g. if
there was something like this:
```
const original = String.fromEnvironment("original");
const copy1 = original;
const copy2 = copy1;
const copy3 = copy2;
const copy4 = copy3;
const copy5 = copy4;
```

Note that unevaluated constants only comes into play when there is
no environment.
Compiling a big internal app with dart2js takes the actual contant
evaluation part down from 8 point something seconds to 3 point
something seconds (-4662.67 ms +/- 537.29 ms, -54.4428% +/- 6.27357%)
and wall clock time (as reported by `/usr/bin/time -v`) down with
~9 seconds on the 8+ minutes run (-9.23 s +/- 6.70067 s,
-1.77065% +/- 1.28543%).
Maximum ram usage (`Maximum resident set size (kbytes)` reported by
`/usr/bin/time -v`) is down 700+ MB (-792367 +/- 364776,
-4.86424% +/- 2.23931%)

Change-Id: I1e1940a9e53de34cff2bcbd8eb938fdb23a22c83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166851
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-10-12 14:57:52 +00:00
Johnni Winther 1d6eac5ebf [cfe] Only use experimental release version when flag is not on by default
Change-Id: I06267c6d3f0e5abb289e25fde8098aa0e3bead34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166844
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-10-12 12:57:41 +00:00
Johnni Winther 7964e40429 [cfe] Ensure that source/dill export scopes match during incremental compilation
This fix the breakage found in https://dart-review.googlesource.com/c/sdk/+/166603/4 trying to update to the most recent package:collection

Change-Id: Ie71e97cc92d39dd121825447edf8460858c5156e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166846
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-10-12 07:55:41 +00:00