Commit Graph

3034 Commits

Author SHA1 Message Date
Paul Berry a8acaa48db Merge remote-tracking branch 'origin/master' into analyzer-breaking-0.27 2015-12-02 08:15:45 -08:00
Leaf Petersen 64ab186b16 Downwards inference. This adds support to the resolver for downwards
type inference in strong mode.  Downwards inference is removed from
the DDC checker in favor of the strong mode analyzer version.

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

Review URL: https://codereview.chromium.org/1462133005 .
2015-12-01 15:40:27 -08:00
Konstantin Shcheglov 1b9c263b56 New NodeLocator which uses positions of characters, not between them.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1490933002 .
2015-12-01 13:59:11 -08:00
Paul Berry 617f9eea85 Merge remote-tracking branch 'origin/master' into analyzer-breaking-0.27 2015-11-27 08:07:24 -08:00
Leaf Petersen 77bd51c2dc Fix propagated argument element bug. This fixes #25040.
BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1477953002 .
2015-11-25 15:50:20 -08:00
Paul Berry 9a08061581 Add support for assert statements with messages to the analyzer.
Support is disabled by default.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1480433002 .
2015-11-24 15:50:45 -08:00
Konstantin Shcheglov cfb7d61a9c Issue 25034. Record only the target source's errors.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/25034

Review URL: https://codereview.chromium.org/1477553002 .
2015-11-24 14:00:00 -08:00
John Messerly 12c8e49364 add a failing test case to demonstrate a substitution issue
R=leafp@google.com

Review URL: https://codereview.chromium.org/1472183002 .
2015-11-24 13:43:57 -08:00
John Messerly 7feb6b7cb7 fix return type comment parsing for top-level generic function
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1465153005 .
2015-11-24 11:21:30 -08:00
Paul Berry b8bbdeb745 No functional change. Sort some files in pkg/analyzer.
TBR=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1468973004 .
2015-11-24 11:10:28 -08:00
John Messerly 0e6f692c80 generic method type parameter inference
This replaces the existing hard-coded "pseudo generic" methods with actually generic ones.

This updates the mock SDK's as well. It does not update the real SDK, that will be in another change that should be landed before this one.

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

Review URL: https://codereview.chromium.org/1442883003 .
2015-11-24 09:34:47 -08:00
Konstantin Shcheglov aa9668b264 Propagate types for import/export closure before resolving.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1465303002 .
2015-11-23 12:52:03 -08:00
Paul Berry ce7625a22c Buildbot fixes after 8c324a5b8d
- Regenerate tasks.dot

- Mark a test as passing that previously failed
  (fail_finalPropertyInducingVariable_classMember_instance_unprefixed)

Note that there are three other tests that I would have expected to
start passing as well (see
fail_finalPropertyInducingVariable_classMember_instance_*), but they
still fail.

TBR=scheglov@google.com

Review URL: https://codereview.chromium.org/1469093002 .
2015-11-23 09:04:43 -08:00
Brian Wilkerson 4ae8540383 Revert "Clean-up the registration of plugins"
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1465983004 .
2015-11-20 14:04:53 -08:00
Konstantin Shcheglov 0f477023a4 Don't update incrementally invalid results.
Invalid results don't have correct dependencies, so if we make them valid,
they will never get invalidated later.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1463833003 .
2015-11-20 12:29:20 -08:00
Brian Wilkerson 1367d2d47d Clean-up the registration of plugins
R=pquitslund@google.com

Review URL: https://codereview.chromium.org/1460123002 .
2015-11-20 08:14:14 -08:00
Konstantin Shcheglov b46dd600d0 Remove unused declarations - skip summaries and completion.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1462463004 .
2015-11-18 15:21:01 -08:00
John Messerly 2ce06f5325 sort type_system_test.dart
R=leafp@google.com

Review URL: https://codereview.chromium.org/1460853002 .
2015-11-18 13:26:17 -08:00
Brian Wilkerson 9d01b15fd2 Fix a bug parsing generic methods
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1459543002 .
2015-11-18 06:17:50 -08:00
John Messerly ec994696df skip new generic method test if task model is not on
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1456773002 .
2015-11-17 15:22:48 -08:00
John Messerly 09625df4a9 re-land Use FunctionElementImpl for inline function type parameters
This reverts commit 2990a0933a.

And fixes the test failure. The one additional change is in error_verifier.dart

Previous reviews:
(initial) https://codereview.chromium.org/1435153007/
(revert) https://codereview.chromium.org/1445273002/

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1447373002 .
2015-11-17 14:13:14 -08:00
John Messerly 9f938594bc skip task-model only tests if not running with task model
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1451243002 .
2015-11-17 12:37:13 -08:00
Konstantin Shcheglov de6925a23e Add ApplyChangesStatus to AnalysisContext.applyChanges() and use it in DAS.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1448173002 .
2015-11-16 19:42:15 -08:00
John McCutchan bb4d547a5d Add _embedder.yaml support to analyzer and analysis_server
- If a package has an '_embedder.yaml'  file with an 'embedder_libs' key two things happen:
  1) We do not use the DartUriResolver to resolve dart: libraries.
  2) We use the EmbedderUriResolver to resolve all dart: libraries

- If multiple packages have an '_embedder.yaml' file we merge them.
  - This might not be the final behaviour that we want but I'm not sure how to surface errors to the end user.

- The '_embedder.yaml' file has a top level key 'embedder_libs' which is a map from dart: library uri to source path. Other keys are ignored by the EmbedderUriResolver.

- Unit tests for analyzer
- Integration test for analysis_server.

R=pquitslund@google.com

Review URL: https://codereview.chromium.org/1437893003 .
2015-11-16 15:30:17 -08:00
John Messerly 2990a0933a Revert "Use FunctionElementImpl for inline function type parameters"
This reverts commit 79de8d8093.

Review URL: https://codereview.chromium.org/1445273002 .
2015-11-16 14:40:11 -08:00
John Messerly 79de8d8093 Use FunctionElementImpl for inline function type parameters
This lets it have the right enclosingElement, and thus typeParameters.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1435153007 .
2015-11-16 13:50:43 -08:00
John Messerly af7359853f tweak FunctionTypeImpl to support generic methods
The big change here is to ensure FunctionTypeImpl.typeArguments is always initialized to match the parameters. This was previously the case, because we'd explicitly use the class's type parameters. With generic methods, we can no longer rely exclusively on that source of type parameters.

We take advantage of enclosingElement to compute typeParameters from all containing scopes that can have them. By tracking all of the typeParameters, this allows substitution to work later.

Adds a few very basic tests. Please note that generic methods are not ready to use yet.

In particular this doesn't yet do the correct substitutions in StaticTypeAnalyzer. It also doesn't include (mostly done) inference to infer type parameters from the argument types. Further, discovered a missing feature from the previous parser CL. And finally, it doesn't include the kind of ErrorVerifier checks we'll likely need.

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

Review URL: https://codereview.chromium.org/1434983006 .
2015-11-13 14:52:42 -08:00
John Messerly 3cb4cdec03 initial generic method comment parsing
R=brianwilkerson@google.com, leafp@google.com

Review URL: https://codereview.chromium.org/1434863003 .
2015-11-11 16:27:27 -08:00
Paul Berry 74f09b99f1 Introduce code to generate summaries from an element model.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1420053011 .
2015-11-11 13:17:59 -08:00
Konstantin Shcheglov 574cef9ee7 Issue 24751. Report a compile time error when @static_field is used with arguments.
@static_field(args) should be evaluated, but it cannot be, so it's a compile time error.

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

Review URL: https://codereview.chromium.org/1436433002 .
2015-11-06 13:03:57 -08:00
Konstantin Shcheglov 2d41202422 Issue 24765. Don't re-resolve already resolved variable references.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/24765

Review URL: https://codereview.chromium.org/1416723011 .
2015-11-06 12:50:19 -08:00
pq 53d791d626 Option support for enableGenericMethods.
* Adds `enableGenericMethods` language configuration support to `.analysis_options`:

  analyzer:
    language:
      enableGenericMethods: true

  (with validation).

* Fixes `AnalysisOptionsImpl` to properly set (and copy) enableGenericMethods settings.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1412573012 .
2015-11-06 10:31:26 -08:00
Brian Wilkerson 10eb0659c6 Better error message when missing new or const
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1407903011 .
2015-11-06 06:15:18 -08:00
Brian Wilkerson a7f2f5b4e1 Revert "Compute propagated type for final instance fields (partially addresses issue 23001)"
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1428803004 .
2015-10-29 14:02:38 -07:00
Konstantin Shcheglov 851dc4ea97 Quick Fix for CAN_BE_NULL_AFTER_NULL_AWARE.
Also fix for false positive :-(

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1423993005 .
2015-10-29 13:47:17 -07:00
Brian Wilkerson 8e80648c56 Compute propagated type for final instance fields (partially addresses issue 23001)
R=paulberry@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1410493006 .
2015-10-29 11:36:11 -07:00
John Messerly 2503cb8eeb improve static type analysis for await for
This tries to do a full fix for https://github.com/dart-lang/sdk/issues/24191

The refactoring tries to unify how generic type substitutions are handled, so they always go through the (correct) mechanisms in the Element model.

This additionally should make it easier to add generic method type parameters in a future CL.

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

Review URL: https://codereview.chromium.org/1405143006 .
2015-10-29 11:17:18 -07:00
Konstantin Shcheglov 2529e684f0 Report hint when target of an invocation uses '?.', so can be null.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1423623005 .
2015-10-28 16:45:19 -07:00
pq 5accd7a72e Error code validation for error filters.
Screenshots and background can be found on the tracking bug: https://github.com/dart-lang/sdk/issues/24618

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

Review URL: https://codereview.chromium.org/1411053003 .
2015-10-28 16:37:34 -07:00
Konstantin Shcheglov 8f94e36a74 Check for potential null operand in Not expressions.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1427783003 .
2015-10-28 13:09:30 -07:00
Brian Wilkerson c687f29555 Add hint for use of ?. in conditions (issue 24649)
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1422813003 .
2015-10-28 08:28:42 -07:00
Konstantin Shcheglov c095ba1f91 Extract 'computeLineStarts' utility.
R=brianwilkerson@google.com, pquitslund@google.com
BUG=

Review URL: https://codereview.chromium.org/1411253007 .
2015-10-27 14:03:44 -07:00
Konstantin Shcheglov e2f905e11d Memory leak fix. Use correct analysis context for annotation constants.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1410573005 .
2015-10-27 11:04:27 -07:00
John Messerly 396ed51cf0 fixes #24713, remove old generic substitution code in _getTypeOfProperty
it looks like some old code was hanging around that tried to substitute generic type parameters by name. This is unnecessary because we already have a substituted type at this point, and the type variable we were substituting had no relationship at all with the parameter. After removing the code, all tests seem to be passing.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1409143009 .
2015-10-24 12:48:53 -07:00
pq 0881b53a3b Error reporting for spans.
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1418973002 .
2015-10-22 08:37:25 -07:00
Paul Berry 1a75281742 Rework handling of potentially-constant variables.
Previously, we had a mixin class PotentiallyConstVariableElement to
represent variables which might be constant.  This left some holes in
the type hierarchy which didn't implement
PotentiallyConstVariableElement but nonetheless could be reached by
constant evaluation code in the event of errors in the code being
analyzed, resulting in an invalid cast exception.

This CL drops PotentiallyConstVariableElement and moves its one getter
to VariableElementImpl so that it will be available to all variable
elements.  This allows us to avoid a lot of casts, including the one
that previously caused the exception.

Fixes #24645.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1416873003 .
2015-10-20 12:37:10 -07:00
Brian Wilkerson cc8f64b824 Do not generate warnings when noSuchMethod is inherited (issue 24337)
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1414003003 .
2015-10-20 10:35:53 -07:00
Konstantin Shcheglov 4249335a0e Improve incomplete for-each parsing.
Othewise a bizzare structure is returned with identifier in place of a semicolon.
It is easier for client to work with a more correct AST.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1413953003 .
2015-10-19 12:16:26 -07:00
Konstantin Shcheglov 78c7cde132 Improve recovery for local variable declarations.
We need this to improve code completion, and to *not* suggest method/keywords/etc
in cases like "main() {String s^}". Currently it is parsed as "main() {String; s^;}",
so completion cannot distinguish the variable name "s" from a of start a new expression.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1413773003 .
2015-10-19 10:24:21 -07:00
Paul Berry 6da5bb4ee4 Fix test_hasKnownValue_list_invalid
This test wasn't actually testing anything about lists, and was
redundant with test_hasKnownValue_dynamic.  Correcting the test to match
the probable intention.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1413123002 .
2015-10-19 09:40:24 -07:00