Commit Graph

7128 Commits

Author SHA1 Message Date
Konstantin Shcheglov 2784473939 Fixes and tests for quick fixes in mixins.
I hit an exception in Analysis Server, so looked at it and related places.

R=brianwilkerson@google.com

Change-Id: Ife9bac50f8ea16aa0a092de0fdbc74c0c1534b23
Reviewed-on: https://dart-review.googlesource.com/c/82700
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-11-02 18:56:49 +00:00
Konstantin Shcheglov 0eb0fd0c8e Avoid using resourceProvider.convertPath() where possible.
R=brianwilkerson@google.com

Change-Id: Ie0969ef41e2afaa8f7f8b25af1422ea26a509d79
Reviewed-on: https://dart-review.googlesource.com/c/82662
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-11-02 17:53:50 +00:00
Sam Rawlins feba863557 Import path as p, in Workspace impl libraries
In package_build.dart, there are several spots (builtFile(),
builtPackageSourcePath(), ...) where `context` is called, in cases
where I imagine the author thought there was a class member at hand
(as is the case with PackageBuildPackageUriResolver), but these
locations are actually using the top-level const `context` from the
path package.

I think it is super confusing to have class members, and local
variables, that shadow an imported top-level const. Better to import
with a prefix.

Additionally, I unified relative/absolute checking in these files as
assert() calls, with helpful messages.

Change-Id: I6d409636dab41959cabf392c80f64c4ec5270f7b
Reviewed-on: https://dart-review.googlesource.com/c/82560
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-02 16:44:07 +00:00
Konstantin Shcheglov e3c8774543 Add AnalysisSession.analysisContext, stop using AnalysisDriver's AnalysisResult outside the driver.
Change-Id: I63138e002d9e777f51d2d843f7ef2b1f32fed3e0
Reviewed-on: https://dart-review.googlesource.com/c/82529
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-11-02 14:16:31 +00:00
Konstantin Shcheglov ef91571cb8 Add ParsedLibraryResult, getParsedLibrary, getResolvedLibrary to AnalysisSession.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: Ia48233b0d72dd0a0673a6ca15817881feca7d26c
Reviewed-on: https://dart-review.googlesource.com/c/82471
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-01 21:25:35 +00:00
Brian Wilkerson c4b50c7dda Remove another use of the old AnalysisContext
Change-Id: I6e675f2ae7b6884ce6cf4ef84fce54718913ae93
Reviewed-on: https://dart-review.googlesource.com/c/82521
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-11-01 21:02:35 +00:00
Brian Wilkerson 66a12140c7 Delete unused support for dealing with packages
Change-Id: I9cf325693703c04f2fbda143c7c666dc41af9e3d
Reviewed-on: https://dart-review.googlesource.com/c/82466
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-11-01 20:40:39 +00:00
Konstantin Shcheglov 5711a1d539 Move implementations of analysis results into src/results.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I7527dfb597ff54802517093b4aa526b14e7b705c
Reviewed-on: https://dart-review.googlesource.com/c/82461
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-01 16:11:23 +00:00
Brian Wilkerson dee5e8a070 Convert more classes to mixins
Change-Id: I85bee426236a510305fc38a49b2f9348af7698df
Reviewed-on: https://dart-review.googlesource.com/c/82181
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-31 13:49:51 +00:00
Konstantin Shcheglov 2bb3dcf5df Add getResolvedLibrary() to AnalysisDriver.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I43fdf62bd6bb4c02e4b0cf97e324e6ca17c5d86c
Reviewed-on: https://dart-review.googlesource.com/c/82140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-10-30 19:30:12 +00:00
Brian Wilkerson 298d22f4ab remove async parse method
Change-Id: I7a2e633b43283221790fb88a12065fed3dcdabb7
Reviewed-on: https://dart-review.googlesource.com/c/82120
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-30 19:26:00 +00:00
Konstantin Shcheglov 028ac52180 Enum values are always computed, compute even implicit null values of default parameters.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I448c0b9d4314fb7f317830087dfe4a30fd4159d0
Reviewed-on: https://dart-review.googlesource.com/c/81750
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-29 05:13:02 +00:00
Konstantin Shcheglov b2439a4760 Fixes for analyzer tests on Windows.
R=brianwilkerson@google.com

Change-Id: I2758da56d8014e0cdb42aec0f8664c98cf607093
Reviewed-on: https://dart-review.googlesource.com/c/81747
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-10-28 17:56:42 +00:00
Konstantin Shcheglov e223bd3628 Replace most of direct uses of MemoryResourceProvider with ResourceProviderMixin.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I87114418b63ef68665b9c3e487980a72db00ec6a
Reviewed-on: https://dart-review.googlesource.com/c/81744
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-27 17:50:10 +00:00
Konstantin Shcheglov 99cec75809 Remove the last two methods from RestrictedAnalysisContext.
I think this is the minimum, this data is available in AnalysisSession
and (the new) AnalysisContext. Modulo async typeProvider / typeSystem.

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

Change-Id: Idf3d40461ba50ee5d4b680e2d2ad193b086bfe0b
Reviewed-on: https://dart-review.googlesource.com/c/81724
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-10-26 23:59:23 +00:00
Devon Carew d53b034a64 Fix several analysis lints.
Change-Id: If7921d5cfc3dd2af79699f9905d7f3b106254cd0
Reviewed-on: https://dart-review.googlesource.com/c/81722
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-10-26 21:41:35 +00:00
Paul Berry cc4cc12d4f Remove unused import
Change-Id: I0d3a5ef500e967251c4744435e600c6552b61c90
Reviewed-on: https://dart-review.googlesource.com/c/81721
Commit-Queue: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-10-26 20:51:52 +00:00
Brian Wilkerson 28785aa14d Define the getter Element.session
Change-Id: I467f69d48a3084c444446a785110a5db85b3ecfa
Reviewed-on: https://dart-review.googlesource.com/c/81332
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-26 13:47:32 +00:00
Paul Berry 1894056c71 Merge commit '4aaa9660148fabc25a259a602c49ae924c33e378' into analyzer 2018-10-26 05:58:56 -07:00
Konstantin Shcheglov 20d81452e5 Remove AstProvider, use AnalysisSessionHelper.
This is a step toward making CorrectionUtils constructor accept full
ResolveResult, instead of partial (and potentially inconsistent) unit
and AnalysisContext.

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

Change-Id: Ic386d48af2d00ecaf9ef13b8480e7e78c7d52efc
Reviewed-on: https://dart-review.googlesource.com/c/81382
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-10-25 19:09:11 +00:00
Paul Berry 9aff930924 Move test_methodCallTypeInference_mixinType into mixin_test.dart
Addresses code review comments on https://dart-review.googlesource.com/c/sdk/+/81322.

Change-Id: I8c8bd20f024a849042ff862f755a4187765f6201
Reviewed-on: https://dart-review.googlesource.com/c/81330
Commit-Queue: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-10-24 22:17:20 +00:00
Mike Fairhurst a88b10ad5a Fix #34906 Handle bottom type via Null correctly
Bug: 34906
Change-Id: I6105de38a0ed697f53ba1158f12e0a03a809728e
Reviewed-on: https://dart-review.googlesource.com/c/81321
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2018-10-24 20:50:15 +00:00
Paul Berry 2e2c360371 Merge commit '0b15595913ff89d8486e6677af0254dd6feab350' into analyzer 2018-10-24 06:09:47 -07:00
Paul Berry 0009ca7b1b In _matchInterfaceSubtypeOf, account for mixins having null superclass.
Fixes #34907.

Change-Id: I1ba56bf57d6ca5a7a69f262e12df801dc2cc4a4a
Reviewed-on: https://dart-review.googlesource.com/c/81322
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-10-24 01:06:25 +00:00
Konstantin Shcheglov f5758b74c8 Report missing '[]' and '[]=' operators separately.
R=brianwilkerson@google.com

Change-Id: I729d76c3373ab0eba3e191a5a79f6d2a34a97e23
Reviewed-on: https://dart-review.googlesource.com/c/81222
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-10-23 15:46:51 +00:00
Paul Berry 5954a3e5d0 Merge commit '6443a8036d3914f28f1d1e140a108487953cd909' into analyzer 2018-10-23 06:03:57 -07:00
Konstantin Shcheglov 2f90f8d0ef Issue 34896. Verify the superconstraint signature invoked by a mixin, not the mixin's one.
R=brianwilkerson@google.com, paulberry@google.com

Fixes: https://github.com/dart-lang/sdk/issues/34896
Change-Id: I778d572e2e2d0affb15c28d7bf2c1fbb58a8cd8a
Reviewed-on: https://dart-review.googlesource.com/c/81204
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-10-23 06:20:59 +00:00
Konstantin Shcheglov 0803b538a8 Revert a change that causes failures internally.
This reverts a part of https://dart-review.googlesource.com/c/sdk/+/81160

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

Change-Id: I2ed4741191c8d0fdea135fa550b58beb0bd3bcc1
Reviewed-on: https://dart-review.googlesource.com/c/81202
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-10-23 04:54:37 +00:00
Paul Berry 9ca0d26744 Properly type infer references to class type parameters.
Fixes #34489.

Change-Id: I7dca72366dd9259e6a0f39aaa07202943eb9f54d
Reviewed-on: https://dart-review.googlesource.com/c/81180
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-10-23 04:24:53 +00:00
Konstantin Shcheglov e648d63bed Revert "Compute unlinked API signatures without unlinked summaries."
This reverts commit eb9687189d.

Exceptions like "Element not found in summary" still happen with
2.1.0-dev.7.1 internally, and I suspect that it is caused by
discrepancies in API signatures and unlinked units. So, I think we
should revert this change.  We are not going to do one-phase link
anymore, so this CL is not strongly required anymore.

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

Change-Id: I213156942fa3257b1884b209dda0b1d0c731d9a8
Reviewed-on: https://dart-review.googlesource.com/c/81181
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-10-22 21:29:11 +00:00
Paul Berry 5665636983 Merge commit '7fd78ed5b606e64d30ec201de9adce6fdf8856ba' into analyzer 2018-10-22 13:07:24 -07:00
Brian Wilkerson 67b9f2ec8d Deprecate Element.unit and Element.computeNode
Change-Id: Id2a70b4a194cba28bfdc0990d7306d6561f422db
Reviewed-on: https://dart-review.googlesource.com/c/81060
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-22 16:50:43 +00:00
Brian Wilkerson a342cecffd Disable support for the old super mixins
Change-Id: I8f8074b67ea43249fcc10deddd2325938996d529
Reviewed-on: https://dart-review.googlesource.com/c/79469
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-22 16:02:01 +00:00
Konstantin Shcheglov c44fa48f8f Extract and rewrite MethodInvocation resolution.
This is a copy of https://dart-review.googlesource.com/c/sdk/+/78182,
but now in the analyzer branch.

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

Change-Id: I75d17a351ee7a33c164d560009cf3ffd088d956a
Reviewed-on: https://dart-review.googlesource.com/c/80942
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-22 03:36:30 +00:00
Konstantin Shcheglov 7c80d22878 Make indexing in AnalysisDriver optional.
This makes my Flutter benchmark about 6% faster.

It will not affect performance of `flutter analyze`, because for now
Analysis Server always enables indexing and search. But we could make
this optional, for DAS clients that need only errors, but not search,
refactorings, etc.

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

Change-Id: I4eafc37592a3bb18bd2c6ab84dc2515a4d42697b
Reviewed-on: https://dart-review.googlesource.com/c/80880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-10-21 20:20:05 +00:00
Konstantin Shcheglov 163b356b79 Remove CheckedModeCompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION.
There is no destinction anymore.
So, we don't need a cycle, and can report just one error kind.

R=brianwilkerson@google.com

Change-Id: I54680ca5b5df275b2d68804a0ad7caeda3ed92aa
Reviewed-on: https://dart-review.googlesource.com/c/80982
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-10-21 19:49:44 +00:00
Brian Wilkerson aed6e8419f Add recovery tests related to enum and mixin declarations
Change-Id: I051f9a344fce3bd8d7c2f87b927d351c4596de1a
Reviewed-on: https://dart-review.googlesource.com/c/80941
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-19 22:08:25 +00:00
danrubel 9f7ad8d082 Fix recovery when parsing complex type variables
This fixes parser recovery when the user has inserted a word before
a method declaration with a complex type arguments, such as

  foo Future<List<int>> bar() {}

Fix https://github.com/dart-lang/sdk/issues/34850

Change-Id: Ic6d1767668bd34d75c6ab5f9973e5762bdd8f160
Reviewed-on: https://dart-review.googlesource.com/c/80780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-10-19 18:56:09 +00:00
Paul Berry fe5467092a Merge commit '7a3762d4a91aed0b3885259b297953d0c38ce849' into analyzer 2018-10-19 10:00:38 -07:00
Konstantin Shcheglov 5f4511a30e Stop adding tokens to unit API signature at EOF.
R=brianwilkerson@google.com, danrubel@google.com

Fixes https://github.com/dart-lang/sdk/issues/34850
Change-Id: Iaa4a537ee7f69446129663467241cc8a8498d57b
Reviewed-on: https://dart-review.googlesource.com/c/80680
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-18 18:03:05 +00:00
Konstantin Shcheglov e0e6cf37eb Reuse library elements across multiple resolutions.
This makes my Flutter benchmark about 25% faster.

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

Change-Id: I9db776ec97afb60b452725175dbe0d0331522bd3
Reviewed-on: https://dart-review.googlesource.com/c/80508
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-18 16:03:28 +00:00
Sam Rawlins 2bb4284c63 Add a few more tests and comments for GnWorkspace
Change-Id: I3d8cc76e166c1968049c35d383599f6bebd0d1bf
Reviewed-on: https://dart-review.googlesource.com/c/80521
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-10-18 00:26:01 +00:00
Paul Berry 9233c1e40e Merge commit '4506e1d179d4494e21be05a2940295b1673b579c' into analyzer
Conflicts:
	pkg/analyzer/lib/src/dart/analysis/driver.dart
2018-10-17 12:08:17 -07:00
Brian Wilkerson 9a69a5c1ee Remove more unnecessary awaits (from analyzer)
Change-Id: I796c8344db1d8bf225ef347cd09e419bb86b3a5f
Reviewed-on: https://dart-review.googlesource.com/c/80400
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-17 00:29:01 +00:00
Sam Rawlins 5b574415f8 Fix GnWorkspace root
Bug: none
Change-Id: I61c11773313bab13afcab26bd2d3164a94da3e46
Reviewed-on: https://dart-review.googlesource.com/c/80260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2018-10-16 23:09:01 +00:00
Konstantin Shcheglov 1f4461874b Rewrite often used parts of ClassElementImpl without iterators and closures.
R=brianwilkerson@google.com

Change-Id: Ib659663b164f4f937cf185e3c2eb0828e00a3500
Reviewed-on: https://dart-review.googlesource.com/c/80360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-16 20:46:59 +00:00
Konstantin Shcheglov 1743b70fe0 Make analysis synchronous again.
This reverts https://codereview.chromium.org/3010463002

We don't talk to CFE anymore, so we can do all analysis synchronously.

R=brianwilkerson@google.com

Change-Id: Ifb960230bdde66862f53cd820ffd31a738df11ee
Reviewed-on: https://dart-review.googlesource.com/c/80080
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-16 18:46:18 +00:00
Konstantin Shcheglov 20f4349951 Fix for reporting INVALID_USE_OF_PROTECTED_MEMBER in documentation comments.
R=brianwilkerson@google.com, devoncarew@google.com

Bug: https://github.com/dart-lang/sdk/issues/34816
Change-Id: Ifb46351f83405e862fb5f28b669fa151ab0e2f8f
Reviewed-on: https://dart-review.googlesource.com/c/80267
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2018-10-16 17:29:37 +00:00
Konstantin Shcheglov 91ead7d34e Build libraries graph and compute transitive signatures for library cycles.
Instead of computive transitive sets of files for each library, we
now build LibraryCycle instances and shared them among the libraries
of the cycle. To compute transitive signatures, we don't append each
invidual API signature of a transitive file, but compute API signatures
of the files in the cycle with transitive signatures of directly
referenced library cycles.

This reduces time to compute transitive signatures from 1200 ms to
about 80 ms, and makes my Flutter benchmark about 6% faster.

R=brianwilkerson@google.com

Change-Id: I0ba6d9da48abb585c2a9675e3ca8ebac3ef20612
Reviewed-on: https://dart-review.googlesource.com/c/80042
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-16 01:06:07 +00:00
Brian Wilkerson 469e1e2e64 Remove unnecessary library directives
Change-Id: I7a157080e4d7fd80d64489a13de4e996b5870930
Reviewed-on: https://dart-review.googlesource.com/c/79474
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-13 00:44:04 +00:00