Commit Graph

3354 Commits

Author SHA1 Message Date
Konstantin Shcheglov a73c8d0de1 MethodElementImpl.getReifiedType() should always create new parameter elements.
If we don't, and we transplant any of them into a new detached instance
of synthetic FunctionElementImpl, they are not able to access later
enclosingUnit in order to resynthesize their type.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2829843002 .
2017-04-19 16:36:34 -07:00
Mike Fairhurst 746fd35307 Now that contextRoot is within the is check, don't need contextRoot at all
BUG=
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2828103002 .
2017-04-19 15:45:20 -07:00
Sigmund Cherem b57ca9fb55 Fix front-end tests: the original code is correct, this is a workaround for issue #29393
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2834533002 .
2017-04-19 15:37:03 -07:00
Konstantin Shcheglov 7faf4bac93 Add FileSystemState.knownFilesSetChanges stream.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2826243002 .
2017-04-19 13:23:34 -07:00
Brian Wilkerson a3102bf441 Add support for reporting plugin data to instrumentation
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2834453002 .
2017-04-19 11:01:24 -07:00
Jacob Richman 6ac3a24a2e Run formatter on the analyzer.
BUG=
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2826693004 .
2017-04-19 08:24:09 -07:00
Mike Fairhurst 0aa8574a04 Fix failure using custom drivers with AnalysisDriverScheduler
Or alternatively, the AnalysisDriverGeneric interface could be extended?

BUG=
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2815913006 .
2017-04-18 14:02:58 -07:00
Konstantin Shcheglov 955d7cf037 Fix for instance fields inference when a setter has no parameter.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2828573002 .
2017-04-18 12:26:38 -07:00
Konstantin Shcheglov 19353f9e63 Issue 29358. Fix for reporting constant errors while evaluating constructor invocations.
We should not report errors in one file using offsets of node in
another file.

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

Review-Url: https://codereview.chromium.org/2825813002 .
2017-04-18 12:13:23 -07:00
P.Y. Laligand bfdf42a8e0 GN workspaces now use packages files. (#29364)
The previous version would use a global cache of package locations which would hide missing dependencies.
Also fixed an issue in file tracking with non-existing sources that resolvers such as PackageMapUriResolver sometimes return.
2017-04-18 10:41:29 -07:00
Devon Carew 310d6d196b Fix an issue with restoring certain lint issues from summary files.
BUG=https://github.com/dart-lang/sdk/issues/29359
R=brianwilkerson@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2821943003 .
2017-04-18 08:50:22 -07:00
Konstantin Shcheglov f3fd6d5e44 Add the missing space before 'in'.
R=pquitslund@google.com, brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2824113002 .
2017-04-18 08:32:12 -07:00
Konstantin Shcheglov 0adb817be2 Fix cast exception when a Handle gets a wrong element because of name conflict.
For example:

type 'TopLevelVariableElementImpl' is not a subtype of type 'FunctionTypeAliasElement' in type cast where
  TopLevelVariableElementImpl is from package:analyzer/src/dart/element/element.dart
  FunctionTypeAliasElement is from package:analyzer/dart/element/element.dart

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2824873002 .
2017-04-17 14:52:31 -07:00
Konstantin Shcheglov 62320cc838 Issue 25558. Report an error, but don't crash when AST it too deep.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/25558

Review-Url: https://codereview.chromium.org/2823993002 .
2017-04-17 14:46:55 -07:00
Konstantin Shcheglov 63a6f83739 Issue 29360. Fix type name resolution for GenericTypeAliasElement.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/29360

Review-Url: https://codereview.chromium.org/2827463002 .
2017-04-17 10:16:28 -07:00
Vijay Menon a3d2e49198 Revert "Revert "Report error if the same uri appears in multiple summaries.""
Relanding after fixing package_bundle_reader_test.dart.

Note, original CL (already reviewed here: https://codereview.chromium.org/2781483007/) is patch set 1.

Test fix is patch set #2.

R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2825503002 .
2017-04-17 10:11:21 -07:00
Vijay Menon dcdccf4750 Revert "Report error if the same uri appears in multiple summaries."
This reverts commit 2afa21bb2c.

Breaking the bots.

TBR=jmesserly@google.com
BUG=

Review-Url: https://codereview.chromium.org/2821933002 .
2017-04-17 08:07:36 -07:00
Vijay Menon 2afa21bb2c Report error if the same uri appears in multiple summaries.
Fixes #27025

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

Review-Url: https://codereview.chromium.org/2781483007 .
2017-04-17 07:32:59 -07:00
Konstantin Shcheglov 2d0d000611 Flush on write in FileByteStore.
We see (rarely, but still) situations when FileState attempts to read
a *.unlinked file, but the file is empty. We think that this happens
when the user's machine crashes, so files are created, but not fully
written to disk.

This change has its cost - increase of FileByteStore.put() CPU usage
from 7% to 10% on Mac.

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

Review-Url: https://codereview.chromium.org/2821683002 .
2017-04-14 10:53:22 -07:00
Brian Wilkerson fcac30e080 Reland: Fix more parser bugs
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2812243006 .
2017-04-14 07:26:29 -07:00
Konstantin Shcheglov 95cfe76812 Add a flag for caching all analysis results in the driver.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2818623003 .
2017-04-13 19:17:48 -07:00
Alan Knight 7bf59fac63 Revert "Fix more parser bugs"
This reverts commit 65f8d25aa0.

BUG=

Review-Url: https://codereview.chromium.org/2821483003 .
2017-04-13 10:07:40 -07:00
Brian Wilkerson 65f8d25aa0 Fix more parser bugs
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2817873003 .
2017-04-13 09:26:31 -07:00
Brian Wilkerson b277f1023c Fix parser error
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2809213005 .
2017-04-13 06:14:05 -07:00
Brian Wilkerson e30b56ccbe Fix another parser bug
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2808403005 .
2017-04-12 14:17:23 -07:00
Konstantin Shcheglov 54f845cfd2 Support for generic function as type arguments in DeclarationResolver.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2814223002 .
2017-04-12 13:47:23 -07:00
Brian Wilkerson 23f08ec04a Fix another parser issue with generic function types
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2814183002 .
2017-04-12 12:41:54 -07:00
Konstantin Shcheglov 5f28891e61 [Reapply] Pass ElementImpl as a context for resynthesizing types.
I added a couple of changes for link.dart to use context in getLinkedType().
I was not able to create a unit test for this case :-/

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2818543002 .
2017-04-12 11:54:23 -07:00
Brian Wilkerson e520fc2a45 More parser fixes for generic function types
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2817753002 .
2017-04-12 11:35:21 -07:00
Konstantin Shcheglov cb5bba03e2 Revert "Pass ElementImpl as a context for resynthesizing types."
This reverts commit d2a1bdff4a.

It causes an exception during pkg/analyzer analysis.

package:analyzer/src/fasta/mock_element.dart;package:analyzer/src/fasta/mock_element.dart;MockElement;accept
Unhandled exception:
NoSuchMethodError: Class 'CompilationUnitElementInDependency' has no instance getter 'typeParameterContext'.
Receiver: Instance of 'CompilationUnitElementInDependency'
Tried calling: typeParameterContext

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2814163002 .
2017-04-12 10:45:41 -07:00
Konstantin Shcheglov 7696ec5f31 Support for using generic function types in other AST structures.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2814063003 .
2017-04-12 10:12:30 -07:00
Brian Wilkerson dd150dd348 Correctly recognize non-constant enum children (issue 29306)
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2815093002 .
2017-04-12 09:43:14 -07:00
Konstantin Shcheglov 2143087734 Build GenericFunctionTypeElementImpl in both ApiElementBuilder and LocalElementBuilder.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2809423003 .
2017-04-12 09:39:31 -07:00
Konstantin Shcheglov d2a1bdff4a Pass ElementImpl as a context for resynthesizing types.
We need to do this in order to associate resynthesized
GenericFunctionTypeElementImpl instances with these enclosing ElementImpl
instances. The same enclosing ElementImpl can also be used to get
the TypeParameterizedElementMixin for accessing type parameters.

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

Review-Url: https://codereview.chromium.org/2813543007 .
2017-04-12 09:35:56 -07:00
Brian Wilkerson 492eab84ec Fix parsing of generic function types as return types
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2809773005 .
2017-04-12 07:27:39 -07:00
Brian Wilkerson 3dcf0e31c5 Split error code to ease future improvements
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2813553006 .
2017-04-11 13:35:38 -07:00
Konstantin Shcheglov 6fe8e2278b Simplify PackageMapUriResolver - one folder, return any file, or null.
If the package is know, we return the corresponding file, whether it
exists or not.

If the package is not know, there is no valid Source to resolve to,
so we return null.

We don't need all the features that existed.

Internally we switched to BazelPackageUriResolver, which has its own
logica for searching files in workspaces across multiple folders.

All the places where we create PackageMapUriResolver in analyzer
or analysis_server, we create it with exactly one folder.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2812093002 .
2017-04-11 13:03:56 -07:00
Konstantin Shcheglov 38e8b1509e Issue 29109. Resynthesize PrefixElement(s) to fix constants evaluation.
R=brianwilkerson@google.com, paulberry@google.com
BUG= https://github.com/dart-lang/sdk/issues/29109

Review-Url: https://codereview.chromium.org/2815713003 .
2017-04-11 11:28:03 -07:00
Konstantin Shcheglov 3dd42456e4 Prioritize analysis of files that import the changed file, or have an error or warning.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2808173002 .
2017-04-11 08:26:26 -07:00
Konstantin Shcheglov f0ae30dca5 Fix for summarization of generic function type aliases and support for resynthesizing.
This is based on your CL https://codereview.chromium.org/2808093004/ and
includes fixes for summarization and resynthesis.

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

Review-Url: https://codereview.chromium.org/2814443005 .
2017-04-11 07:07:16 -07:00
Konstantin Shcheglov 2c46a154b8 Drop the 'analyzeWithoutTasks' flag for AnalysisDriver.
We're not going back, I think.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2806353005 .
2017-04-10 16:56:56 -07:00
Konstantin Shcheglov 3e9d358131 Add missing checks for null imported/exportedLibraries.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2812673002 .
2017-04-10 11:29:38 -07:00
Brian Wilkerson 69fa11d912 Fix compilation errors
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2807103003 .
2017-04-10 08:04:33 -07:00
Konstantin Shcheglov 021d99e05d Issue 29288. Resynthesize Import/Export/PartElement for every directive.
We need all of them because there might be associated annotations,
which should be applied to corresponding AST nodes.

https://github.com/dart-lang/sdk/issues/29288
https://github.com/dart-lang/sdk/issues/29188

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

Review-Url: https://codereview.chromium.org/2809523002 .
2017-04-09 10:12:43 -07:00
Vijay Menon bc3089838c Reify implicit casts for FutureOr
Before landing, two issues to resolve:
(1) We appear to allow sideways casts now without static error - e.g.,

List<Object> -> FutureOr<List<String>>

Is that intended?  If so, it breaks an assumption that implicit casts
are from supertype to subtype.

(2) LUB and FutureOr

It appears that the LUB of, e.g., String and Future<String> is Object.
See fixes in tests to record casts back to FutureOr.

Fixes #29251

R=leafp@google.com

Review-Url: https://codereview.chromium.org/2801683004 .
2017-04-07 17:33:34 -07:00
Konstantin Shcheglov 07347d84fc Parse type substitution comments /*=T*/ in variable declarations with Fasta.
R=paulberry@google.com, ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2804753003 .
2017-04-07 12:59:02 -07:00
Konstantin Shcheglov ee89054fe9 Issue 29288. When infer new FunctionType, makes its FunctionElement own its ParameterElement(s).
Never share.

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

Review-Url: https://codereview.chromium.org/2799093007 .
2017-04-07 12:21:53 -07:00
Brian Wilkerson 1910147425 Partial fix for generic function types - non-driver case
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2802203003 .
2017-04-07 11:17:37 -07:00
Konstantin Shcheglov 80a935bd76 Fix for parsing named factory constructors with Fasta.
R=paulberry@google.com, ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2803113002 .
2017-04-06 14:11:57 -07:00
Konstantin Shcheglov 8c8a02ab4f Support for parsing native function bodies with Fasta.
R=paulberry@google.com, ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2797343003 .
2017-04-06 14:00:44 -07:00