Commit Graph

572 Commits

Author SHA1 Message Date
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
Paul Berry 2d3fe73b36 Fix tests of DartObject.hasKnownValue.
The tests were exercising the semantics of the old (deprecated) method
hasExactValue, and thus they were failing.

TBR=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1411083004 .
2015-10-19 07:32:54 -07:00
Brian Wilkerson 204ee60bd0 Add a public API for the results of constant evaluation
R=paulberry@google.com

Review URL: https://codereview.chromium.org/1410643003 .
2015-10-17 07:51:10 -07:00
Brian Wilkerson 40b38e988b Include parameter annotations in toSource (issue 24578)
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1408923002 .
2015-10-16 07:41:05 -07:00
pq 888c4c526f State-carrying context API.
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1403033002 .
2015-10-14 15:33:09 -07:00
Sigurd Meldgaard a763c71d92 Introduce the "Embedded" category.
It is not visible from the dart2js command line.

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

Committed: https://github.com/dart-lang/sdk/commit/0aef0efb6a38a65fa676fa9e8daa85a972521745
Reverted: https://codereview.chromium.org/1401513002

Review URL: https://codereview.chromium.org/1395863002 .
2015-10-12 12:15:48 +02:00
Konstantin Shcheglov ebdfa991d4 Issue 24538. Route SDK results into SDK context DartWorkManager.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/24538

Review URL: https://codereview.chromium.org/1399873002 .
2015-10-09 21:45:35 -07:00
Paul Berry 9af099fcdf Access types safely in TypeResolverVisior.visitMethodDeclaration()
Previously, when attempting to figure out the type of the synthetic
field associated with a getter (or setter),
TypeResolverVisitor.visitMethodDeclaration() used the getters
FunctionTypeImpl.returnType (or FunctionTypeImpl.normalParameterTypes)
to extract the appropriate type.  But those getters are only safe to
use after types have been fully constructed (because they may try to
perform type substitution).  Fortunately, type substitution isn't
needed here, so we can simply use FunctionTypeImpl.baseReturnType (or
FunctionTypeImpl.baseParameters) instead.

Fixes #24539.

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

Review URL: https://codereview.chromium.org/1397193002 .
2015-10-09 14:21:12 -07:00
Konstantin Shcheglov 14ab3cae4d Fix for top level variable documention ranges.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1396693004 .
2015-10-09 10:39:46 -07:00
Konstantin Shcheglov 4e6195fdf5 Issue 24514. Set documentation range for LibraryElement.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/24514

Review URL: https://codereview.chromium.org/1390003002 .
2015-10-06 16:13:57 -07:00
Konstantin Shcheglov ef434d6a9b Issue 24503. Disable type overrides for properties.
R=brianwilkerson@google.com, paulberry@google.com
BUG= https://github.com/dart-lang/sdk/issues/24503

Review URL: https://codereview.chromium.org/1386033003 .
2015-10-06 08:40:02 -07:00
Konstantin Shcheglov c4427ca8f4 Fix for incremental resolver - changing field formal parameter name is sometimes a non-incremental change.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1374313007 .
2015-10-06 08:35:07 -07:00
Brian Wilkerson 04c5a5f199 Clean up hints
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1382403002 .
2015-10-05 09:20:44 -07:00