This improves performance of computing 'implemented' notifcations in
large workspaces (about 3000 files in the performance data below) and
multiple classes in the target file.
Here is data for switching between a file with a few classes, and file
with many classes. With this change it works about 10 times faster.
Before:
1537333173060 <= Computed implemented in 36 ms.
1537333173918 <= Computed implemented in 195 ms.
1537333174261 <= Computed implemented in 28 ms.
1537333175088 <= Computed implemented in 161 ms.
1537333175556 <= Computed implemented in 44 ms.
1537333176341 <= Computed implemented in 163 ms.
1537333176706 <= Computed implemented in 23 ms.
1537333177517 <= Computed implemented in 186 ms.
1537333177935 <= Computed implemented in 45 ms.
1537333178690 <= Computed implemented in 145 ms.
1537333179091 <= Computed implemented in 22 ms.
1537333179863 <= Computed implemented in 152 ms.
1537333180212 <= Computed implemented in 26 ms.
1537333181001 <= Computed implemented in 201 ms.
1537333181295 <= Computed implemented in 28 ms.
1537333182126 <= Computed implemented in 220 ms.
1537333182429 <= Computed implemented in 45 ms.
1537333183097 <= Computed implemented in 154 ms.
1537333183425 <= Computed implemented in 25 ms.
1537333184227 <= Computed implemented in 255 ms.
R=paulberry@google.com
After:
1537335150782 <= Computed implemented in 0 ms.
1537335151634 <= Computed implemented in 15 ms.
1537335152369 <= Computed implemented in 0 ms.
1537335153192 <= Computed implemented in 14 ms.
1537335153917 <= Computed implemented in 0 ms.
1537335154807 <= Computed implemented in 14 ms.
1537335155464 <= Computed implemented in 0 ms.
1537335156370 <= Computed implemented in 14 ms.
1537335157052 <= Computed implemented in 0 ms.
1537335157926 <= Computed implemented in 21 ms.
1537335158621 <= Computed implemented in 2 ms.
1537335159466 <= Computed implemented in 29 ms.
1537335160081 <= Computed implemented in 0 ms.
1537335160942 <= Computed implemented in 24 ms.
1537335161568 <= Computed implemented in 0 ms.
1537335162384 <= Computed implemented in 33 ms.
1537335162979 <= Computed implemented in 0 ms.
1537335163777 <= Computed implemented in 36 ms.
1537335164391 <= Computed implemented in 0 ms.
1537335165265 <= Computed implemented in 14 ms.
Change-Id: Ie80fa957104d394320d73306e6f506b30069a18b
Reviewed-on: https://dart-review.googlesource.com/75500
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Fixes#34167. This implements the Dart 2 mixin proposal
(https://goo.gl/KEKQyv) for DDC. When the mixin is applied, a class
is created for the application that extends the correct superclass
and has all of the instance members, so `super` works correctly.
This also fixes a few minor issues in Analyzer's (mostly complete)
implementation:
- InterfaceType.isObject now returns false for Dart 2 mixins.
- Least upper bound calculation recognizes mixins are not Object.
- Interface of the mixin now implements its superclass constraints.
- Mixin superclass constraints are checked against the superclass and
all previously applied mixins (if any); this keeps it working with
the subtype fix above, and also prevents a not-yet-applied mixin
from satisfying the constraint
The language_2/mixin_declaration tests were updated with a few minor
fixes now that we can run Analyzer/dartdevc to test them.
This change implements super mixins for DDC's Kernel backend (DDK)
too. This will be enabled once Kernel adds a flag to recognize which
Class nodes are mixins (vs normal classes).
Change-Id: Ib3c4fcb12de9988345e52d92931196828d8227c3
Reviewed-on: https://dart-review.googlesource.com/74965
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Before this change we used the whole AnalysisOptions.signature as salt.
This means that if two packages have different set of lints, they have
different options signatures, and so we have to parse and compute
unlinked data for SDK and all shared packages separately. But unlinked
data depends only on very small set of options, practically only on
parser options.
This improves performance on workspaces with many modules and empty
cache:
Before:
<= --- Analyzing in 36122 ms.
<= Computed implemented in: 50138 ms.
<= --- Analyzing in 47905 ms.
<= Computed implemented in: 55339 ms.
<= --- Analyzing in 45141 ms.
<= Computed implemented in: 60169 ms.
After:
<= --- Analyzing in 27957 ms.
<= Computed implemented in: 11645 ms.
<= --- Analyzing in 21378 ms.
<= Computed implemented in: 9439 ms.
<= --- Analyzing in 21719 ms.
<= Computed implemented in: 10546 ms.
Here "computed implemented" is computing subtypes of classes in the
open file - it required unlinked data for all files in all available
packages.
It also helps for full cache:
analysis: 6300 vs. 5700 ms.
implemented: 5700 vs. 3700 ms.
R=brianwilkerson@google.com, paulberry@google.com
Change-Id: I10dbc6d062617466ad5f35ae77bd1e58a6bb606c
Reviewed-on: https://dart-review.googlesource.com/75128
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This CL refactors the summary resynthesis tests similar to how
05ab41c99b refactored the summary
generation tests. It introduces the following classes:
- The interface `ResynthesizeTestStrategy`, defining the methods that
can be invoked by tests of summary resynthesis.
- An implementation of that interface:
`ResynthesizeTestStrategyTwoPhase`. This drives the summary
mechanism using the old two-phase summary API.
- Mixin classes `ExprBuilderTestCases` and `ResynthesizeTestCases`
containing the test cases themselves.
- Mixin classes `ExprBuilderTestHelpers` and `ResynthesizeTestHelpers`
containing helper methods used by the test cases.
There should be no functional change introduced by this CL, only code
motion.
Change-Id: Ifb84d4d2d8fa17bbc32b833b1f56af7e1217b5ae
Reviewed-on: https://dart-review.googlesource.com/75124
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
These tests were relying on some details of the summary representation
that are no longer present, namely the fact that function elements
appearing within initializers (including the synthetic function
element for an initializer) used to have inferred types associated
with them. The tests have been changed so that they exercise the same
functionality, but they use the inferred type of the variable directly
rather than going through the function elements.
Change-Id: I8e7733674bfa6f8e7f442ea04e7da702f3b11020
Reviewed-on: https://dart-review.googlesource.com/74922
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This test was previously assuming that variables requiring top level
type inference would have their body expressions encoded in the
unlinked summary; with one-phase summary generation this is no longer
the case.
Change-Id: I47b4f81926eb4bc667a201ba83673e3e0db4c8cb
Reviewed-on: https://dart-review.googlesource.com/74924
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
At some point this test regressed so that it no longer tested the
behavior it purported to test. The underlying behavior is correct;
the test just had to be fixed.
Change-Id: Ia54cb205b8f1a6062f4078009d24d865d70a6bac
Reviewed-on: https://dart-review.googlesource.com/74921
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
When this flag is enabled, we fail:
2 language_2/ tests;
25 Analyzer tests (mostly by 2 reasons);
0 Analysis Server tests.
There is a know problem: because unlinked summaries don't include
initializers for variables, we fail to recognize API changes related
to inferred types. I will fix this be computing API signatures from
pertinent tokens.
R=brianwilkerson@google.com, paulberry@google.com
Change-Id: I61734e96ee26b3e04027a103ccf6850695815127
Reviewed-on: https://dart-review.googlesource.com/74700
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Not all of the TypeParameterElementImpl constructors were setting it
anyway, and this was causing problems with one-phase summary
generation. It would have taken a lot of plumbing to make all the
constructors set it correctly; it's easier to just compute it on the
fly when we need it.
Change-Id: I99d2e79c98a8a1dfbfb4e7f1fe90490db779a955
Reviewed-on: https://dart-review.googlesource.com/74672
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Also fix a bug which was preventing type inference from being
performed on initializers that couldn't successfully be serialized to
the unlinked summary.
Change-Id: I270eaf6f1ff4140408353f24935c9eb60bfa9ee1
Reviewed-on: https://dart-review.googlesource.com/74671
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
In two-phase resolution these resolvers aren't needed, because the AST
is partially resolved in the process of reconstituting it from the
unlinked summary. For one-phase resolution we are just starting from
the raw unresolved AST so we need to resolve it fully.
Change-Id: I0068be592c61b6653806fa86ec30910ac8833294
Reviewed-on: https://dart-review.googlesource.com/74662
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>