Commit Graph

4276 Commits

Author SHA1 Message Date
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
Dan Rubel 46b0c1da56 merge fasta.Keyword into analyzer.Keyword
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2797133008 .
2017-04-06 16:52:01 -04:00
Dan Rubel 4b8a2eb03b enhance analyzer to parse uppercase and built-in/pseudo keywords
Retrying https://codereview.chromium.org/2803563003

* update analyzer.Keyword list to include all of the fasta keywords

* enhance the analyzer scanner keyword table to handle uppercase
  keywords such as "Function"

* update analyzer's parser to process the new KeywordTokens

* fix analyzer error verification

* update translation of fasta <--> analyzer tokens

* update tests and cleanup analyzer warnings

R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2799133003 .
2017-04-06 15:24:53 -04:00
Konstantin Shcheglov 1b0b94c6e6 Fix for parsing annotations before variables in for-loop with Fasta.
R=paulberry@google.com, ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2797303003 .
2017-04-06 10:59:53 -07:00
Konstantin Shcheglov b65cd81b45 Use modifiable top-level scope for Fasta parser in file_state.
R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2798183002 .
2017-04-06 10:26:26 -07:00
Peter von der Ahé 32e2d2af84 Handle const list and map literals.
R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2802693004 .
2017-04-06 14:51:35 +02:00
danrubel e7f700ae66 Revert "enhance analyzer to parse uppercase and built-in/pseudo keywords"
This reverts commit 0c9e871b0f.

Review-Url: https://codereview.chromium.org/2797353002 .
2017-04-05 17:27:41 -04:00
Dan Rubel 0c9e871b0f enhance analyzer to parse uppercase and built-in/pseudo keywords
* update analyzer.Keyword list to include all of the fasta keywords

* enhance the analyzer scanner keyword table to handle uppercase
  keywords such as "Function"

* update analyzer's parser to process the new KeywordTokens

R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2803563003 .
2017-04-05 16:37:30 -04:00
Konstantin Shcheglov c9407b4544 Include ':' before constructor separators into AST with Fasta.
R=paulberry@google.com, ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2802753002 .
2017-04-05 13:25:46 -07:00
Dan Rubel a370462274 move fasta.Keyword methods to analyzer.Keyword
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2800583002 .
2017-04-05 13:51:53 -04:00
Adam Barth c25cd4da33 Restrict @immutable checks to instance fields
R=brianwilkerson@google.com, pquitslund@google.com

Review-Url: https://codereview.chromium.org/2805443002 .
2017-04-05 10:50:41 -07:00
Peter von der Ahé 0fcc4ee024 Implement parsing of metadata on local variables.
R=johnniwinther@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2798603003 .
2017-04-05 19:12:42 +02:00
Brian Wilkerson c2f599473b Fix generic function types in variable declarations (issue 29237)
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2798663003 .
2017-04-05 06:24:25 -07:00
Konstantin Shcheglov 03a0ee0943 Include 'invokeMethodRef' reference as a linking dependency.
It was crashing with StackOverflow internally. With changes since the
latest internal release it was not crashing, but still failing with
assertion. This makes it fail with a correct error, without throwing
an exception.

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

Review-Url: https://codereview.chromium.org/2802473002 .
2017-04-04 14:35:52 -07:00
Konstantin Shcheglov 16e9641583 Build elements for FieldFormalParameter(s) even for local functions.
This is invalid code, we report an error, but we cannot leave it as
null, because this causes exceptions down the stream.

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

Review-Url: https://codereview.chromium.org/2800443002 .
2017-04-04 12:45:11 -07:00
Konstantin Shcheglov a5d8f67ea5 Move tests for parseVariableDeclarationList(), fix for keywords.
R=paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2796123002 .
2017-04-04 12:41:41 -07:00
Konstantin Shcheglov 83f6ef67a8 Fix for resynthesis when a part URI is empty.
This is about 20% of all internal exceptions.

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

Review-Url: https://codereview.chromium.org/2789113005 .
2017-04-04 12:31:49 -07:00
Paul Berry 80101ac407 Re-duplicate frontend_accessors.dart.
This was de-duped in 02573b3caa, however
there's a problem: In order to share type inference and error
detection logic between Fasta's AstBuilder and BodyBuilder classes,
Fasta's use of the accessors needs to be rewritten to make use of the
shadow hierarchy (see
pkg/front_end/lib/src/fasta/builder/shadow_ast.dart), which kernel
shouldn't have to depend on.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2794013003 .
2017-04-04 10:48:50 -07:00
Dan Rubel b5b64e98e9 fix fasta/analyzer KeywordToken.value()
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2795243002 .
2017-04-04 10:52:00 -04:00
Dan Rubel 75a608b761 fasta tokens implement analyzer token API
* finish making fasta tokens implement analyzer token API

* move a couple things from analyzer into front_end
   * Scanner useFasta flag
   * SyntheticKeywordToken
   * SyntheticStringToken

* add a fastaSupportsGenericMethodComments flag to more easily find
  all of the places in the code that need to be addressed
  when this functionality is added or dropped

* initialize linestarts in scanner adapter
* cleanup analyzer hints

R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2794653002 .
2017-04-04 08:55:44 -04:00
Peter von der Ahé 5fcbc900a6 Prepare for separate setter scope.
R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2788913002 .
2017-04-04 12:20:16 +02:00
Peter von der Ahé 68ae077161 Make top-level scope implicit.
R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2785883005 .
2017-04-04 11:35:16 +02:00
Peter von der Ahé babf66241f Move scope.dart.
R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2794533002 .
2017-04-04 11:00:43 +02:00
Leaf Petersen e121d95b1b Fix missing partial type in downwards map inference.
Fixes https://github.com/dart-lang/sdk/issues/29231 .  Fixes
regression in inference on map literals in which partial types were
being prematurely eliminated during downwards inference.

BUG=
R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2795893002 .
2017-04-03 17:03:13 -07:00
Konstantin Shcheglov ed1152fe8d Scan generic method comments with Fasta.
R=paulberry@google.com, ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2792053002 .
2017-04-03 12:01:54 -07:00
Konstantin Shcheglov cd5de6deef Convert constructor initializers in endInitializers() and other tweaks.
R=paulberry@google.com, ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2793113002 .
2017-04-03 11:59:39 -07:00
Brian Wilkerson dd49e79f74 Add context information to driver and add hooks for plugin management
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2795743002 .
2017-04-03 10:13:45 -07:00
Devon Carew 3fd497b510 Ignore some uses of deprecated APIs.
BUG=

Review-Url: https://codereview.chromium.org/2796483002 .
2017-04-03 08:31:00 -07:00
Brian Wilkerson e3aa3b8ea9 Fix support for uri in part-of directive
R=jcollins@google.com

Review-Url: https://codereview.chromium.org/2786853003 .
2017-04-03 07:35:46 -07:00
danrubel 1fbca8be94 cleanup scanner
Review-Url: https://codereview.chromium.org/2784353003 .
2017-03-31 08:41:51 -04:00
Brian Wilkerson ad54733d46 Convert top-level inference errors to hints
Review-Url: https://codereview.chromium.org/2786993002 .
2017-03-30 12:45:55 -07:00
Dan Rubel c22c6bad6c flag to enable fasta scanner in analyzer
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2784363002 .
2017-03-30 14:16:12 -04:00
Janice Collins 37330be1b9 Expose function contained in GenericTypeAliasImpl.
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2787513003 .
2017-03-30 09:08:46 -07:00
Kasper Lund 25c6c8811a Take analysis options into account when computing the severity of a strong mode "error".
This allows users to opt into the strong mode hints by turning them into warnings or errors in their analysis options files.

R=leafp@google.com, vsm@google.com
BUG=

Review-Url: https://codereview.chromium.org/2784473004 .
2017-03-30 09:39:38 +02:00
Konstantin Shcheglov 16e7ab8d17 Don't disable downward inference inside initializers used for top-level inference.
So, I'm removing this flag that didn't allow us to perform invocation
type inference and caused bogus STRONG_MODE_INVALID_CAST_NEW_EXPR errors.

This causes us to perform inference where we don't need it, and report
(only informational?) info:INFERRED_TYPE_ALLOCATION for these invocations.
At the same point, we report errors for these cases, which should be
fixed anyway, and then downward inference will not be performed anymore.

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

Review-Url: https://codereview.chromium.org/2779003004 .
2017-03-29 09:23:57 -07:00
Peter von der Ahé a62c5631bf Use message.yaml in parser.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2778213002 .
2017-03-29 11:02:23 +02:00
Konstantin Shcheglov 84a4b01081 Store literal values and invocations arguments only for constants and untyped literals.
1. When a literal is typed, and is not a constant, we don't need its
   elements for type inference. Moreover, in this case elements are
   allowed to include nodes that are not immediately-evident expressions,
   such as instance creations without all type arguments, closures with
   block bodies, etc.

2. When a literal is a constant, so we still have to serialize all its
   elements, it is possible that we will encounter something not allowed
   for immediately-evident expressions, and fail. But that's OK, because
   such expressions are also not allowed in constants, so we will have
   a compile time error anyway, and IMHO it is OK to degrade a little
   in presence of errors.

3. The same is true for method invocations and instance creations,
   we need to serialize arguments only for constants, because top-level
   inference never uses arguments to infer returned types.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2779993002 .
2017-03-28 14:13:55 -07:00
Janice Collins a5ebc58cef fix return type of computeNode.
BUG=
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2778253002 .
2017-03-28 13:11:41 -07:00