Commit Graph

554 Commits

Author SHA1 Message Date
Konstantin Shcheglov 0160332713 Issue 28027. Move Null to the bottom in the Analyzer.
R=brianwilkerson@google.com, paulberry@google.com
BUG= https://github.com/dart-lang/sdk/issues/28027

Review-Url: https://codereview.chromium.org/2638183002 .
2017-01-18 11:15:11 -08:00
Konstantin Shcheglov 914a117649 Report errors like IMPORT_OF_NON_LIBRARY with the new analysis driver.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2627093010 .
2017-01-12 13:41:52 -08:00
Asger Feldthaus 8aad3affc2 Do not refer to initializing parameters in initializer lists.
This feature is not supported by the fixed VM version in
tools/sdks which our tests rely on.

BUG=
R=whesse@google.com

Review-Url: https://codereview.chromium.org/2626043002 .
2017-01-12 17:20:43 +01:00
Brian Wilkerson 22f561e914 Reapply "Add support for generic function type syntax, part 1"
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2622303006 .
2017-01-11 14:10:05 -08:00
Brian Wilkerson 85b1e7abbe Revert "Add support for generic function type syntax, part 1"
Review-Url: https://codereview.chromium.org/2624283003 .
2017-01-11 13:30:52 -08:00
Brian Wilkerson 1cd918533d Add support for generic function type syntax, part 1
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2613383003 .
2017-01-11 13:12:10 -08:00
Leaf Petersen 1ed1e1cb62 Make call methods definite.
Makes objects with call methods be treated as definite functions.
Fixes https://github.com/dart-lang/sdk/issues/28087 .

BUG=
R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2594873002 .
2017-01-09 04:01:57 -08:00
Leaf Petersen 83fc4b6b46 Put a TypeProvider on the TypeSystem implementations.
Adding a TypeProvider instance to TypeSystem to avoid needing to
thread it through the various APIs, and to avoid having to change
the API every time a method which previously did not need to
access the TypeSystem suddenly does.

BUG=
R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2590883004 .
2017-01-09 02:40:10 -08:00
Dan Rubel 0863ac0b2c cmdline flags override analysis options in file
Update command line arguments processing so that any analysis options
flags specified on the command line (e.g. --supermixin) take precedence
over corresponding flags in the analysis_options.yaml file.

R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2598523003 .
2016-12-22 20:36:01 -05:00
Paul Berry 02fe40c6f7 Simplify how patch files are specified to analyzer.
After discussion with kmillikin@, sigmund@, and scheglov@, we decided
that specifying the patch files in libraries.dart is more complex (and
less flexible) than we'd like.  This CL changes things so that the
patch files are specified in analysis options using a simple map from
library name (e.g. "dart:core") to a list of patch file paths.

Clients are now allowed to put patch files wherever they want; they
don't need to be inside the sdk directory.

Note that we no longer include the patch configuration in
encodeCrossContextOptions.  This should be ok, since we don't have any
use case in which a single instance of analyzer needs to accommodate
multiple patch configurations.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2560323002 .
2016-12-12 10:15:18 -08:00
Brian Wilkerson a01afcd1d1 Remove the options plugin
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2569603002 .
2016-12-11 08:38:29 -08:00
Brian Wilkerson e22a2b4626 Enable messages in asserts by default
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2557513008 .
2016-12-07 12:23:00 -08:00
Paul Berry ae6fd961a1 Prepare for decoupling analyzer ASTs from element model.
This CL creates top level accessor functions which may be used to map from AST data structures to their corresponding elements and types, and begins using those accessor functions throughout the SDK.  It also adds empty interfaces ResolutionTarget and ResolutionType, which are implemented by Element and DartType respectively.

In a future CL, I will change the types stored in the AST to ResolutionTarget and ResolutionType, rather than specific element types; this will decouple the ASTs from the element model.  The presence of the accessor functions will allow clients to continue accessing elements and types in a type-safe way.

R=asgerf@google.com, brianwilkerson@google.com, scheglov@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/2551023005 .
2016-12-07 11:08:14 -08:00
Brian Wilkerson 0ea654a068 Remove the AnalysisOptionsProcessor
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2559523005 .
2016-12-07 10:51:33 -08:00
Kevin Moore 70581541e6 Use for-each in strong_mode.dart
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/2542133004 .
2016-12-07 10:46:44 -08:00
Jennifer Messerly 7a1b6e75b3 restrict generic function type subtyping
R=leafp@google.com

Review URL: https://codereview.chromium.org/2540903003 .
2016-12-01 19:24:15 -08:00
Brian Wilkerson 7e067a6fc8 Enable read-only access to initializing formals (issue 27895)
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2532953004 .
2016-11-29 07:46:28 -08:00
Paul Berry f4baeb20d7 Create a new AstFactory class to be used by analyzer and its clients.
Unlike the previous AstFactory (now called AstTestFactory), this class
is not just for testing; it is intended to be able to create all
analyzer AST objects used in production.  Also, its methods are
non-static.

For now, all users of the new AstFactory access it using the final
variable `astFactory` in standard_ast_factory.dart.  In future CLs I
intend to plumb a reference to the AstFactory through various analyzer
classes so that it can be used in a dependency injection style.

Also, the classes CommentType and UriValidationCodeImpl have been
moved out of the AST implementation file
(pkg/analyzer/lib/src/dart/ast/ast.dart) and to their own files so
that the AST interface will be able to continue to use them without
depending on the AST implementation.

In follow-up CLs I will change the analyzer and its clients to use the
AstFactory rather than the redirecting constructors in the AST
interface file, and then remove those redirecting constructors.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2522143003 .
2016-11-28 10:50:20 -08:00
Brian Wilkerson b923dafd25 Add parser support for using a URI in a part-of directive
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2526063002 .
2016-11-25 08:16:45 -08:00
Brian Wilkerson 1767def635 Respect the rest of the analysis-based options
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2523833002 .
2016-11-22 13:12:32 -08:00
Brian Wilkerson e63105555b Remove uses of configuration data
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2522543007 .
2016-11-22 11:26:08 -08:00
Brian Wilkerson a3e1a0d395 Enable generic method support by default
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2488043002 .
2016-11-22 09:16:19 -08:00
Dan Rubel 0d15f1d892 report errors in included options files
Example error messages include:
/analysis_options.yaml(10..27): The include file other_options.yaml in /analysis_options.yaml cannot be found.
/analysis_options.yaml(10..27): Bad options file format (expected String scope key, got YamlScalar) in /other_options.yaml(0..0)
/analysis_options.yaml(10..27): Warning in the included options file /other_options.yaml(47..49): The option 'ftw' isn't supported by 'errors'.

Since the included options file may not be part of the project,
the error is reported on the initial include statement
and includes the needed location information for the user to track down the problem.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2502233004 .
2016-11-17 14:43:05 -05:00
Paul Berry 0c928771fc Revert "Connect analyzer's AnalysisError object to front_end's CompilationError."
This reverts commit fc5270df72.

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

Review URL: https://codereview.chromium.org/2503803003 .
2016-11-15 10:00:34 -08:00
Paul Berry fc5270df72 Connect analyzer's AnalysisError object to front_end's CompilationError.
AnalysisError implements CompilationError but provides additional
services, such as extensibility via the `getProperty` method.

Note: CompilationError.location has been renamed to
CompilationError.span to avoid confusion (since its type is
`SourceSpan`, not `SourceLocation`).

R=scheglov@google.com

Review URL: https://codereview.chromium.org/2498133002 .
2016-11-14 15:30:10 -08:00
Konstantin Shcheglov 1ac36f7c38 Rename setters synthetic/static to isSynthetic/isStatic.
Also rename ConstructorElementImpl.const2 to isConst.

These are breaking changes.

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

Review URL: https://codereview.chromium.org/2489363002 .
2016-11-10 12:22:58 -08:00
Paul Berry 5eb3636ae3 Add patch file support to the analyzer task model.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2483343002 .
2016-11-08 14:00:45 -08:00
Paul Berry 0a1fb8d248 Move scanner into pkg/front_end/lib/src/scanner.
Several support classes also had to move to front_end along with the
scanner.  Some of these support classes arguably don't belong to the
scanner itself, since they have other uses (e.g. SyntacticEntity,
ErrorCode, ErrorSeverity, ErrorType, and StringUtilities).  They will
be reorganized into a more appropriate location in future CLs, at the
time that they become needed by other components of the front end.

In order to avoid dragging in a lot of dependencies, the following
changes were made:

1. Scanner no longer reports errors through Source and
AnalysisErrorListener objects passed to the constructor.  Instead, it
provides an abstract reportError() method which clients may override
to perform error reporting in any way they wish.  Analyzer contains an
override of Scanner that mimics the old behavior in order to maintain
compatibility.

2. Static members of ErrorCode (`values` and `byUniqueName`) have been
moved to top level, and remain in analyzer.  To maintain
compatibility, these static members remain in ErrorCode (as deprecated
members that simply wrap the implementations in analyzer).  This means
we have a reverse dependency (front_end depends on analyzer), but this
dependency will go away as soon as we publish the next breaking change
release of analyzer.

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

Review URL: https://codereview.chromium.org/2486873003 .
2016-11-08 13:47:17 -08:00
Jennifer Messerly 43bcc5945e fix #27766, allow implicit casts from dynamic to composite types
R=leafp@google.com

Review URL: https://codereview.chromium.org/2477093002 .
2016-11-04 17:37:13 -07:00
Jennifer Messerly 68f290c9d8 fix #27764, split STATIC_TYPE_ERROR into more detailed ones
R=leafp@google.com

Review URL: https://codereview.chromium.org/2482573002 .
2016-11-04 17:04:00 -07:00
Konstantin Shcheglov f0a9bb0c9f Don't compute library cycle when the library is resynthesized.
As I understand, we infer all types during linking.
So, there is no reason to re-infer types.
And AFAIK ensuring type inference is the only client of library cycle
information.

With the new analysis context we link and have types for all libraries,
including the one we are resolving unit for.

Removing library cycle computation makes analysis almost 40% faster.

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

Review URL: https://codereview.chromium.org/2473443005 .
2016-11-02 13:41:02 -07:00
Mike Fairhurst cc12877f56 Ensure HtmlWorkManager is subscribed to the right stream for invalidations in the presence of SourceFactory changes
BUG=
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/2454233003 .
2016-10-31 12:57:23 -07:00
Paul Berry cf5f9e0a38 Move class DeclarationResolver to its own file.
Auxiliary classes ElementGatherer, ElementMismatchException, and
ExistingElementResolver, which were only used by DeclarationResolver,
are also moved.

(No functional change; just code motion).

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2406863003 .
2016-10-10 11:43:26 -07:00
Brian Wilkerson 6446cab391 Guard against exceptions thrown by linters (issue 27545)
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2407553002 .
2016-10-07 14:37:39 -07:00
Konstantin Shcheglov 59e8af7047 Report CompileTimeErrorCode.DUPLICATE_PART when not only URI, but even Source is the same.
There is one usecase when strongly speaking the error should not be
reported - when the part is empty. But that still does not seem practical.

R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/27509

Review URL: https://codereview.chromium.org/2401783002 .
2016-10-06 20:44:28 -07:00
Konstantin Shcheglov 26cc95d8b4 Issue 27515. Report DUPLICATE_PART when the same library contains two part directives with the same URI.
R=brianwilkerson@google.com, paulberry@google.com
BUG= https://github.com/dart-lang/sdk/issues/27515

Review URL: https://codereview.chromium.org/2401463004 .
2016-10-06 11:28:05 -07:00
Konstantin Shcheglov 0223b08a34 Issue 27300. Report HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE. (Land again)
The pkg/analysis_server/test/integration/analysis/error_test was fixed.

R=brianwilkerson@google.com, paulberry@google.com
BUG= https://github.com/dart-lang/sdk/issues/27300

Review URL: https://codereview.chromium.org/2366963002 .
2016-09-23 10:21:21 -07:00
Paul Berry fe2c152ee2 Revert "Issue 27300. Report HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE."
This broke the analyzer bots.  See for example https://build.chromium.org/p/client.dart/builders/analyzer-mac10.11-release-be/builds/337/steps/analysis%20server%20unit%20tests/logs/stdio

This reverts commit 77ba5fd087.

TBR=scheglov@google.com

Review URL: https://codereview.chromium.org/2361393002 .
2016-09-23 05:24:53 -07:00
John Messerly adc71ab396 re-land fix #27110 with proper DDC side of changes
R=leafp@google.com

Review URL: https://codereview.chromium.org/2362563004 .
2016-09-22 15:47:55 -07:00
Konstantin Shcheglov 77ba5fd087 Issue 27300. Report HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE.
There are no positives in analyzer/server, dev_compiler or dart2js.

R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/27300

Review URL: https://codereview.chromium.org/2364733002 .
2016-09-22 14:27:47 -07:00
Konstantin Shcheglov 163931ffdd Fix couple hints.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2362753002 .
2016-09-22 09:59:40 -07:00
Brian Wilkerson d947a7ba89 Async is no longer optional
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2361433002 .
2016-09-21 08:29:34 -07:00
Brian Wilkerson 2d9e690e6c Fix newly introduced errors and warnings
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2357553003 .
2016-09-21 08:01:04 -07:00
John Messerly 865e808f15 support @virtual fields, fix #27384
R=leafp@google.com

Review URL: https://codereview.chromium.org/2352433002 .
2016-09-19 09:45:24 -07:00
Konstantin Shcheglov 54ee2b88c8 ImportElement/ExportElement 'uri' should be the selected URI.
So, that the URI is consistent with the imported/exportedLibrary.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2343103003 .
2016-09-17 17:26:13 -07:00
Brian Wilkerson 07aa504eb9 Clean up missed references to deprecated code
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2349863002 .
2016-09-17 10:37:29 -07:00
Konstantin Shcheglov ea0d3e4430 Issue 27374. Include all configuration sources into REFERENCED_SOURCES.
VerifyUnitTask verifies all Configuration sources, so we need to know
MODIFICATION_TIME all the sources, even if the configuration is not selected.

R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/27374

Review URL: https://codereview.chromium.org/2347123004 .
2016-09-16 11:31:32 -07:00
Brian Wilkerson 22040876bf Use declared variables to select the correct configuration for resolution
R=paulberry@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/2345773003 .
2016-09-16 07:32:40 -07:00
Brian Wilkerson ecc84b26a4 Break up another large file
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2342733002 .
2016-09-15 07:49:27 -07:00
John Messerly 28247a3daa fix #25578, implement @covariant parameter overrides
R=leafp@google.com

Review URL: https://codereview.chromium.org/2336503003 .
2016-09-13 14:57:22 -07:00