Commit Graph

2286 Commits

Author SHA1 Message Date
Paul Berry 63770042aa Merge commit '80c23f87a3e3123d7e337c1fc8bc3b5ec49b34a0' into analyzer 2018-11-30 08:12:45 -08:00
danrubel 80c23f87a3 Update more analyzer error codes to be generated
This updates more analyzer error codes to be generated
from the corresponding CFE error code.

Several of these analyzer error codes had multiple CFE error
codes mapped to them. In these situations, new analyzer error
codes were added to match the existing CFE error codes:

* EXTERNAL_FACTORY_WITH_BODY
* EXTERNAL_FACTORY_REDIRECTION
* CATCH_SYNTAX_EXTRA_PARAMETERS

Change-Id: Ib1cbb9e04d2092e4859e2cfadbcc85e03093f808
Reviewed-on: https://dart-review.googlesource.com/c/85431
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-11-30 15:00:36 +00:00
Paul Berry 589a823888 Cherry-pick f02e7bb374 to the analyzer branch
Original commit message:

    Rework parseLiteralSetOrMapSuffix to remove expression lookahead

    This reworks the set literal support to remove unnecessary lookahead
    by removing the listener.beginLiteralMapEntry event
    and renaming the listener.endLiteralMapEntry to handleLiteralMapEntry.

Change-Id: I608e94aadc2afb86c772fdc6ef24b0da32c5ddde
Reviewed-on: https://dart-review.googlesource.com/c/85410
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-11-28 23:53:01 +00:00
Brian Wilkerson 235da6f45d Rename AstNode.getAncestor by deprecating it and adding the new method (analyzer)
Change-Id: Ia00d8cb7153bd9db798352aab00b2431ba709671
Reviewed-on: https://dart-review.googlesource.com/c/85540
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-11-28 21:04:57 +00:00
Brian Wilkerson 65787a250e Use the experiment flag to enable scanning the >>> operator
Change-Id: I93678479911b629c3b88edd76d1ffa0c1daebaf3
Reviewed-on: https://dart-review.googlesource.com/c/85520
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2018-11-28 20:22:28 +00:00
danrubel de764dbec1 more set literal tests
Change-Id: I9d6a24e240be7379674b898fb4d094e86058611b
Reviewed-on: https://dart-review.googlesource.com/c/85429
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-11-28 19:02:00 +00:00
Paul Berry 82add824fd Merge commit 'db89c2d1ac3e8b6c6130cbb714c4e242e6fefc27' into analyzer 2018-11-27 15:11:22 -08:00
Konstantin Shcheglov 2beed40848 Move Workspace and its implementations into src/workspace.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I172d95e55ced9925e8f428b9b07f432251ef5248
Reviewed-on: https://dart-review.googlesource.com/c/85462
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-11-27 21:50:00 +00:00
danrubel 52892f7c47 Add scanner and parser support for new >>> operator
This adds support for the new >>> operator as detailed in
https://github.com/dart-lang/language/blob/master/accepted/future-releases/constant-update-2018/feature-specification.md#new-operators

Tracking issue: https://github.com/dart-lang/language/issues/60

Enable support by setting AbstractScanner.enableGtGtGt = true

Change-Id: I8e7d2fb341971452d8e05d734a1de612880fef5e
Reviewed-on: https://dart-review.googlesource.com/c/85421
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-11-26 22:12:25 +00:00
danrubel f02e7bb374 Rework parseLiteralSetOrMapSuffix to remove expression lookahead
This reworks the set literal support to remove unnecessary lookahead
by removing the listener.beginLiteralMapEntry event
and renaming the listener.endLiteralMapEntry to handleLiteralMapEntry.

Change-Id: Ia71fe69359b0447a60d729db34ec35ad25a54750
Reviewed-on: https://dart-review.googlesource.com/c/84661
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-11-26 20:03:19 +00:00
Brian Wilkerson 198d4d135f Infer an empty set literal when appropriate
Change-Id: Ib46c35adbd3dd9e28073aeb5996d785b5e62e608
Reviewed-on: https://dart-review.googlesource.com/c/85142
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-11-21 22:27:53 +00:00
Paul Berry e649ed1aa3 Merge commit 'c1daa3276566e48dac6f52742264578092c56a35' into analyzer 2018-11-21 08:47:55 -08:00
Brian Wilkerson 758e690b8d Enable the use of set literals in the analyzer unit tests
Change-Id: Idbf0b807d59fd68436906f699fd4ab55db23ac62
Reviewed-on: https://dart-review.googlesource.com/c/84962
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-11-20 23:56:40 +00:00
Paul Berry c165ef8a37 Ensure that lists and maps built by ExprBuilder have their staticType set.
We can't rely on resolution to do this, because resolution only
operates in the compilation unit currently being analyzed, and
constant values may be needed from other compilation units.

Fixes #35230.

Change-Id: I11fa5597110bc13164ca5dc9846836848120cd08
Reviewed-on: https://dart-review.googlesource.com/c/84964
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-11-20 22:22:15 +00:00
Dan Rubel aa9d186fa5 More analyzer set literal tests
Change-Id: I2d2dc2f8fb04f9baf135ac2504f0fa412c4ed262
Reviewed-on: https://dart-review.googlesource.com/c/84781
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-11-19 21:22:33 +00:00
Brian Wilkerson 032bfe0872 Use void rather than Object as a type argument when possible
Change-Id: I275a20e6f58a01adda3be64cf83930cc238beed3
Reviewed-on: https://dart-review.googlesource.com/c/84700
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-11-19 18:32:31 +00:00
Paul Berry 6d8e14c9db Merge commit 'f56fea3e6389727df2cae5c6feebcdd49437b12a' into analyzer 2018-11-19 08:24:02 -08:00
danrubel 7f63fcfe1f Add AstBuilder set literals support
Change-Id: I8e126d31975bc3834b4091ba149c97b92dde9a10
Reviewed-on: https://dart-review.googlesource.com/c/84663
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-11-17 03:11:41 +00:00
Dan Rubel 9677ec9a14 Fix parsing complex function expressions
Fix https://github.com/dart-lang/sdk/issues/35177

Change-Id: I378314741bbbe555f9cdc2b95dcfd5ce71a15efa
Reviewed-on: https://dart-review.googlesource.com/c/84660
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-11-16 21:49:30 +00:00
Paul Berry 32a6032f03 Merge commit 'ddbe22190c41b1993a3c93b67f1bfa57287348f8' into analyzer 2018-11-16 12:01:38 -08:00
Brian Wilkerson 01e0df71a8 Stop unnecessarily extending Object
Change-Id: Ib557755916b09be4e1ad1b1c2e4bed052a280513
Reviewed-on: https://dart-review.googlesource.com/c/84640
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-11-16 16:43:24 +00:00
Konstantin Shcheglov 8414e2240c Don't report DEPRECATED_MEMBER_USE for deprecated mixins, top-level variables, and class fields.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: Ied5fbe5f7427d286a43902719eb153964c8800e0
Reviewed-on: https://dart-review.googlesource.com/c/84545
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-11-15 20:35:57 +00:00
Brian Wilkerson 1d00a8a11f Add checking for errors related to set literals
Change-Id: Iad1442da6be318a709f5782fbda4a9055f55dfac
Reviewed-on: https://dart-review.googlesource.com/c/84302
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-11-13 20:08:23 +00:00
Brian Wilkerson f6128b48b6 Add constant evaluation for operators that now apply to bool as well as int
Change-Id: I080386cddfece2d789fcee7d13bdda01260cc724
Reviewed-on: https://dart-review.googlesource.com/c/84160
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-11-12 21:26:08 +00:00
Konstantin Shcheglov c9ae39a9bf Issue 34741. Update error message to make it less unclear.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/34741
Change-Id: If766d0aad5d87578a578849f269746a64430a68b
Reviewed-on: https://dart-review.googlesource.com/c/84100
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-12 19:00:34 +00:00
Brian Wilkerson f0f3f445a7 Add a version of getAncestor that matches by type without a closure
Change-Id: Ib10ab78284466b04b47b6480aded9d3535c79b12
Reviewed-on: https://dart-review.googlesource.com/c/83642
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-11-08 20:43:57 +00:00
Paul Berry d076571cd9 Merge commit '35c6c79ebc052ab28efcaf045b38ff71c6ed5f3e' into analyzer 2018-11-08 09:32:18 -08:00
Dan Rubel 35c6c79ebc Fix parsing getter with prefixed name
Fix https://github.com/dart-lang/sdk/issues/34610

Change-Id: I7004814af69b35d143779857a6bbd4bb639e257c
Reviewed-on: https://dart-review.googlesource.com/c/83240
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-08 14:31:43 +00:00
Paul Berry b6833e9e6c Remove unused import
Change-Id: I2589b6da4aaeef136a468ae331792e5f4be08d63
Reviewed-on: https://dart-review.googlesource.com/c/83462
Commit-Queue: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-07 17:32:33 +00:00
Brian Wilkerson 22408c6dee Remove references to previewDart2
Change-Id: Id382dd95d3ae90d483467741b5b6d3dbc6c31ea1
Reviewed-on: https://dart-review.googlesource.com/c/83300
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-11-07 14:52:37 +00:00
Konstantin Shcheglov 9af769539c Issue 34387. Don't report an error when a static member is referenced in a documentation comment.
Also consolidate comment reference resolution tests.

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

Bug: https://github.com/dart-lang/sdk/issues/34387
Change-Id: I3c75c1679c7a880705e6aff9d2f5477eb81a7f11
Reviewed-on: https://dart-review.googlesource.com/c/83223
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-11-07 00:28:37 +00:00
Paul Berry 97a51b2af2 Revert "Import path as p, in Workspace impl libraries"
This reverts commit feba863557.

Reason for revert: for now, we want this change on the analyzer branch only.

Original change's description:
> 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>

TBR=scheglov@google.com,brianwilkerson@google.com,srawlins@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I03ee1a3d3f358f8a7ac6ddad5f1b3a2e5991468f
Reviewed-on: https://dart-review.googlesource.com/c/82900
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-11-05 17:59:20 +00:00
Paul Berry b1cbfab274 Merge commit '9a1a7763f150e92e39a05519be47e581584c5de9' into analyzer 2018-11-05 04:01:07 -08:00
Brian Wilkerson 30f1c7cbab Remove references to analyzer/analyzer.dart
Change-Id: I3b3affa957ed8cc8c66f2b32c45b7dcd820f9b1e
Reviewed-on: https://dart-review.googlesource.com/c/82713
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-11-03 00:19:22 +00:00
Konstantin Shcheglov b71948faee Consolidate MockSdk(s) into one, living in analyzer/lib/src/test_utilities.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I70946b8e6f790608ad52c8f27cd6f506673f7b0d
Reviewed-on: https://dart-review.googlesource.com/c/82710
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-11-02 21:52:44 +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
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
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 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
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
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