Commit Graph

4770 Commits

Author SHA1 Message Date
Jens Johansen c37ca05357 [CFE] Plug memory leak in incremental compiler
This CL adds a non-test, "incremental_dart2js_tester.dart" that via the
incremental compiler compiles dart2js, and then invalidates every file
one by one.

This caused a lot of memory usage and leaks was found and plugged.

Memory usage before:

  3.5e+07 +----------------------------------------------------------------+
          |      +      +       +      +      +      +       +      +      |
          |                                          *   **  **VS********* |
    3e+07 |-+                                       **  *** ******** *** *-|
          |                                     *  *** ** *** *** *      * |
          |                                 ** ***** ***   *             * |
  2.5e+07 |-+                               *******   **                 *-|
          |                             ** ****  *                       * |
          |                          * *****                             * |
    2e+07 |-+                     * **** **                              *-|
          |                    ****** *                                  * |
  1.5e+07 |-+               ****** *                                     *-|
          |               ***** *                                        * |
          |             *****                                            * |
    1e+07 |-+        *****                                               *-|
          |       *****                                                  * |
          |    *****                                                     * |
    5e+06 |-+****                                                        *-|
          | ***                                                          * |
          |**    +      +       +      +      +      +       +      +    * |
        0 +----------------------------------------------------------------+
          0     100    200     300    400    500    600     700    800    900

(i.e. it peeks at about 30 GB of ram usage)

Memory usage now:


  1.6e+06 +----------------------------------------------------------------+
          |      +     +      +     +      +     +      +     +  *   +     |
  1.5e+06 |-+                        *        *      *    *    VS* *******-|
          |                    *  *  ** **    *      *    *      *         |
          |                *** *  *  ** **    *      *    *      *         |
  1.4e+06 |-+*  * * *  *   *** *  *  *****    *      *    *      *       +-|
          |  *  * * *  *   *** *  ** *****    *  ************************  |
  1.3e+06 |-**  *** ** *  **** ***** *************************************-|
          | ******* ** *  ********** **** ******************************** |
          |****************************** **********                       |
  1.2e+06 |*********************                                         +-|
          |*****************                                               |
  1.1e+06 |**** *                                                        +-|
          |**                                                              |
          |*                                                               |
    1e+06 |*+                                                            +-|
          |*                                                               |
   900000 |-+                                                            +-|
          |                                                                |
          |      +     +      +     +      +     +      +     +      +     |
   800000 +----------------------------------------------------------------+
          0     100   200    300   400    500   600    700   800    900   1000

(i.e. it peeks at about 1.4 GB of ram usage)

Change-Id: I22f8d9e935dec1e50baa2cbd7ac5724880d6c886
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125344
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-11-15 13:52:35 +00:00
Johnni Winther 8e176998b4 [cfe] Support late lowering of instance fields
Change-Id: I9e9261efa9c0b09aa95a083496e8073c56498a38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124987
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2019-11-15 13:29:45 +00:00
Johnni Winther 09d75d94e7 [cfe] Avoid use of #isSet# field on non-nullabel late fields
Change-Id: I8dd77ee3eb1401ab29c87d303bdcface1d4d823e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124691
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-11-15 13:29:45 +00:00
Johnni Winther 45996ee170 [cfe] Add late field lowering for static/top-level fields
Change-Id: I16625257251b0badbcdfc1c9504899421db8b83f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124681
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-11-15 13:29:45 +00:00
Johnni Winther 49aaed295f [cfe] Refactor field type inference
This prepares for late field lowering by decoupling the field type of a
FieldBuilder from the type of FieldBuilder.field.type.

Change-Id: I0c38f6cb473db81c7fa72c617dadc3563ab12eb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124660
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-11-15 13:29:45 +00:00
Sigmund Cherem a75ffc8956 Add non-NNBD language version marker to all sdk (non-nnbd) files
This is practically a copy of the change in
https://dart-review.googlesource.com/c/sdk/+/118040 but applied to the non-nnbd
sdk.

Even though there is no intent to run the non-nnbd sdk with the non-nullable
experiment, we need to add this annotation because of how we
intend to gradually start testing NNBD. The libraries.json under
sdk_nnbd is allowed to point to libraries under the non-nnbd sdk in order to
temporarily build without errors until all patch files are migrated and all CFE
issues are addressed.

Change-Id: I53c1123a8d86c10695832a8a0ad35adb7b4d92fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125181
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2019-11-15 00:22:47 +00:00
Johnni Winther ef5fb7d3f4 Revert "[cfe] Use StaticTypeContext for getStaticType" and more
This reverts commits
 "[cfe] Use StaticTypeContext for getStaticType"
 45033c6ad9

 "[cfe] Move caching of thisType to CoreTypes"
 fab25cbe0c

 "[vm/bytecode] Notify static type context when entering/leaving library"
 c9f88ae253

Change-Id: I6171f6a74b97f2f4a77a36c242330fc2db94c82f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125341
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-11-14 22:51:43 +00:00
Dmitry Stefantsov fab25cbe0c [cfe] Move caching of thisType to CoreTypes
Closes #38225.

Bug: http://dartbug.com/38225
Change-Id: I0274bc390ca2d098896f578ea7ddf65527d82027
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124325
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-11-14 16:01:26 +00:00
Johnni Winther 6e85f3337a [cfe] Support null-aware cascade
Change-Id: I1db4125b4469e6a8b6adc5ec6e4dcafc0a26da4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124680
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-11-14 12:39:16 +00:00
Johnni Winther 45033c6ad9 [cfe] Use StaticTypeContext for getStaticType
Change Expression.getStaticType to take a StaticTypeContext instead
of a TypeEnvironment.

The StaticTypeContext provides access to the TypeEnvironment and the
current 'this type' as well as determining the nullability state of the
enclosing library.

This change is needed to support nnbd types for getStaticType and also
serves as a step towards supporting caching during static type
computations to avoid repeated computations of the same (complex)
expressions.

Change-Id: Ied974dff7f6f7c3c8f262aa80c8dea5c674662f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124683
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-11-14 09:09:26 +00:00
Robert Nystrom cd22f16f0b Fix crash when building //utils/dartdevc:dartdevc_kernel_sdk.
That build step still *fails* because of other static errors in the
migrated corelibs + patch files, but it no longer *crashes*.

Change-Id: Ia763a13bd45cecb148e02ce22d4ed2cc6fdfdfa8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125002
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-11-13 10:34:29 +00:00
Johnni Winther f443bc918e [cfe] Add tests for inheritance from opt-out libraries
Change-Id: If139945dfdd808da0c24ac550ecfa235b41d3c23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123737
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-11-13 10:08:08 +00:00
Johnni Winther d4f1512e00 [cfe] Support forEffect and readOnlyReceiver in IndexSet
Change-Id: I17aeac01ad4330fe873e7fe693fd2fd6e427d120
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124986
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-11-13 08:50:57 +00:00
Jens Johansen 7ebc820ffc [CFE] Also guard _extensions for LazyScope
Change-Id: Iaf55ad1602d6c6f70cc56899114e668de199c471
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124982
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-11-12 12:06:58 +00:00
Johnni Winther 4a661e19e2 [cfe] Remove type_promotion_look_ahead_listener.dart
This experiment isn't used.

Change-Id: I8a45283182e361f6fc69f586346e01913b83560a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124686
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-11-11 11:51:57 +00:00
Jens Johansen cf2a474438 [CFE] Fix incremental serialization bug caused by missing parameter passing
When implemention the incremental serializer, I forgot to pass it on in
the incremental kernel generators "IncrementalKernelGenerator.fromComponent"
and only did it in "IncrementalKernelGenerator", meaning that when using
"IncrementalKernelGenerator.fromComponent" the incremental serializer wasn't
used properly, namely nothing got invalidated.
Now it gets passed correctly, things get invalidated and everything should
be fine.

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

Change-Id: Ic2e7f7330dc6ee62dd8e7bf6684d7bee8ee328bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124684
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-11-11 09:40:42 +00:00
Johnni Winther 9c983d2ee3 [cfe] Support extensions via prefix
Change-Id: I6c1e69e5a5c83f5177754a350f5efbca9384972b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124540
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-11-08 19:53:00 +00:00
Johnni Winther fd9f79c25d [cfe] Handle deferred explicit extension access
Change-Id: I53e13ac3b4f1bdcd26ccec86814fb4d708c5cceb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124542
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-11-08 14:19:47 +00:00
Kallen Tu 54d7b0307b Refactor type_inference_engine and take type parameter variance into account for contra. checks.
This change will optimize code generation for contravariant checks on
variantly sound type parameters. We avoid emitting `_check()`s.

This will also add the change to ensure that reified types of torn off
methods are correct.

Change-Id: Ic7a4aa8f92b5e3489f7cd590070772358ef2c84b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124108
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-11-07 18:43:19 +00:00
Jens Johansen 8a1c328852 [CFE] Don't save and reset Library.isExternal for modular incremental compilation
Change-Id: I4fb1a7eb66717c856ee6eeb9ee5e06408931bd94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123728
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-11-07 13:37:17 +00:00
Dmitry Stefantsov b4554c1215 [cfe] Make nullability a required parameter for types
Change-Id: Id787291294cafb15cf4ecad4a9db9da4c6066638
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124135
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Auto-Submit: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-11-07 13:24:47 +00:00
Dmitry Stefantsov 6d7cfa2a72 [cfe] Verify nullabilities correspond to opted-in status of the library
Most types in opted-out libraries should be legacy (with few exceptions,
such as Null or dynamic).  All types in opted-in libraries should not be
legacy.

Change-Id: Ib595eeae0e76cdbf53ffd92313d429d8381f9786
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124320
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2019-11-07 12:21:46 +00:00
Jens Johansen ea9242c0ca [CFE] Refactor InferenceVisitors defaultExpression switch
Remove the switch; create a acceptInference implemented by all the
InternalExpressions instead.

Change-Id: Ib58362fee88e5dde8f1331b51e9eece209936f6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124321
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-11-07 12:02:46 +00:00
Aske Simon Christensen c504476dc4 [CFE] Extend verifier to check constants.
Add a flag to the verifier that tells it to assume that full constant
evaluation has been performed. It will then complain about anything
that should not be there after constant evaluation.

Also fix two bugs exposed by the new checks:
- The constant transformer did not visit annotations on type parameters
  in function nodes.
- The InstanceCreation constructor did not set the parent pointers of
  its children.

Change-Id: Ieef865a51892918e524da973b0cbaf52ed467181
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123400
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2019-11-07 09:53:26 +00:00
Johnni Winther 462a448ac8 [cfe] Integrate definite assignment, nullability and type promotion analysis
Currently not handled: null-aware and break/continue

Change-Id: I61b3ef92c974a2e98a010e091ba81cbefa0f6069
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124127
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-11-06 12:28:52 +00:00
Dmitry Stefantsov 24f1f313a2 [cfe] Implement the rest of the NNBD-aware subtype relation
Closes #38673.

Bug: http://dartbug.com/38673
Change-Id: I83fd29be0b6b74b8238a8a07c60d95365871c955
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124132
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-11-06 11:00:21 +00:00
Jens Johansen 37d14ad2ce [ddk] Don't use Library.isExternal (second try)
We're deprecating kernels Library.isExternal as it wasn't used for
what it was originally intended. It will hopefully go away entirely
soon.

This reverts commit 689447d0fb and fixes
the reason for the revert.

Change-Id: I122b5b777a2bf7316fde48e034fa3c566458a0cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124133
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-11-06 10:05:07 +00:00
Johnni Winther e1f19de968 [cfe] Add MemberBuilder.read/write/invokeTarget
Change-Id: Ib0cb9bc8059bfca2558b5a6828fc24109a404c79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124126
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-11-06 07:27:47 +00:00
Johnni Winther 239ff1408d [cfe] Add MemberBuilder.buildMembers
This generalizes the support for building several members from a single
MemberBuilder. This is needed to support late-field lowering directly
in the body builder.

Change-Id: Ifa3136dff461528667ca0a09410fc43cb4d6de83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123736
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-11-06 07:27:47 +00:00
Kallen Tu 11b1433756 Allow downwards inference of sound constructor calls.
Change-Id: Iffe2c6c052cfba40000c0325f5f1fd4ce9b51b9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123941
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2019-11-06 00:30:07 +00:00
Kallen Tu 9ba71b0fdd Modify local inference to generate constraints with respect to variance.
Change-Id: Ia746ea1bb37736d06a5e478f1fddf3e985eb16a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123560
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-11-05 17:54:13 +00:00
Vijay Menon 689447d0fb Revert "[ddk] Don't use Library.isExternal"
This reverts commit 48ebcdac5f.

This is breaking on internal code.

Change-Id: I9a89267d57b7cbfe94a023ca99e919cfa4ba4573
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124162
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
2019-11-05 16:15:15 +00:00
Jens Johansen 48ebcdac5f [ddk] Don't use Library.isExternal
We're deprecating kernels Library.isExternal as it wasn't used for
what it was originally intended. It will hopefully go away entirely
soon.

Change-Id: I3a4537ab566152555095df7461516f110a533896
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123722
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2019-11-05 08:37:51 +00:00
Jens Johansen f91ef3afd7 [kernel] Deprecate Library.isExternal
We're deprecating kernels Library.isExternal as it wasn't used for
what it was originally intended. It will hopefully go away entirely
soon.

Change-Id: If363c50af5607febae68865875af452c106fff85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123721
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-11-04 09:24:02 +00:00
Johnni Winther 523e9ffa88 [cfe] Add EqualsExpression, BinaryExpression, UnaryExpression and ParenthesizedExpression
Change-Id: Ida185b192c329f21979f6d5fbf39aa17ef1b9c0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123409
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-11-02 12:33:44 +00:00
Johnni Winther a996783de5 [cfe+analyzer] Move StackListener to _fe_analyzer_shared
Change-Id: I7e0ebef15b904afc14ed3b1c0f72cde5389d9c59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123730
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-11-02 11:21:49 +00:00
Paul Berry 2ad5af1e13 Move resolve_relative_uri.dart into _fe_analyzer_shared
Change-Id: I2d9cc3988fd16ce1aabd6881c825d1917bb16848
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123861
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-11-01 13:54:22 +00:00
Paul Berry c4b6df5009 Move ID testing infrastructure into _fe_analyzer_shared.
Change-Id: I9f2692dbe750f3c31f8c86e86fe732f34e166517
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123860
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-11-01 12:39:00 +00:00
Johnni Winther 3e5b3b15a0 [cfe] Add the initial functionality of reachability analysis
Change-Id: Ifbd73805b1f7ecba12c68c760b6adccde2313cbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123720
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-11-01 12:08:30 +00:00
Paul Berry 6ea11a8b64 Decouple colors.dart from CompilerContext
We're going to move this file into _fe_analyzer_shared, so we can't
have it importing CompilerContext.  It turns out that we were only
using it to cache the decision of whether to display colors, and to
decide whether to verbosely explain how we made that decision.  Those
can be accomplished in other ways.

Change-Id: If1e3a9fee7c0ca919444d8429936045b8408c246
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123840
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-11-01 11:24:20 +00:00
Johnni Winther 00c2962db8 [cfe+analyzer] Move messages, scanner and parser to package:_fe_analyzer_shared
Change-Id: I4fa87aee65f30a9868a6cf8f0342591869ece7ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123663
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-11-01 09:37:57 +00:00
Kallen Tu 550985189c Added errors for variance positions in fields.
When an explicitly defined type variable is used in an incorrect
variance position in a (final/non-final) field, an error is emitted.

Change-Id: Id1af7bdcd9adfe0c94ee76612c58ff63d011a1fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122881
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2019-10-31 21:29:39 +00:00
Kallen Tu 94e312f7a6 Added errors for variance positions in method members.
When an explicitly defined type variable is used in an incorrect
variance position in a method (whether in the return or the
parameters), an error is emitted.

Change-Id: I7e49687579bb2ce6e293b052b657b98741cb04f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122740
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-10-31 18:26:43 +00:00
Jacob MacDonald 4551080062 Add retry logic for incremental compiler initialization.
Problem:

We have been having a lot of reports of failures when initializing the incremental compiler
(see https://github.com/dart-lang/sdk/issues/38102).

These appear to be the result of empty kernel files but we have added other logic to check
for that when kernel files are written, which has had zero reports of throwing from users
(https://github.com/dart-lang/build/pull/2387).

We also use the same mechanism for temp directory management as we did with analyzer, but only
see this problem with the switch to kernel, and specifically the incremental compiler.

Solution:

Add retry logic and see if that fixes the problem. Any time there is a retry log a warning
so that we don't just silently do retries all the time.

This is a general defensive mechanism to cover a broad spectrum of potential failures with the
incremental compiler in the wild. I don't intend to remove it as it isn't harmful, and the
warning logs should be enough to encourage issues to be filed if it is happening often.

I have no direct reason to believe this will actually solve the particular linked problem other
than that we only see this issue when the incremental compiler is enabled.

Bug: https://github.com/dart-lang/sdk/issues/39122, https://github.com/dart-lang/sdk/issues/38102
Change-Id: Iaabb4497d6da69684692c1d7b9c030c59ebc6072
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123001
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2019-10-31 16:57:44 +00:00
Johnni Winther 6b61050d9c [cfe+analyzer] Split generated message files into shared and cfe-only
Change-Id: I71dff57403d236f6186d7e1b5fa01fa7149fd0f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123661
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-10-31 14:39:04 +00:00
Paul Berry 5b4612bc68 Move front_end/lib/src/base/errors.dart into _fe_analyzer_shared package.
Change-Id: I9369e8dbf7b5d6fff9ad2a74346871b3e274e8ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123640
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2019-10-31 13:05:53 +00:00
Paul Berry 499815842c Create a package to hold code shared between front_end and analyzer.
Previously such shared code was in the front_end package, but that
created problems because there is a lot of code in front_end that
isn't intended to be shared with the analyzer (including, notably, the
dependency on kernel).

This CL just moves over the flow_analysis logic to the new shared
package.  Follow-up CLs will move over other shared logic and tests.
The end goal is that the analyzer package will no longer have a
dependency on front_end.

Change-Id: I5642d6565204422d79808ca47648462db85e442a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123624
Reviewed-by: Jens Johansen <jensj@google.com>
2019-10-31 13:05:53 +00:00
Johnni Winther d76ffbc149 [cfe] Handle assigned variables in for and for-in
Change-Id: I06deda7f017dcd40e5c6987c61261cf3be2be0ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123410
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-10-31 11:36:43 +00:00
Dmitry Stefantsov 2897bebdef [cfe] Resolve serialization mismatch due to variance computation
Change-Id: Id38c63f5bd659f21423d802fd6180aa04465712c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123406
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2019-10-31 10:15:29 +00:00
Kallen Tu 44641fbd61 Added variance support in bounds inferencing.
Change-Id: Id3d05445491650642c40ac8d9b1ecf58162c56f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122485
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2019-10-30 20:35:23 +00:00