Commit Graph

4895 Commits

Author SHA1 Message Date
Brian Wilkerson 2c82a400e8 Signal a static error when invoking a non-function (issue 34320)
Change-Id: Ida2998b44f52185fcd1d3be545004edff917f5ad
Reviewed-on: https://dart-review.googlesource.com/76560
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-09-25 20:52:35 +00:00
Konstantin Shcheglov 9185294e7a Reland: Implement inheritance/override checks from the spec.
Relands https://dart-review.googlesource.com/c/sdk/+/76061
Was reverted in https://dart-review.googlesource.com/c/sdk/+/76301

The difference with the original CL is that we don't look into
superclass and mixins of mixed-in for concrete members. This reduces
the number of errors in Flutter codebase to 1.


R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/34392
Change-Id: I86256b598d116439194cbaf4d09b4f72013d6563
Reviewed-on: https://dart-review.googlesource.com/76340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-25 18:51:04 +00:00
Paul Berry c23a9815ec Stop setting element model supertypes in TypeResolverVisitor when using new driver.
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>
2018-09-25 17:46:50 +00:00
Konstantin Shcheglov 17b3310400 Resolve bounds for type parameters of generic type alias.
R=brianwilkerson@google.com

Change-Id: Iff270adcd55d0a8c3a0bfaeed2c0741ccb1a1c77
Reviewed-on: https://dart-review.googlesource.com/76440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-25 17:21:04 +00:00
Brian Wilkerson a6b1a99f4c Make mixins abstract by default
Change-Id: I8ca672ac9d6acbb29ccea1bd41a617e0a870c74a
Reviewed-on: https://dart-review.googlesource.com/76303
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-09-25 15:45:07 +00:00
Konstantin Shcheglov d34337aa2d Ignore noSuchMethod() for the purpose of searching concrete member implementations.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/33553
Change-Id: Ie597cb4d39ba16e4503503b59d1e5179c594bad5
Reviewed-on: https://dart-review.googlesource.com/76200
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-09-25 02:37:03 +00:00
Konstantin Shcheglov e4eb2437b8 Look into superclassConstraints while searching for a member in interfaces.
R=brianwilkerson@google.com, paulberry@google.com

Bug: https://github.com/dart-lang/sdk/issues/34564
Change-Id: I11642d89710a89fb347106ff374ff0ea4227310c
Reviewed-on: https://dart-review.googlesource.com/76284
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-09-24 22:12:14 +00:00
Zach Anderson 95d37b0921 Revert "Implement inheritance/override checks from the spec."
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>
2018-09-24 21:27:34 +00:00
Konstantin Shcheglov 95b8a19a20 Mixin declarations don't have supertype, fix isMoreSpecificThan().
R=brianwilkerson@google.com, paulberry@google.com

Bug: https://github.com/dart-lang/sdk/issues/34563
Change-Id: I0edcc887694e895856cb262865b8ec61976bafad
Reviewed-on: https://dart-review.googlesource.com/76281
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-24 20:34:28 +00:00
Konstantin Shcheglov 58e44c1400 Don't use ClassElementImpl for now in override checking.
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>
2018-09-24 18:17:29 +00:00
Brian Wilkerson 95831136b4 Fix NPE when accessing superclass
Change-Id: I64da591bfa33a5202b7bd15de451be84330cc8bb
Reviewed-on: https://dart-review.googlesource.com/75403
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-09-24 17:11:23 +00:00
Konstantin Shcheglov 836a1d7a88 Implement inheritance/override checks from the spec.
This CL starts moving checks from strong-mode specific checker,
and old InheritanceManager into an implementation that is based
on the current spec, and avoids old baggage. It also fixes the issue
we were asked to fix for Dart 2.1.

Bug: https://github.com/dart-lang/sdk/issues/34392
Change-Id: Id5a23c5db7704b2b530bb894ae92628a08eaa70f
Reviewed-on: https://dart-review.googlesource.com/76061
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-24 16:28:50 +00:00
Mike Fairhurst d07039782a Remove redundant resolution
Change-Id: I4890a1dd86aa0cf87f90ba6427dc59aa0a14f75f
Reviewed-on: https://dart-review.googlesource.com/75992
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2018-09-24 16:17:00 +00:00
Paul Berry b540626589 Change DeclarationResolver to extend RecursiveAstVisitor<void>.
No change in functionality; all visit methods already return `null`.

Change-Id: I578fae62522f4b4f79e62e66bed9262cdcf1f33b
Reviewed-on: https://dart-review.googlesource.com/75994
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-09-21 22:41:38 +00:00
danrubel 52bec5e34b Update parser to find token on which to report the error
... before checking if the token is an ErrorToken

Also address comments in https://dart-review.googlesource.com/c/sdk/+/75960

Change-Id: Ia0d33e2f7879026d07937c6d709e23c9c14f5c16
Reviewed-on: https://dart-review.googlesource.com/75961
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-21 22:29:15 +00:00
Paul Berry 484405b1c8 Fix missing_return hint in _getInferredMixinType
Change-Id: Ie9aa833727f40a38bd6a69e027c2bbaf8d6dec72
Reviewed-on: https://dart-review.googlesource.com/75988
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-09-21 20:33:59 +00:00
Konstantin Shcheglov 1357778286 Issue 34546. Get ClassElementImpl a way that support element handles.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/34546
Change-Id: Ib14afd83db49cbcd3b9a5d6832689dec9dfd5c57
Reviewed-on: https://dart-review.googlesource.com/75986
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-21 20:14:09 +00:00
danrubel 7cd25705ab Fix parsing label between 2 switch cases
Fix https://github.com/dart-lang/sdk/issues/34453

Change-Id: Ib2280c4482b6530dab3947a0dfd87490bd379034
Reviewed-on: https://dart-review.googlesource.com/75960
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-21 19:36:40 +00:00
Paul Berry e9ff597673 Optimize gatherMixinSupertypeConstraints for new mixin syntax.
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>
2018-09-21 18:53:03 +00:00
Paul Berry ead158ab5d Fix gatherMixinSupertypeConstraints to handle named mixin applications.
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>
2018-09-21 16:37:55 +00:00
Paul Berry 46e5954b0a Turn on and fix mixin type inference checks when not in "supermixin" mode.
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>
2018-09-21 01:06:25 +00:00
Mike Fairhurst 0ec9945885 Fix #33629 boolean negation of void
Bug: 33629
Change-Id: Ieabd07cd7155b60466bf6873ba8252c9b5cb8d70
Reviewed-on: https://dart-review.googlesource.com/75784
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2018-09-20 23:58:48 +00:00
Paul Berry 9f72b09f0f Convert resolver.dart to triple-slash comment style.
Change-Id: I246fd1696da4b49cd97f4181aee57c16deda7907
Reviewed-on: https://dart-review.googlesource.com/75782
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-09-20 19:46:39 +00:00
Konstantin Shcheglov ee0a6033bf Fix checks for absence of concrete implementations of super-invoked members.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/34113
Change-Id: Iad8ce7f2b7787a5c9640df617d99129032f8eee4
Reviewed-on: https://dart-review.googlesource.com/75783
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-20 19:46:10 +00:00
Konstantin Shcheglov 3a5b748521 Optimize index data structure for search by supertype id.
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>
2018-09-20 19:15:07 +00:00
danrubel af2fd419fb Update more analyzer error codes to be generated from messages.yaml
Change-Id: I1d8a0db791309ac3551fc1079f91807e6e98dcb2
Reviewed-on: https://dart-review.googlesource.com/75603
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-20 18:10:04 +00:00
Dan Rubel 05ba85399f Cleanup fasta parser rewriter insert token methods
Change-Id: Ic776cae52cbfae4c1892884a6d9e179147c5396e
Reviewed-on: https://dart-review.googlesource.com/75760
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-20 17:00:41 +00:00
danrubel ffa99b9cde Update analyzer error code generation
This fixes error code generation when template contains a backslash

Change-Id: If14cbd07605eab454b00c6970d1e21349ac7a662
Reviewed-on: https://dart-review.googlesource.com/75602
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-20 16:54:58 +00:00
Konstantin Shcheglov 2455141018 Remove ClassElement.isSuperConstructorAccessible().
I don't see it used anywhere outside of Analyzer itself in internal
codebase. So, I think it is safe to remove.

R=brianwilkerson@google.com, paulberry@google.com

Change-Id: If5dafdaaa0f94cf280822418d99ed64060b66d4b
Reviewed-on: https://dart-review.googlesource.com/75562
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-20 16:28:13 +00:00
Paul Berry e3dbea9523 Convert declaration_resolver.dart to triple-slash comment style.
Change-Id: I91ba7c77963d0376211dbfb05ba4eeb998d2311b
Reviewed-on: https://dart-review.googlesource.com/75662
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-09-20 15:52:20 +00:00
Peter von der Ahé 06792cb91f Remove StackListener.popList
Change-Id: I0391b52a0be34c2cf61ac66e06c565e1f311182a
Reviewed-on: https://dart-review.googlesource.com/75680
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-09-20 14:15:16 +00:00
Paul Berry 2e3f17fa2b Add support for the new mixin syntax to supertype constraint checking and resynthesis.
Partially addresses #34404.

Change-Id: Ia115647c7e6e15092a7dca55287ff0680b780a97
Reviewed-on: https://dart-review.googlesource.com/75625
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-09-20 02:34:36 +00:00
Konstantin Shcheglov 41273507b2 Detect references to instance variables without declared type.
R=paulberry@google.com

Bug: https://github.com/dart-lang/sdk/issues/33976
Change-Id: Iea377061a784d73d41a4f77f10f74077f8797813
Reviewed-on: https://dart-review.googlesource.com/75623
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-19 22:40:03 +00:00
Konstantin Shcheglov bbe49524be Cache mapping from subtypes names to files where they are subtyped.
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>
2018-09-19 16:55:27 +00:00
Konstantin Shcheglov 81ce969060 Enable implicit constructors with optional parameters in mixin applications.
The spec changed in https://github.com/dart-lang/sdk/commit/63c6851dd01514e9d9e6cb96da0430e15b66d576

R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/34375
Change-Id: If7ba66d82fa4127cc6764d93f299790e8a862b42
Reviewed-on: https://dart-review.googlesource.com/75422
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-19 16:12:21 +00:00
Konstantin Shcheglov bbe83465ea Test that type of the ListLiteral with two different enums is inferred.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I7b0980008fe58a1b430f989af72fb04c0fb07c8c
Reviewed-on: https://dart-review.googlesource.com/75385
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-09-19 00:37:59 +00:00
Alexandre Ardhuin abb392fc0d add Pubspec.dependencyOverrides
Closes #34513
https://github.com/dart-lang/sdk/pull/34513

GitOrigin-RevId: 067b26fde3631f877a6a84453ab60702bd242142
Change-Id: I4eb6ec3567d6dabfbf0a5e69fe4c6094e3a22d04
Reviewed-on: https://dart-review.googlesource.com/75360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-09-18 20:17:06 +00:00
Konstantin Shcheglov dcabf2cb0e Test for mixin declaration isObject and tweaks for error verifier.
R=brianwilkerson@google.com

Change-Id: I902dfdaf5e39c457e2ff365dfdd6b8f4d830497f
Reviewed-on: https://dart-review.googlesource.com/75381
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-18 19:55:56 +00:00
Konstantin Shcheglov a27bafc306 Check that the concrete member in the class has same type as the super-invoked member in the mixin.
R=brianwilkerson@google.com

Change-Id: I985872d2eb5eaf7608b030b9803d664ad0878b04
Reviewed-on: https://dart-review.googlesource.com/75243
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-09-18 17:06:22 +00:00
Jenny Messerly 0496569f09 implement super mixins in dartdevc and fix a few issues in Analyzer
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>
2018-09-18 03:21:48 +00:00
Konstantin Shcheglov bd103ebc50 Store unlinked data with unlinked salt.
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>
2018-09-16 17:42:23 +00:00
Konstantin Shcheglov c5d77d1d8b Support mixins in more places in index and search.
R=brianwilkerson@google.com

Change-Id: I523726e1c7f5efa2d6e2f4b91204da3f14f181b6
Reviewed-on: https://dart-review.googlesource.com/75120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-16 17:40:16 +00:00
Konstantin Shcheglov ddcb8b7bb3 Remove unused SubtypeManager.
R=brianwilkerson@google.com

Change-Id: I4ec2bec51912817621361bf170257c6dfe972189
Reviewed-on: https://dart-review.googlesource.com/75123
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-16 02:27:14 +00:00
Nate Bosch 0f45b2e5c9 Fix spelling hexidecimal -> hexadecimal
Fixes #34460

Change-Id: I43ce8bbad9bfcc6b14c3a537ada84107e7bfaffe
Reviewed-on: https://dart-review.googlesource.com/74940
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2018-09-15 01:19:06 +00:00
Konstantin Shcheglov eb9687189d Compute unlinked API signatures without unlinked summaries.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I21c87f60d88716eb9c6b1d5e558bb17156daa598
Reviewed-on: https://dart-review.googlesource.com/74925
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-09-14 20:13:55 +00:00
Paul Berry 272473b77e Remove getters allowing access to all enclosing type parameter types.
These getters are private to the analyzer and not used by it.

Change-Id: I203af68124668244dd204bff0cf7a3de4de8e9cd
Reviewed-on: https://dart-review.googlesource.com/74967
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-09-14 15:22:24 +00:00
Konstantin Shcheglov cea39db6e2 Perform instance member inference for mixins.
The set of sets is not comprehensive, no tests for fields and accessors.

R=brianwilkerson@google.com

Change-Id: I105ed6b1d4b5836f61af9f8abe7fed7e7a6b8c59
Reviewed-on: https://dart-review.googlesource.com/74941
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-09-14 04:52:48 +00:00
danrubel 61096acab3 Improve analyzer/fasta error code matching
This addresses a comment in https://dart-review.googlesource.com/c/sdk/+/74600,
updates the "run fasta generate first" exception message,
and converts more Analyzer errors to be auto generated.

Change-Id: I9c98184d1b9fe642dab4d66fbcd961dc27dfa6f9
Reviewed-on: https://dart-review.googlesource.com/74900
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-13 21:03:47 +00:00
Dan Rubel 49da026e3e Report error for extends void type parameters
Change-Id: I634b836ea40199a1e7962b7d07ca9f5d1ef3f16a
Reviewed-on: https://dart-review.googlesource.com/74680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-09-13 20:27:56 +00:00
Konstantin Shcheglov 260ea4b591 Add an option to use one-phase summaries.
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>
2018-09-13 19:26:16 +00:00