Commit Graph

2927 Commits

Author SHA1 Message Date
Peter von der Ahé 0401b89795 Fix hints and warnings.
R=johnniwinther@google.com, paulberry@google.com

Review-Url: https://codereview.chromium.org/2659403002 .
2017-02-01 13:04:40 +01:00
Konstantin Shcheglov 54c8496a38 Fix for resynthesizing invalid elements as type arguments of declared types.
Reproduced using Brian's stress test.

R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2662983005 .
2017-01-31 14:28:31 -08:00
Konstantin Shcheglov 17077ff2e0 Catch Uri.parse() FormatException and skip the URI.
You saw it, and the stress test reproduced it too.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2664313002 .
2017-01-31 13:55:48 -08:00
Brian Wilkerson aad0e850a2 Revert "First step toward resolving generic function types" (TBR)
Review-Url: https://codereview.chromium.org/2660403005 .
2017-01-31 13:10:12 -08:00
Konstantin Shcheglov 8835fe34fd The file is a library, if it has a 'library' directive.
With these changes analyzer_cli with the new analysis driver can pass
the same shared tests as the AnalysisContext based analyzer_cli.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2662363002 .
2017-01-31 13:06:55 -08:00
Paul Berry acf5b16a5f Isolate the part of AnalysisDriver that manages the AnalysisContext.
I re-used the existing class _LibraryContext, but moved it to its own
file and gave it a public API so that the rest of the AnalysisDriver
doesn't have to deal with the AnalysisContext directly.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2661023005 .
2017-01-31 12:33:45 -08:00
Konstantin Shcheglov c55185d9d7 Fix for PartDirective annotations while applying resynthesized element model.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2662173004 .
2017-01-31 11:45:03 -08:00
Konstantin Shcheglov c74771b43d Don't resolve FieldFormalParameter field if not in constructor.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2663063004 .
2017-01-31 11:16:16 -08:00
Brian Wilkerson 0737b3d2be First step toward resolving generic function types
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2654653003 .
2017-01-31 09:56:28 -08:00
Konstantin Shcheglov b8aca22c6a Issue 28550. Fix for resynthesizing invalid elements as declared types.
R=paulberry@google.com
BUG= https://github.com/dart-lang/sdk/issues/28550

Review-Url: https://codereview.chromium.org/2665013002 .
2017-01-31 09:26:31 -08:00
Konstantin Shcheglov 2a10f4bbb7 Don't resynthesize field types during class members resynthesis.
Invalid code might cause recursion and stack overflow.
And actually we might not need this type at all.

R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2661123002 .
2017-01-31 08:28:43 -08:00
Konstantin Shcheglov 6595c05864 Actually limit number of stored exception contexts.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2666003002 .
2017-01-31 07:10:39 -08:00
Paul Berry d8fc3630cf Move resolveRelativeUri into front_end.
Note: I removed the exception wrapping code as part of the migration.
Rationale: this function performs a small task and has been operating
successfully for a long time; removing the exception wrapping code
avoids making front_end dependent upon AnalysisException and
CaughtException at this time.  In the unlikely event that an exception
occurs in this function, we still have many avenues available for
tracking down the problem: examine the stack trace of the exception,
isolate a repeatable test case (if the exception happened in
e.g. command-line analyzer), or reproduce the exception from file
state information recorded by the AnalysisDriver (if the exception
happened in analysis server).

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2668553002 .
2017-01-30 15:05:52 -08:00
Konstantin Shcheglov 760347dbae Issue 28547. Fix for summarizing code with invalid type parameter reference.
R=paulberry@google.com
BUG= https://github.com/dart-lang/sdk/issues/28547

Review-Url: https://codereview.chromium.org/2668493002 .
2017-01-30 13:37:24 -08:00
Konstantin Shcheglov f1ecb1eaec Reset serialized expression to empty on StateError.
There is no point in keeping partial expression and fail during resynthesis.

R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2662963003 .
2017-01-30 13:24:43 -08:00
Paul Berry b3237d0ad8 Remove analyzer workaround for #27447.
This issue was fixed in the SDK sufficiently long ago that it doesn't
seem necessary to keep the workaround in analyzer.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2662033002 .
2017-01-30 13:04:26 -08:00
Konstantin Shcheglov d29ba1e238 Store exceptions with transitive files context into ByteStore.
The key under which the exception context is stored, is included into
ExceptionResult, so Analysis Server can include the key into the message.

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

Review-Url: https://codereview.chromium.org/2663903002 .
2017-01-30 12:57:44 -08: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
Konstantin Shcheglov 6f43bc6aea Serialize prefixes directly, without intermediate map.
R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2667693002 .
2017-01-30 12:27:10 -08:00
Paul Berry 79b810ebc0 Allow SDKs to be analyzed that lack a definition of FutureOr<T>.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2668473002 .
2017-01-30 12:19:17 -08:00
Paul Berry f661493fd2 Fix summary type inference for async closures with FutureOr<T>.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2665813002 .
2017-01-30 12:14:32 -08:00
Paul Berry 62b6e8995a Remove class FastUri from analyzer.
After FastUri was introduced, Dart's native Uri implementation was
significantly improved (see afbbbb97cf)
to the point where FastUri no longer provides a significant speed
boost.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2667633004 .
2017-01-30 12:05:04 -08: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
Brian Wilkerson e9fa1bbda6 Adapt to breaking change in SDK
Review-Url: https://codereview.chromium.org/2660243002 .
2017-01-30 08:45:28 -08:00
Konstantin Shcheglov 70dd81dd37 Issue 28491. Add support for UnlinkedExprOperation.pushSuper even though it is not allowed.
R=brianwilkerson@google.com, paulberry@google.com
BUG= https://github.com/dart-lang/sdk/issues/28491

Review-Url: https://codereview.chromium.org/2661803002 .
2017-01-29 10:05:35 -08: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 4974b71709 fix #28519, assertion incorrectly triggering
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2664643002 .
2017-01-29 00:26:35 -08:00
Konstantin Shcheglov f2c49e661e Fix for invalid 'extends/implements/with SomeEnum'.
This was was resulting crashes internally.

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

Review-Url: https://codereview.chromium.org/2655243007 .
2017-01-28 10:19:05 -08:00
Konstantin Shcheglov 0db78056db Resynthesize invalid types as 'dynamic'.
There are 7 instances of this UnimplementedError internally.

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

Review-Url: https://codereview.chromium.org/2658123004 .
2017-01-28 10:11:09 -08:00
Konstantin Shcheglov bda0e7ba41 Infer UnlinkedExprOperation.pushThis as dynamic.
R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2661793002 .
2017-01-28 10:06:31 -08:00
Leaf Petersen a6138dad2a Relax type bound restrictions slightly, apply to typedefs.
This relaxes the restriction on raw types in bounds slightly, to allow
parameterized types in bounds to be used without type arguments if
their bounds are empty.

This CL also fixes the error check for raw types in type bounds to
apply to typedefs as well.

BUG=
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2658303002 .
2017-01-27 18:05:03 -08:00
Jennifer Messerly 39977ac6ec fix #28526, await FutureOr<T>
fix #28527, FutureOr<T> subtyping with type parameters

For subtyping: we've had a long standing issue in how inference reuses the <: operator code. Inference needs to make sure constraints are recorded on the type parameters we're inferring, but it also needs to correctly implement the future or union. This change addresses that & is a step towards the bigger inference change upcoming that tracks top/bottom constraints explicitly.

R=leafp@google.com

Review-Url: https://codereview.chromium.org/2655273008 .
2017-01-27 15:23:30 -08:00
Sigmund Cherem 2a3c83b452 Ignore missing entries in patching map
Some libraries have no patch files, this allows a user of the patch mechanism to
skip and not add an explicit entry for such libraries.

BUG=
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2651673016 .
2017-01-27 14:57:23 -08:00
Konstantin Shcheglov 8cca41772d Implement AnalysisDriver.getSourceKind() and use it in analyzer-cli.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2658983004 .
2017-01-27 14:29:44 -08:00
Konstantin Shcheglov 6bb8a923d3 Use AnalysisDriver.getErrors() to get cached errors for already analyzed files.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2656233004 .
2017-01-27 13:26:45 -08:00
Janice Collins 93c3a194ad Better error message for missing async with await
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2662483003 .
2017-01-27 10:48:27 -08:00
Konstantin Shcheglov 9c9cd98dd8 Fix for 'Concurrent modification during iteration' during search.
Found in internal logs.
Some people still use Dart Editor :-)

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2659103002 .
2017-01-27 09:53:03 -08:00
Konstantin Shcheglov 3de5551cc4 Complete with null, not return null as a Future.
I missed the fact that these methods are not async.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2664543002 .
2017-01-27 09:09:54 -08:00
Konstantin Shcheglov f28e8afb23 Ignore files that are hidden by generated files.
We cannot analyze them - their URIs will be resolved to other files,
element models will not correspond to ASTs, etc.

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

Review-Url: https://codereview.chromium.org/2654303003 .
2017-01-27 08:47:43 -08:00
Konstantin Shcheglov 2d318065b0 Fix for getFilesForPath() for a generated file.
This causes exceptions for internal users.
Not fatal, other files analysis is fine.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2655373002 .
2017-01-26 12:12:58 -08:00
Brian Wilkerson 9761ff14d4 Backout part of previous commit to fix bots
Review-Url: https://codereview.chromium.org/2645283009 .
2017-01-26 11:56:06 -08:00
Brian Wilkerson 59a9861743 Fix some bugs related to the covariant keyword
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2662433002 .
2017-01-26 11:27:42 -08:00
Konstantin Shcheglov a3cc5fe7f7 Implement using AnalysisDriver in analyzer_cli. Disabled.
It's not ready to be enabled yet.

There are 11 failing tests in tests/language, and 174 in tests/co19.

It also works about 5 times slower.

But I'd like to land it to make parallel changes to AnalysisDriver and
analyzer_cli to make it pass more tests and be faster.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2657903006 .
2017-01-26 10:16:52 -08:00
Konstantin Shcheglov 12191284aa Add NullByteStore, that does not store any data.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2653203005 .
2017-01-26 07:21:54 -08:00
Dan Rubel 236497901e Revert "add warning for deprecated .analysis_options file name"
This reverts commit b431498760.

Review-Url: https://codereview.chromium.org/2654223002 .
2017-01-25 23:03:03 -05:00
Dan Rubel b431498760 add warning for deprecated .analysis_options file name
This warns users about using the deprecated analysis options file name
and recommend that they rename it.
See https://github.com/dart-lang/sdk/issues/28385

R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2654043003 .
2017-01-25 22:00:36 -05: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 4cd790abe3 Record isFinal for parameters into summaries.
Found this out while running shared tests with the new analysis driver.

R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2657583007 .
2017-01-25 15:08:37 -08:00