It's not necessary (because these types are already set correctly by
the summary linker) and it causes incorrect behavior (because due to
issue #34579 the AST nodes don't always contain correct types).
This reduces the severity of #34579 by ensuring that the incorrect
types stay in the AST nodes and don't leak into the element model.
I'll leave that issue open to remind us to make a more complete fix.
Change-Id: Ibf39370d501b5e19c9dc75713f2c39ca732870d6
Reviewed-on: https://dart-review.googlesource.com/76441
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This reverts commit 836a1d7a88.
Revert "Don't use ClassElementImpl for now in override checking."
This reverts commit 58e44c1400.
Revert "large_class_declaration_test is slow now."
This reverts commit 56f6c52d58.
Revert "Add regression test for issue 34392."
This reverts commit ef7d144bc7.
Revert "Mixin declarations don't have supertype, fix isMoreSpecificThan()."
This reverts commit 95b8a19a20.
Change-Id: Icda9cf9091ef35acc8fd61ac5dc135b3717eba0a
Reviewed-on: https://dart-review.googlesource.com/76301
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
TBR
I'd like to land this for now, but I probably will reintroduce it a
bit later. The problem is that this again the same problem with
handles, and I don't want to make it into internal build as is.
R=brianwilkerson@google.com
Change-Id: I98c37b2c5dadf2d5450a536471fc002fc5b247d2
Reviewed-on: https://dart-review.googlesource.com/76221
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Since this method is only used to find supertype constraints that are
relevant for mixin inference, it can save its caller from doing extra
work by filtering out mixins that don't take type parameters.
Previously, we were doing that when supporting the old "--supermixin"
feature, but not when using the new mixin syntax.
The method has been renamed to
gatherMixinSupertypeConstraintsForInference so that it's less
surprising that it doesn't return *all* supertype constraints.
Change-Id: I33c5cf20bb4955a19ef0f7dc2425fefc26cf4d39
Reviewed-on: https://dart-review.googlesource.com/75983
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
In a named mixin application, the superclass doesn't include the last
type appearing in the "with" clause, so that class isn't considered a
superclass constraint.
Fixes some test cases broken by 46e5954b0a.
Change-Id: I2e824d38017fe2c7eaa23e8f185cea07fe2222b7
Reviewed-on: https://dart-review.googlesource.com/75940
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Now that we have an explicit syntax for mixins that is available all
the time, we have to do mixin inference error checking all the time,
not just when the "--supermixin" flag is supplied.
This required fixing several minor bugs:
- ErrorVerifier._checkForMixinSuperInvokedMembers did not properly
handle a mixinElement argument that was a ClassElementHandle.
- ErrorVerifier._checkMixinInference wasn't using the actual
substituted mixin types, causing errors to be wrongly reported when
a class declaration had multiple inferred mixins (this was the root
cause of #34404).
- Type names in "with" clauses in the resolved AST weren't properly
reflecting the mixin type arguments that had been inferred.
Fixes#34404.
Change-Id: Ia773233c66f8d9ab778f207689c73922e9e3a880
Reviewed-on: https://dart-review.googlesource.com/75792
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
So, instead of iterating over all subtypes and checking their supertypes
in string lists, we encode the supertype string id into int once, and
search for it in the denormalized supertype list.
This helps for files with really many classes and subtypes, such as
element.dart and as.dart (both interfaces, not implementations).
Before:
1537403233979 <= Computed implemented in 803 ms.
1537403239426 <= Computed implemented in 2518 ms.
1537403241893 <= Computed implemented in 811 ms.
1537403247675 <= Computed implemented in 2523 ms.
1537403249835 <= Computed implemented in 802 ms.
1537403255796 <= Computed implemented in 2478 ms.
1537403258396 <= Computed implemented in 809 ms.
1537403264560 <= Computed implemented in 2526 ms.
1537403267010 <= Computed implemented in 814 ms.
1537403274513 <= Computed implemented in 2491 ms.
R=brianwilkerson@google.com, paulberry@google.com
After:
1537415241048 <= Computed implemented in 421 ms.
1537415244042 <= Computed implemented in 873 ms.
1537415246189 <= Computed implemented in 402 ms.
1537415249342 <= Computed implemented in 853 ms.
1537415251478 <= Computed implemented in 420 ms.
1537415254756 <= Computed implemented in 877 ms.
1537415257278 <= Computed implemented in 492 ms.
1537415260514 <= Computed implemented in 864 ms.
1537415262864 <= Computed implemented in 421 ms.
1537415266170 <= Computed implemented in 888 ms.
Change-Id: I00e3b8d11ecc7da93816bc5575b7b79b91535d50
Reviewed-on: https://dart-review.googlesource.com/75631
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
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>
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>