Commit Graph

7128 Commits

Author SHA1 Message Date
Brian Wilkerson 1601b9b264 Add checks for type bounds on generic methods
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1927103002 .
2016-04-28 12:46:05 -07:00
John Messerly d4a81f12fb fix #26334, allow supertypes for async function returns in strong mode
R=brianwilkerson@google.com, leafp@google.com

Review URL: https://codereview.chromium.org/1924113002 .
2016-04-28 09:57:06 -07:00
Leaf Petersen a781ab9a7d Make types concrete when checking overrides.
Override checking for methods should treat dynamic parameters as top,
not as bottom.

Fixes #26077
Fixes #26151
Fixes #26174

BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1921823007 .
2016-04-28 08:47:53 -07:00
Paul Berry 511528680a Add LibraryElementForLink.isDartCore.
Needed by InterfaceTypeImpl.isDartCoreFunction.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1928783002 .
2016-04-27 13:48:48 -07:00
Sam Rawlins 2cfa9c4665 @deprecated should work on 'called' objects
BUG=https://github.com/dart-lang/sdk/issues/9470

Example output:

$ cat -n a.dart
     1  class Foo {
     2    Foo foo;
     3
     4    @deprecated
     5    call(String name) {
     6      print("hello $name");
     7    }
     8  }
     9
    10  void main() {
    11    Foo f = new Foo();
    12    f("Thomas");
    13    f.foo = new Foo();
    14    f.foo("Timmy");
    15  }
$ xcodebuild/ReleaseX64/dart-sdk/bin/dartanalyzer a.dart
Analyzing [a.dart]...
[hint] 'Foo.call' is deprecated (/Users/srawlins/code/dart-repo3/sdk/a.dart, line 12, col 3)
[hint] 'Foo.call' is deprecated (/Users/srawlins/code/dart-repo3/sdk/a.dart, line 14, col 3)
2 hints found.

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

Review URL: https://codereview.chromium.org/1922563003 .
2016-04-27 13:40:02 -07:00
Sam Rawlins 7cb775f149 provide MISSING_RETURN on factory constructors
BUG=https://github.com/dart-lang/sdk/issues/17121
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1923593002 .
2016-04-27 12:33:03 -07:00
Paul Berry 1ee9421ddc Make reference 0 consistent between AST-based and element-based summaries.
Reference 0 is only used as a placeholder so this has no functional
change.  But it should make it easier to compare AST-based and
element-based summaries.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1915033005 .
2016-04-26 09:46:16 -07:00
Paul Berry 2296231259 Fix summarization of unresolved annotations.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1921333002 .
2016-04-26 09:40:21 -07:00
Brian Wilkerson 32400bd49d Optimize the task to re-resolve instance fields (issue 26306)
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1917893003 .
2016-04-25 14:08:37 -07:00
Leaf Petersen fa39d72861 Fix missing downwards inference on fields, report more inference
Use the element type on the variable declaration to set the downwards
inference context, so that we get downwards inference from inferred
types.  Also eliminated some TODOs about places where we were not
recording inferences.

Fixes https://github.com/dart-lang/sdk/issues/25546 .

BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1906413004 .
2016-04-22 15:29:26 -07:00
pq 6b20605984 Support ignores at end of line (#26181).
Implements: https://github.com/dart-lang/sdk/issues/26181

BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1913113002 .
2016-04-22 11:06:16 -07:00
Brian Wilkerson 166f23e13f Code clean-up
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1907323002 .
2016-04-22 09:05:01 -07:00
Paul Berry cd119234b2 Fix summary resynthesis in the event of a self-import.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1910343002 .
2016-04-21 16:41:48 -07:00
Brian Wilkerson 4367fd8800 Add warnings when async and async* functions declare a subtype of Future or Stream respectively (issue 25854)
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1910033002 .
2016-04-21 11:03:36 -07:00
Konstantin Shcheglov 305f1f538c Pull the 'keyword' property into Token.
So, we can use it without casting to KeywordToken.
This gives small, but noticable performanace boost, about 4% on hot VM.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1909843002 .
2016-04-21 08:23:49 -07:00
Sam Rawlins 53bf36acdb Add UNDEFINED_HIDDEN_NAME, UNDEFINED_SHOWN_NAME
BUG=https://github.com/dart-lang/sdk/issues/20363

Also https://github.com/dart-lang/sdk/issues/25154, https://github.com/dart-lang/sdk/issues/25672

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1901923002 .
2016-04-20 15:51:50 -07:00
Paul Berry f9d033b82f In summary linker, drop trailing type args of type dynamic.
This makes the linker behavior match the specification in the IDL, as
well as the behavior of the element-based summaries.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1902593005 .
2016-04-20 14:13:44 -07:00
Konstantin Shcheglov c1475a13a0 Use MODIFICATION_TIME in ScanDartTask and ParseHtmlTask.
Instead of calling AnalysisContext.getModificationStamp() again.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1902123005 .
2016-04-20 11:14:29 -07:00
Paul Berry 8f9defbb50 Move InheritanceManager to its own file.
No changes other than code motion.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1903663003 .
2016-04-20 08:58:00 -07:00
Brian Wilkerson f3b177e481 Remove references to and uses of MemberMap
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1893313004 .
2016-04-20 07:40:02 -07:00
Konstantin Shcheglov cd685d96e8 Use single map of Source to modification time.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1899303003 .
2016-04-19 15:50:56 -07:00
Konstantin Shcheglov daed53916a Issue 26207. Fix for renaming top-level functions with offset 0.
They were indistinguishable from the corresponding enclosing units.
Now we use a separate kind for units and libraries.

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

Review URL: https://codereview.chromium.org/1896023005 .
2016-04-19 15:36:28 -07:00
Paul Berry 60e37b99f9 Implement FunctionElementForLink_FunctionTypedParam.parameters.
This required some refactoring so that (a) we share code between
FunctionElementForLink_FunctionTypedParam and ExecutableElementForLink,
and (b) we compute the proper implicitFunctionTypeIndices for deeply
nested parameters.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1904543002 .
2016-04-19 14:22:46 -07:00
Brian Wilkerson 9aa64259dc Revert "Remove MemberMap in favor of HashMap"
Review URL: https://codereview.chromium.org/1898193004 .
2016-04-19 12:20:48 -07:00
Konstantin Shcheglov ea3b511c00 Add linker_test.dart into the summary test suite.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1902933002 .
2016-04-19 12:19:15 -07:00
Paul Berry bc67d03e21 Clean up handling of declared/inferred types in VariableElementForLink
This eliminates duplicate logic between VariableElementForLink and its
derived class FieldElementForLink_ClassField, and makes the logic in
these two classes more similar to the inferred type logic in
ExecutableElementForLink.  A few corner cases that were previously
broken are now fixed (and tested).

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1894263003 .
2016-04-19 12:07:38 -07:00
Brian Wilkerson fb43f1276c Remove MemberMap in favor of HashMap
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1904433003 .
2016-04-19 11:59:44 -07:00
pq 433fd4558d Required params message fix.
Gets rid of the rogue space when no details are provided in the `@Required` constructor.

BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1897293003 .
2016-04-19 11:21:09 -07:00
Paul Berry a771361120 Clean up handling of declared/inferred types in ExecutableElementForLink
Reworked the `returnType` getter (which had complex logic that was
difficult to follow) in terms of two simpler getters:
`declaredReturnType` and `inferredReturnType`.  Also implemented logic
to ensure that inferred instance types are ignored when inferring
types of initializer expressions in the same library cycle (since the
linker is supposed to behave as if initializer expressions are
inferred first).

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

Review URL: https://codereview.chromium.org/1902103002 .
2016-04-19 09:47:46 -07:00
Paul Berry 746be6a723 Verify a corner case of const constructor cycle detection with summaires.
We almost broke this with a recent CL so it seemed like a good idea to
have an explicit unit test for it.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1895923003 .
2016-04-19 09:18:24 -07:00
Konstantin Shcheglov 9ec591573a Support for type inference of top-level function invocations.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1899873003 .
2016-04-18 13:24:04 -07:00
Konstantin Shcheglov a50e4aec90 Link invocation of method references, with inference.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1899643003 .
2016-04-18 10:54:26 -07:00
Konstantin Shcheglov fdf84f7842 Support for extract property for methods.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1897843003 .
2016-04-18 09:19:45 -07:00
Konstantin Shcheglov e0fd9400fe Support for a.b.c.d extract property sequence.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1893703002 .
2016-04-16 19:38:27 -07:00
Brian Wilkerson bf1fa31c90 Make analyzer more strong mode compliant
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1897713002 .
2016-04-16 12:28:44 -07:00
Leaf Petersen 56ab7bc39a Handle fuzzy optional parameters correctly. Fixes
https://github.com/dart-lang/sdk/issues/26156 .

Adds translation of known function types in error_verifier.dart to
remove uses of dynamic before checking assignability.

BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1893053002 .
2016-04-15 17:31:22 -07:00
Paul Berry 7670f2a6df Fill out the implementation of synthetic getters/setters in the summary linker.
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1897513002 .
2016-04-15 13:32:23 -07:00
Paul Berry 5f038a477e Add LibraryElementForLink.isDartAsync.
Needed by InterfaceTypeImpl.substitute2.

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

Review URL: https://codereview.chromium.org/1888873004 .
2016-04-15 11:34:05 -07:00
Paul Berry d8c00d116f Add LibraryElementForLink.context getter.
Needed by InheritanceManager._resolveInheritanceLookup.

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

Review URL: https://codereview.chromium.org/1892913002 .
2016-04-15 10:11:04 -07:00
Paul Berry eb6a8fda62 Implement TypeParameterElementForLink.location.
This is needed because when comparing function types for equality, we
sometimes substitute in a fresh TypeParameterTypeImpl (see
FunctionTypeImpl.operator==()).  This means that we will sometimes be
doing equality comparisons between TypeParameterTypeImpl and
TypeParameterElementForLink.  TypeParameterTypeImpl.operator==() uses
Element.location to do the comparison.

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

Review URL: https://codereview.chromium.org/1893613002 .
2016-04-15 08:51:29 -07:00
Brian Wilkerson d680aba415 Move scopes into a separate library
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1888223003 .
2016-04-15 07:38:57 -07:00
Paul Berry 3bb4de46f9 Implement SyntheticVariableElementForLink.isSynthetic.
Needed by PropertyAccessorMember._isChangedByTypeSubstitution.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1886893006 .
2016-04-15 07:07:35 -07:00
Paul Berry 8c1bc41293 Add PropertyAccessorElementForLink_Variable.library getter.
Needed by PropertyAccessorElementForLink_Variable.isAccessibleIn().

Also add some toString() methods to aid in debugging.

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

Review URL: https://codereview.chromium.org/1887213002 .
2016-04-14 14:22:29 -07:00
Brian Wilkerson 21a1b757c1 Clean up hints after a new hint was introduced
R=jwren@google.com

Review URL: https://codereview.chromium.org/1890973002 .
2016-04-14 13:15:34 -07:00
Brian Wilkerson 3084ceae83 Clean up flags for conditional directives
R=pquitslund@google.com

Review URL: https://codereview.chromium.org/1892523002 .
2016-04-14 11:47:28 -07:00
Florian Loitsch bcd8ef3dea Enable conditional directives by default.
R=brianwilkerson@google.com, iposva@google.com, sigmund@google.com

Review URL: https://codereview.chromium.org/1851753002 .
2016-04-14 19:02:41 +02:00
Konstantin Shcheglov 1075e3a32e Clean up reporting HintCode.UNUSED_SHOWN_NAME when a prefixed top-level function is invoked.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1882633002 .
2016-04-12 13:31:40 -07:00
Konstantin Shcheglov 2e4f8a0601 Add missing test suites to the generated/test_all suite.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1878413002 .
2016-04-12 13:18:18 -07:00
Konstantin Shcheglov e17db6c9a4 Infer type of extract index expressions.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1878223002 .
2016-04-12 09:34:33 -07:00
Paul Berry aa1526fc90 Fix AST-based type inference on empty lists.
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1880803002 .
2016-04-11 17:04:54 -07:00