Commit Graph

299 Commits

Author SHA1 Message Date
danrubel ea4b380f80 fix source restoreUri test
Review-Url: https://codereview.chromium.org/2717933002 .
2017-02-26 15:18:38 -08:00
danrubel 00e705835d revert restoreUri test on Windows
Review-Url: https://codereview.chromium.org/2719803002 .
2017-02-26 14:52:46 -08:00
danrubel 4ca5ac929a fix MemoryResourceProvider context on Windows
On Windows, the MemoryResourceProvider.convertPath method
prefixes the path with the C: drive, but the context associated with
the MemoryResourceProvider has a drive letter based upon the underlying
current directory. Most of the time, these two drive letters are the
same, but sometimes, such as on the Windows bot, the current working
directory is on drive E:, rather than drive C:.
This causes package Uris to be mapped to drive E: rather than the
expected drive C:

This CL changes the MemoryResourceProvider constructor
to set the current working directory to C:\ when running on Windows
so that it aligns with MemoryResourceProvider.convertPath.

R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2714373002 .
2017-02-26 13:30:42 -08:00
danrubel 940fe975a8 Revert "debug MemoryResourceProvider on Windows"
This reverts commit a0ec77e383.

Review-Url: https://codereview.chromium.org/2716153002 .
2017-02-26 08:50:09 -08:00
danrubel a0ec77e383 debug MemoryResourceProvider on Windows
Review-Url: https://codereview.chromium.org/2719793002 .
2017-02-26 08:23:18 -08:00
danrubel 339d32e500 Revert "debug ContextBuilder getAnalysisOptions on Windows"
This reverts commit eb363eaa13.

Review-Url: https://codereview.chromium.org/2712303002 .
2017-02-26 08:13:03 -08:00
danrubel eb363eaa13 debug ContextBuilder getAnalysisOptions on Windows
Review-Url: https://codereview.chromium.org/2720583002 .
2017-02-26 07:45:56 -08:00
danrubel 0be4408efa Revert "debug analyzer test on windows"
This reverts commit 7582a9dc27.

Review-Url: https://codereview.chromium.org/2719673003 .
2017-02-25 12:43:21 -05:00
danrubel 7582a9dc27 debug analyzer test on windows
Review-Url: https://codereview.chromium.org/2717873002 .
2017-02-25 11:59:22 -05:00
danrubel acd7a294e5 Revert "debug Windows tests"
This reverts commit 3bf53bdb0a.

Review-Url: https://codereview.chromium.org/2717783003 .
2017-02-25 11:55:29 -05:00
danrubel 3bf53bdb0a debug Windows tests
Review-Url: https://codereview.chromium.org/2714883005 .
2017-02-25 10:57:12 -05:00
danrubel 289888cd0e enhance ContextBuilder getAnalysisOptions to handle lints
This updates ContextBuilder to process the --lints command line option:
* --[no-]lints enables (or disables) lints
* if --lints but no lints specified in analysis options
    then the default set of lints is used
* if --no-lints then lints are turned off
    regardless of what is specified in the analysis options
* if neither --lints nor --no-lints are specified
    then lints are turned on iff analysis options specifies lints

My next step is to update analyzer_cli to use ContextBuilder getAnalysisOptions

R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2716693003 .
2017-02-23 16:23:43 -05:00
Brian Wilkerson f364eb1ab8 Possible fix for 28038
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2681153002 .
2017-02-13 07:50:45 -08:00
danrubel 663f2dc5d6 workaround failing windows test
Review-Url: https://codereview.chromium.org/2669513003 .
2017-01-31 09:25:15 -05:00
danrubel da3c566869 workaround failing windows test
Review-Url: https://codereview.chromium.org/2662123003 .
2017-01-31 09:17:12 -05:00
Dan Rubel 60e38fb406 improve analysis options include test
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2664893003 .
2017-01-30 16:18:42 -05:00
Dan Rubel 23f92339a4 detect flutter and use default analysis options for flutter
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2666693002 .
2017-01-30 15:48:04 -05:00
Dan Rubel 7208fdaba8 workaround failing source factory test on Windows
Review-Url: https://codereview.chromium.org/2667683002 .
2017-01-30 15:09:19 -05:00
Dan Rubel 3dba1f9e36 implement default analysis options in bazel
* if no analysis options file is found using the default search algorithm,
  check for options in package:dart.analysis_options/default.yaml
* implement common workspace superclass

R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2660173002 .
2017-01-30 13:59:43 -05:00
Dan Rubel 39b6fc1287 fix SourceFactoryImpl restoreUri
Fix https://github.com/flutter/flutter/issues/7636

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2659333003 .
2017-01-30 13:05:47 -05:00
Konstantin Shcheglov 2acfb1d818 ContextBuilder should to throw when a root folder does not exist.
Otherwise, removing an analysis root with .analysis_options file
causes an exception.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2660073002 .
2017-01-29 09:37:24 -08:00
Paul Berry c9b692e8d9 Add a temporary analyzer error to work around #28515
Analyzer summaries do not yet support generic function-typed
parameters.  To avoid user confusion, generate an error if the user
tries to use a generic function-typed parameter.

The error can be worked around by using a typedef or changing generic
types to `dynamic`.

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

Review-Url: https://codereview.chromium.org/2656303004 .
2017-01-29 07:35:03 -08:00
Jennifer Messerly 0e00b3e5c8 fix #28008, fix #28009 implement FutureOr<T>
This implements FutureOr<T> in strong mode, otherwise it's ignored (treated as `dynamic`.

Also fixes strong mode's inference subtype function incorrectly treating `void` as a malformed type. This had the consequence of allowing `void` to be inferred as a type argument.

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

Review-Url: https://codereview.chromium.org/2647833002 .
2017-01-25 15:32:57 -08:00
Konstantin Shcheglov f1f5d490d7 Fix MockSdk.fromFileUri() implementations.
This should fix the test failure on Windows bot.

TBR

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2653753006 .
2017-01-25 12:08:25 -08:00
Konstantin Shcheglov 608cb122e3 Fix for dart:html query() type inference.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2656673003 .
2017-01-25 06:56:28 -08:00
Konstantin Shcheglov 5f6ea67c1e Make Analysis Server tests use MockSdk again.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2650803005 .
2017-01-24 13:49:48 -08:00
Konstantin Shcheglov 207dc4a5a1 Update MockSdk to be more consistent with the actual SDK, switch x_Driver tests to it.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2657533004 .
2017-01-24 12:53:48 -08:00
Konstantin Shcheglov 3e80ae9304 Make Stream abstract as it is in the actual SDK.
This requires fixes for inference tests.

R=brianwilkerson@google.com, jmesserly@google.com, leafp@google.com
BUG=

Review-Url: https://codereview.chromium.org/2654733003 .
2017-01-24 12:50:52 -08:00
Konstantin Shcheglov 320fff61d4 Make Future.value() constructor in MockSdk consistent with the actual SDK.
R=brianwilkerson@google.com, jmesserly@google.com, leafp@google.com
BUG=

Review-Url: https://codereview.chromium.org/2651653006 .
2017-01-24 12:34:37 -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
Brian Wilkerson cfcfe7a5cf Add access to FutureOr in TypeProviders (and add implementation in mock sdks)
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2581803002 .
2016-12-15 12:55:54 -08: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 86c62a6bad Remove the command-line plugin
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2565993002 .
2016-12-11 10:59:19 -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
Brian Wilkerson c75c14db54 Only generate summaries, in tests, when necessary
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2547953002 .
2016-12-02 12:01:51 -08:00
Brian Wilkerson e17e359faa Create summary files in MockSdk classes
Review URL: https://codereview.chromium.org/2542853003 .
2016-12-02 07:32:39 -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 be507709ed update builder test for Windows
Review URL: https://codereview.chromium.org/2510713002 .
2016-11-16 09:50:56 -05:00
Dan Rubel abffe25b7d integrate analysis options include directive into context builder
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2505753002 .
2016-11-16 08:25:43 -05:00
Konstantin Shcheglov e7350d171e Don't serialize elements of top-level function/constructor/method bodies.
Instead in DeclarationResolver build these local elements in the bodies.

As you can see, the summary_common tests are quite ugly now, we decided
that we still have to serialize everything in variable initialiers,
including local functions. So, this requires repurposing the tests to
using initializers, and also keep buildLabelElements() in
DeclarationResolver.

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

Review URL: https://codereview.chromium.org/2485043004 .
2016-11-08 19:19:46 -08:00
Paul Berry f9c55af608 Avoid writing to the same parts of the element model in two tasks.
Previous to this change, ResolveUnitTypeNamesTask would set types to
`dynamic` if there was no explicit type in the source code, and
InferInstanceMembersInUnitTask would overwrite those types with
inferred types.  This caused a problem if the result of
ResolveUnitTypeNamesTask got flushed due to memory pressure, but the
result of InferInstanceMembersInUnitTask did not.  In that case, the
task model would come back at a later time and re-run
ResolveUnitTypeNamesTask, causing the inferred types to be set back to
`dynamic`.  But it would not re-run InferInstanceMembersInUnitTask.
As a result, the inferred type would be lost.  This manifested as a
sporadic failure to inferred types in analysis server.  Annoyingly,
edits to the file(s) involved would frequently cover up the problem
(temporarily) since they would invalidate the cache entries, forcing
the task model to re-run both tasks.

This CL fixes the problem by adding _declaredType and
_declaredReturnType fields to the element model;
ResolveUnitTypeNamesTask writes to those.
InferInstanceMembersInUnitTask continues to write to _type and
_returnType, as it always has.  When a type or return type is
requested from the element model, the getter consults _type (or
_returnType) first; only if it is null does it fall back to
_declaredType (or _declaredReturnType).

This gives us the behavior we need (inferred types override the
implied "dynamic" type stored by ResolveUnitTypeNamesTask), but since
the two tasks are now writing to different fields in the element
model, it is now safe to re-run ResolveUnitTypeNamesTask--it will no
longer overwrite the inferred types.

Fixes #27482.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/2480783003 .
2016-11-04 16:44:28 -07:00
Paul Berry 396d7862b4 More improvements to DeclarationResolver.
This CL makes the following improvements:

- When visiting an executable element, local variables and labels are
  rebuilt rather than matching them up to the old element model.  This
  ensures that if the element model was resynthesized from an API
  summary (which doesn't contain local variables or labels), these
  elements are not lost.

- When matching up existing elements, if the elements did not
  previously contain offsets, offsets are recorded.  If they did
  previously contain offsets, the offsets are compared to verify that
  they match.  This ensures that if the element model was
  resynthesized from an API summary (which doesn't contain offsets),
  the offsets will be correct.

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

Review URL: https://codereview.chromium.org/2435313002 .
2016-10-21 11:13:55 -07:00
Paul Berry 74d8298777 Fix handling of default formal parameters in DeclarationResolver.
When visiting a DefaultFormalParameter, we can't call
super.visitDefaultFormalParameter, because that would cause the
default value to be visited twice.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2438113002 .
2016-10-20 12:34:16 -07:00
Brian Wilkerson 96750cd5cb Split out options from ContextBuilder
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2425423009 .
2016-10-20 11:03:11 -07:00
Paul Berry 4729ba0055 In DeclarationResolver, handle generic function-typed parameters.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2441483002 .
2016-10-19 14:21:52 -07:00
Paul Berry 148af481ff Fix DeclarationResolver handling of annotations containing closures.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2436733004 .
2016-10-19 13:23:11 -07:00