Commit Graph

4770 Commits

Author SHA1 Message Date
Johnni Winther ce81216885 [kernel] Ensure that visitors don't implicitly returns null
This is in preparation to migrate package:kernel to null safety.
For the visitor interfaces to support non-nullable return types, the
implementations must avoid using `null` as return value in its base case.

TEST=Refactoring

Change-Id: Ie5e4153f8d3779d94957bb13b3d2d2a942040ff2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179760
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-09 09:46:46 +00:00
Dmitry Stefantsov d3f3cfd531 [cfe] Report cyclic typedef use in bounds of type parameters
Closes #43975.

Bug: https://github.com/dart-lang/sdk/issues/43975
Change-Id: Ia7e7b6c46d3c0d2eaa2e809008847d3f47897d2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182780
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-02-08 13:13:23 +00:00
Jens Johansen da4e3f4bbe [CFE] Textual outline requires ScannerConfiguration
The incremental compiler now passes the correct nnbd settings and
extension methods settings.

Change-Id: I89e6bad8af330c3c81f141c260b2325aca4a5bb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182630
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-08 12:10:27 +00:00
Dmitry Stefantsov 63737581f8 [cfe] Encourage the use of the const NeverType objects
TEST=Covered by existing test base.
Change-Id: Ie858bd5a765d71fa4095eab3373a6ecdb063b260
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183006
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-08 10:36:40 +00:00
Jens Johansen 23a841c463 [CFE] Add a reordering fuzzing step to the strong unit tests
This CL:
* Adds a "reordering fuzzing step", i.e. it tries to sort the fields,
  procedures etc in both ascending order and descending order
  to verify that there are on crashes and no changes in error vs
  no error. This has been tested on http://dartbug.com/34803
  before the fix landed.
* Introduces an attempt at "visiting the outline" of the "direct from
  parser ast".

Change-Id: Ic3f5a776839030bb48a35eeee8575b37c19be453
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182504
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-08 10:00:10 +00:00
Jens Johansen 801e3331df [CFE] Remove unused stuff 'metadata collector' and 'documentation comment'
Change-Id: I5826dca4e328752ceaa5b788f2d85669ceb1f0d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183008
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-02-08 09:46:20 +00:00
Johnni Winther 909c44cecf [cfe] Support dart2js and dartdevc targets in expectation tests
Change-Id: If087dfaf291f02812aa1191328a10ad2a5f135ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183007
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-08 08:30:20 +00:00
Paul Berry 93cd0cdd3b Parser support for generic annotations.
This CL updates the parser so that it allows annotations of the form:

    `@` <constructorDesignation> <argumentPart>

Where <argumentPart> can contain type arguments.  Previously this was
prohibited at parse time.

Generic annotations are still prohibited in the current language
version, but the error is now generated by the parser listener
(BodyBuilder in the case of CFE, AstBuilder in the case of analyzer);
this should open the door for future CLs to add support for generic
annotations when the `generic-metadata` experimental flag is supplied.

Bug: https://github.com/dart-lang/sdk/issues/44838
Change-Id: I90604f38bcb378fc798c5737e486fb26589d4d1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182668
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-05 20:57:18 +00:00
Sigmund Cherem 912005267d [web] rename suite dart2js -> web.
Change-Id: I46be49b2effec3e38a3dc44cd45cfe736f77fa78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182680
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-02-04 23:11:32 +00:00
Johnni Winther 6ce8d74761 [cfe] Add Function.futureValueType and serialize Let.fileOffset
Serializing Let.fileOffset supports positions in stacktraces resulting
from null aware expressions, like `if (o?.foo) ...` when `o` is `null`.

Adding Function.futureValueType supports the proper backend
implementation for the fix in
https://dart-review.googlesource.com/c/sdk/+/181303

Closes #44654

TEST=existing

Change-Id: Ie5939a248d3d8bf41388e8f435e4ba4195afeabd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182269
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-04 14:06:47 +00:00
Alexander Thomas c88171c8af [sdk] Bump version to 2.13
TEST=Presubmit tests and local builds
Change-Id: I1b15d60eced0cf3f422548eda75706609f6640cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182624
Commit-Queue: Alexander Thomas <athom@google.com>
Auto-Submit: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-04 12:10:17 +00:00
Johnni Winther 5a26dba0d4 [cfe] Add ExpressionGeneratorHelper.createVariableDeclarationForValue
This combines the creation of synthetic variables with registration
of the create variable in flow analysis.

The fixes the failing expectation tests that currently crashes with
assertion failures.

Change-Id: I0d581653775dab135abebdecd28c19c5712b8d88
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182562
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-04 10:54:52 +00:00
Paul Berry 0427342228 Add flag for generic metadata
See implementation plan PR:
https://github.com/dart-lang/language/pull/1417

Change-Id: Ib75026d7008d313f3dad94d9ccf47e341f945dc9
Bug: https://github.com/dart-lang/language/issues/1297
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182301
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-02-03 13:54:48 +00:00
Paul Berry a42244f73b Flow analysis: begin tracking non-promotion reasons.
This CL implements the core flow analysis infrastructure for tracking
reasons why an expression was not promoted.  It supports the following
reasons:

- Expression was a property access
- Expression has been written to since it was promoted

I expect to add support for other non-promotion reasons in the future,
for example:

- `this` cannot be promoted
- Expression has been write captured
- Expression was a reference to a static field or top level variable

These non-promotion reasons are plumbed through to the CFE and
analyzer for the purpose of making errors easier for the user to
understand.  For example, given the following code:

  class C {
    int? i;
    f() {
      if (i == null) return;
      print(i.isEven);
    }
  }

The front end now prints:

  ../../tmp/test.dart:5:13: Error: Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
  Try accessing using ?. instead.
      print(i.isEven);
              ^^^^^^
  Context: 'i' refers to a property so it could not be promoted.

Much work still needs to be done to round out this feature, for example:

- Currently the analyzer only shows the new "why not promoted"
  messages when the "--verbose" flag is specified; this means the
  feature is unlikely to be noticed by users.

- Currently the analyzer doesn't show a "why not promoted" message
  when the non-promotion reason is that the expression is a property
  access.

- We need one or more web pages explaining non-promotion reasons in
  more detail so that the error messages can contain pointers to them.

- The analyzer and front end currently only show non-promotion reasons
  for expressions of the form `x.y` where `x` fails to be promoted to
  non-nullable.  There are many other scenarios that should be
  handled.

Change-Id: I0a12df74d0fc6274dfb3cb555abea81a75884231
Bug: https://github.com/dart-lang/sdk/issues/38773
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181741
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 16:15:34 +00:00
Johnni Winther 91be638a56 Add support for --verbosity in bazel/kernel_worker
Change-Id: If1c1cd2feb1c5341c3b7631dfe12888ce7eac249
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182221
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-02 15:25:44 +00:00
asiva 34f9734b41 Revert "[cfe] Handle conditional await in CFE"
This reverts commit 14032a6209.

Reason for revert : Several customer flutter tests are failing because
of the change in behavior.

TEST=revert of previous CL.

Change-Id: Ia235aa93b9c81fbab066803dc0625856f93acceb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181860
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-02-01 23:41:01 +00:00
Dmitry Stefantsov 425e4dbe09 [cfe] Sort type variables topologically before building the bounds
Closes #44455.
Closes #34803.
Closes #42434.

Bug: https://github.com/dart-lang/sdk/issues/44455
Bug: https://github.com/dart-lang/sdk/issues/34803
Bug: https://github.com/dart-lang/sdk/issues/42434
Change-Id: I3be93b0d4a251de79c3bfe9829143f0fbec201ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181402
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-01 18:46:29 +00:00
Johnni Winther 019ce33409 [cfe] Don't handle synthesized as if they are declared in mixins
Members declared in mixins are treated as if these were declared in
the class where they are mixed in. This means that use their types as
declared types, instead of including them in a combined member signature.

This failed in the case where a member was synthetically added to the
mixin class, because the types of these we wrongfully be handled as
declared types.

We now skip all synthetic members when reasoning about mixed in members
as declared members.

Change-Id: I9c2311b4472fe16162fcdc4c56fce8db2d946f4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181201
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-01-28 09:39:50 +00:00
Dmitry Stefantsov 03e22f5fe4 Reland "[cfe] Pass variance through in ReplacementVisitor"
This is a reland of a212650da6

Original change's description:
> [cfe] Pass variance through in ReplacementVisitor
>
> Change-Id: I8dc9c1a77c5dfe70ad186bbd6254aaf5353aa0ca
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180900
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>

Change-Id: I8e7a6b8acb615c2793062751906830e870b8c513
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181203
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-01-26 17:50:09 +00:00
Dmitry Stefantsov cc1cc0bb57 Revert "[cfe] Pass variance through in ReplacementVisitor"
This reverts commit a212650da6.

Reason for revert: Regressions detected by the Dart CI bot.

Original change's description:
> [cfe] Pass variance through in ReplacementVisitor
>
> Change-Id: I8dc9c1a77c5dfe70ad186bbd6254aaf5353aa0ca
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180900
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>

TBR=dmitryas@google.com,johnniwinther@google.com

Change-Id: I678c9f013b1df9c7fe4da043fc1e1b19d3f24168
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181202
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-01-26 16:12:01 +00:00
Dmitry Stefantsov a212650da6 [cfe] Pass variance through in ReplacementVisitor
Change-Id: I8dc9c1a77c5dfe70ad186bbd6254aaf5353aa0ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180900
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-01-26 14:21:29 +00:00
Jens Johansen 6e191c11e5 [CFE] Rename 'verifySkipPlatform' to 'skipPlatformVerification'
Follow-up to https://dart-review.googlesource.com/c/sdk/+/180562

Change-Id: I242da8dc94109008d33611067b62f5352d52f454
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180565
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-25 10:19:52 +00:00
Dmitry Stefantsov 090b17fe99 [cfe] Don't run findTypeArgumentIssues twice
From the times where some of the type arguments should have been
reported as warnings, the procedure was run twice in two different
modes, in order to report some issues as errors and some as warnings.
This CL is a cleanup that invokes the procedure once.  Additionally, a
refactoring of the return value discipline is made: it always returns
a list and never returns null.  An empty list is returned if there are
no issues.

Change-Id: Id497216bf51f49c86517cf16a52f03da5b65b1fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180570
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-01-25 09:53:27 +00:00
Johnni Winther 14032a6209 [cfe] Handle conditional await in CFE
This converts `return e` in async methods in opt-in libraries into

   return let v = e in v is Future<FTV> ? await v ; v

where FTV is the future value type of the enclosing function.

Closes #44395
Closes #44396
Closes #44397
Closes #44399

TEST=existing tests

Change-Id: I59687039bfe4a97ffdaa55ac0f193ca4fb208f44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175310
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2021-01-22 19:12:24 +00:00
Johnni Winther 97a4280e52 [cfe,dartdev,dart2js] Add support for --verbosity option
In response to https://github.com/dart-lang/sdk/issues/44727

TEST=pkg/dartdev/test/commands/compile_test.dart

Change-Id: I56b67d9362a415acd721c1cce2f7e2232d2493df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180566
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-01-22 18:33:44 +00:00
Daco Harkes f74c9d43d3 [vm/ffi] Deprecate Pointer<T extends Struct>.ref generic calls
The analyzer and CFE now report a warning on calls to
`Pointer<T extends Struct>.ref` and `Pointer<T extends Struct>.[]`
where `T` is a generic.

Adapted from https://dart-review.googlesource.com/c/sdk/+/180190 to
only deprecate but not error out on generic calls to `.ref` and `[]`.

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

TEST=tests/ffi/vmspecific_static_checks_test.dart

Change-Id: I81353089d59f093730d63792e9dbcd0b2ff0c432
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180365
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-22 13:58:09 +00:00
Daco Harkes c3b30df798 [vm/ffi] Deprecate empty Structs
The analyzer and CFE now report a warning on subclasses of `Struct`
which have no native fields.

Adapted from https://dart-review.googlesource.com/c/sdk/+/180189 to
only deprecate, but not disallow empty structs.

Rolls `package:ffi` forward to migrate `Utf8` and `Utf16` to `Opaque`
to prevent tests from failing on those generating warnings for empty
structs.

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

TEST=tests/ffi/vmspecific_static_checks_test.dart

Change-Id: Ia364e31da66cb195570c2e2b729d03dd261f28a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180361
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-22 13:58:09 +00:00
Dmitry Stefantsov c1a401c5da [cfe] Implement weak mode constant canonicalization update
Closes #44641.
Closes #44246.

Bug: https://github.com/dart-lang/sdk/issues/44641
Bug: https://github.com/dart-lang/sdk/issues/44246
Change-Id: I78cb0514a57ab3adafb3639b09ea8930791da030
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179340
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-22 12:06:49 +00:00
Paul Berry 4ee861b7d0 Flow analysis: Track additional assigned variables information.
We now track the following additional information:

- All local variable reads and read captures (previously we only
  tracked writes)

- For any conditional expression (`?:`) or if-test, the variables
  written in the "then" branch

- For any logical and expression (`&&`), the variables written in the
  right hand side of the expression

Tracking this information will allow us to implement legacy type
promotion as part of _fe_analyzer_shared, using the same API as flow
anaylsis, which will in turn allow a lot of front end and analyzer
code to be removed and simplified.

Change-Id: I01aaf64cefb989a4450c8e6d3a8373c1ca2b6dec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179980
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-21 19:48:22 +00:00
Johnni Winther af283dedc2 [cfe] Handle Extension.fileUri in getLocationInEnclosingFile
Closes #44719

Change-Id: I5c277e869bf7d24c9db0f3f4b76640aae8a65b22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180181
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-01-21 08:01:23 +00:00
Johnni Winther 134a43707f [cfe] Update compiling without sound null safety message
In response to https://github.com/dart-lang/sdk/issues/44234#issuecomment-763455719

Change-Id: I88ab66199217e817edead394ccc74a3f3b49ba15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180143
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-01-20 15:53:25 +00:00
Jens Johansen 6971cddaed [CFE] Fix crash with experimental invalidation and factory with same name as procedure
A factory is saved as a procedure in kernel, and was thus also indexed
as a procedure for the purpose of experimental invalidation.
This caused trouble when having a "real" procedure and a factory with
the same name.
That is fixed by this CL by indexing factories ad constructors.

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

Change-Id: Ieef0421c29a61e26f2a7ee4bb4f196672afd8445
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180148
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-20 13:56:05 +00:00
Johnni Winther fabf3efda4 [cfe] Refactor ClassHierarchyBuilder to use Tuple for computation
Change-Id: I8055552313786814bde6f66214a013a8bedb2078
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177500
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-01-19 19:52:13 +00:00
Johnni Winther 34fb48bb8a [kernel,front_end] Migrate first wave of pkg/kernel and pkg/front_end
Migrates libraries dependent only on already migrated libraries.

Change-Id: I0e85ee8dbc2afce031b92e0009e71c206a55af28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179502
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-01-18 15:40:21 +00:00
Johnni Winther 04e8aa58ee [cfe] Remove rewrite_severity
+ fix last remaining 'deprecated_' method

Change-Id: Ib2c77f85114fdefcda174794ff3bfbe085a02797
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179700
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-01-18 13:05:59 +00:00
Paul Berry 75aea30724 Add an implementation of legacy type promotion to _fe_analyzer_shared.
The new implementation uses the same API as flow analysis.  This
should allow us to significantly simplify the CFE and analyzer, by
dropping their implementations of legacy type promotion in favor of
the shared implementation.

This CL just introduces the new implementation and unit tests for it;
it does not integrate it with the analyzer or CFE.  I will follow up
with a CL that does the integration.

Change-Id: Ie07b3b39604d6a022ad42f3ae6b648a317c8af28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179560
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-01-16 17:07:23 +00:00
Paul Berry c053638eb5 Don't promote this inside extension methods.
This fix addresses legacy code.  The corresponding null safety fix has
already landed--see
https://dart-review.googlesource.com/c/sdk/+/178920.

Bug: https://github.com/dart-lang/sdk/issues/44652
Change-Id: I1d546f59e2ce91256e8da419670cb151a8b6efd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178922
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-15 20:22:52 +00:00
Paul Berry f452e763e0 Add a class to represent references tracked by flow analysis.
The only references that are promotable are references to variables,
however in the near future I'll be adding logic to flor analysis to
keep track of attempts to promote fields; this will require tracking
references to property gets as well as references to `this`, so we
need to start building up data structures to track those references.

Bug: https://github.com/dart-lang/sdk/issues/38773
Change-Id: I0e3fd44f580bb85db3e8f405675b66aa4069e455
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179280
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-15 17:55:02 +00:00
Jens Johansen 989e42f189 [CFE] Incremental compiler and part as entry
This CL fixes the incremental compiler in the case where it gets a
part as an entry point.

Change-Id: I79f1735e0056f259500e2ef52d9b23047f2b812f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178999
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-15 15:23:18 +00:00
Johnni Winther cad04f8604 [cfe,dart2js,dartdev] Show null safety mode for dart compile
This adds a new messages kind 'info' to the CFE for showing general
information during compilation. A 'configuration' options is added
to `CompilerOptions` for telling the CFE how it is run.

The configuration 'compile' is added for when the CFE is invoked to
produces an "executable" as when running `dart compile`. When
configuration is set, the CFE emits an info message about the
null safety compilation mode.

Support for `dart compile exe` and `dart compile js` is added in this
CL. Support for `dart compile kernel|app-jit|aot` is not included.

In response to https://github.com/dart-lang/sdk/issues/44234

TEST=pkg/dartdev/test/commands/compile_test.dart

Change-Id: I08f51e2a3f5ad4841c4d703bcd266b7afb63c7c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178982
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-01-15 11:28:13 +00:00
Dmitry Stefantsov 0de9b16e7a [cfe] Give a hint on erroneous super-bounded types
Change-Id: Ifb4caaf8995f9f139fd24b4ae6e9c071a83459ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178240
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-14 16:25:23 +00:00
Johnni Winther e7b15e9486 [cfe] Add more late lowering helpers
Adds helpers for extracting original name of a lowered late field, the
original initializer and the field used to hold the value of the lowered
field.

This helps backends to customize late field encoding while still using
the lowering provided by the cfe.

Change-Id: Ib42af539efad84a08a6e32acd29d2efaff129cd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178989
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-01-14 12:46:52 +00:00
Paul Berry 10917ffd55 Don't promote this inside extension methods.
Bug: https://github.com/dart-lang/sdk/issues/44652
Change-Id: I05e5acfbff1d498fa3ad513d956510909ec7d24f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178920
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-13 16:48:08 +00:00
Alexander Markov 9d1a307954 [vm] Add specialized factory constructors for small list literals
Flutter gallery in release mode:
AOT snapshot size arm64 -0.22%, arm -0.21%
instructions size arm64 -0.46%, arm -0.4%

TEST=existing tests

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

Change-Id: I4733e91ecf4601c0bcde725cf9e97f5db0b8bc13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175821
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-11 19:32:30 +00:00
Dmitry Stefantsov cf8887bd7e [cfe] Update the conversion algorithm for checking super-bounded types
The update is specified in the following:
https://github.com/dart-lang/language/pull/1133

Change-Id: I2850b1acf7c94b8174c21cf899c9b926a03d9cc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175726
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-01-08 11:58:32 +00:00
Jens Johansen 5fac8d3d71 [CFE] Reproduction and fix of duplicate string-named 'abstract member-signature'
Before this CL, the map we use to "reuse" references when doing
experimental invalidation mapped from String to Reference.
In bug #44523 two abstract member-signatures have the same textual
(String) name meaning that via the lookup one would get the correct
one, one would get the wrong one, they would get the same one
which eventually causes a crash when trying to serialize.

This CL fixes the issue by mapping via the Name instead, which
basically - for private names - wraps the name and the library
which disambiguates it.

This CL also includes the reproduction of #44523.

Fixes #44523.

TEST=Mostly relying on existing test coverage.

Change-Id: Ib62ebca0b7f5092f0b8410d3c458663c3032eca1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177704
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-07 13:11:18 +00:00
Johnni Winther 80c307feb8 [cfe] Handle FutureOr<int> as context type for +
Closes #44595

Change-Id: I0631deb9d23b5e4a7618268b5e1f0f850bfd5ad9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177703
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-01-06 14:57:30 +00:00
Johnni Winther b4d4316de0 [cfe] Rename stub kinds
ForwardingStub -> AbstractForwardingStub
ForwardingSuperStub -> ConcreteForwardingStub
MixinStub -> AbstractMixinStub
MixinSuperStub -> ConcreteMixinStub

TEST=refactoring

Change-Id: Ice76a41ce8e1071f553ed8fd3ecbb29c97377161
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177129
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-12-29 16:54:55 +00:00
Johnni Winther 5ed4e5becd [cfe] Pass references instead of fields/procedures
TEST=refactoring

Change-Id: I6e2d46af9bd58673bda847ea5cf981616e1118b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176667
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-12-29 11:46:15 +00:00
Johnni Winther 60702d4158 [cfe] Make field assignability immutable
Changes fields to be either mutable or immutable by construction.
This ensure that we don't create setter references for fields that
cannot be assigned to and is a prerequisite for replacing @fields/
@fields= canonical names with @getters/@setters.

TEST=existing expectation tests and verification

Change-Id: I70b9a504ee6f221b7c334ac02620feb0d5f7ae01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176665
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-12-28 16:11:14 +00:00