pq
84f32fe5a6
Validation of @protected method invocations.
...
* Defines `isProtected` accessors.
* Adds a simple mechanism to our test `AnalysisContextFactory` allowing us to contribute package resolution to test cases.
* Adds `meta` awareness to `ResolverTest`.
NB: this *only* adds method invocation support. I'll generalize to all members in a follow-up. There's enough here though that I wanted to get some early feedback.
BUG=
R=brianwilkerson@google.com
Review URL: https://codereview.chromium.org/1723243002 .
2016-02-24 09:25:43 -08:00
Konstantin Shcheglov
918582490e
Fix the 'Unused import' hint when using package summaries.
...
R=paulberry@google.com
BUG=
Review URL: https://codereview.chromium.org/1722383002 .
2016-02-24 08:16:37 -08:00
Konstantin Shcheglov
d9bd7f915d
Revert collecting defined elements.
...
We decided to resynthesize local elements from summaries.
This CL rolls back the following CLs:
https://codereview.chromium.org/1687573002
https://codereview.chromium.org/1681493005
R=brianwilkerson@google.com
BUG=
Review URL: https://codereview.chromium.org/1729523002 .
2016-02-23 09:55:14 -08:00
Paul Berry
67cb22b949
Strengthen resynthesis checks for prefix.className.staticMember.
...
R=scheglov@google.com
Review URL: https://codereview.chromium.org/1722723002 .
2016-02-22 17:05:45 -08:00
John Messerly
0c4e64c8ef
fixes #25477 , downward inference of generic methods
...
* we now push the context return type down when inferring
* we also take this into account in our initial downards inference for arguments
* adds a common AST interface for FunctionExpressionInvocation and MethodInvocation, so we can handle these more uniformly
R=brianwilkerson@google.com , leafp@google.com
Review URL: https://codereview.chromium.org/1720433002 .
2016-02-22 14:48:39 -08:00
Bob Nystrom
e9a6175489
Report a static warning if a for loop condition is non-boolean.
...
From 17.6.1: "It is a static warning if the static type of c may not be
assigned to bool."
Strong mode catches this case, but it looks like ErrorVerifier just
missed it. Since I'm working on making strong mode lean on ErrorVerifier
for finding sideways casts like this, the discrepancy popped up.
R=brianwilkerson@google.com
Review URL: https://codereview.chromium.org/1720083002 .
2016-02-22 12:10:52 -08:00
Paul Berry
b33be7dce0
In summaries, don't drop unsafe prefixes.
...
Previous to this CL, all prefixes were dropped during resynthesis,
causing constant ASTs like `x.length` to get resynthesized as simply
`length`, which did not retain enough information for constant
evaluation.
R=scheglov@google.com
Review URL: https://codereview.chromium.org/1718013002 .
2016-02-22 05:22:17 -08:00
John Messerly
0bf5456fcb
partial fix for #25220 , handles inference for list/map literals
...
R=leafp@google.com
Review URL: https://codereview.chromium.org/1717803003 .
2016-02-19 16:44:10 -08:00
Paul Berry
d7b6bc3865
Add summary support for ShowElementCombinator.end and .offset.
...
R=scheglov@google.com
Review URL: https://codereview.chromium.org/1714173002 .
2016-02-19 12:27:12 -08:00
Konstantin Shcheglov
576e6cbfc4
Different approach to fixing file to URI mapping.
...
Relay on other order of library declarations in the SDK.
R=brianwilkerson@google.com
BUG=
Review URL: https://codereview.chromium.org/1715003002 .
2016-02-19 12:12:44 -08:00
Paul Berry
f36602ad03
Add summary support for ConstructorElement.nameEnd and .periodOffset.
...
R=scheglov@google.com
Review URL: https://codereview.chromium.org/1718603002 .
2016-02-19 11:35:45 -08:00
Paul Berry
b443af765f
Test resynthesis of initializer of parameter elements and variable members.
...
R=scheglov@google.com
Review URL: https://codereview.chromium.org/1716873002 .
2016-02-19 11:24:48 -08:00
Paul Berry
e5a8cdd557
Resynthesize parameter visible ranges.
...
R=scheglov@google.com
Review URL: https://codereview.chromium.org/1713763003 .
2016-02-19 10:56:22 -08:00
Paul Berry
e78bc9386e
Add summary support for ParameterElement.defaultValueCode.
...
R=scheglov@google.com
Review URL: https://codereview.chromium.org/1714113002 .
2016-02-19 10:35:02 -08:00
Paul Berry
677c01e88b
Test and fix resynthesis of generic closures.
...
R=scheglov@google.com
Review URL: https://codereview.chromium.org/1712583004 .
2016-02-19 10:33:11 -08:00
Konstantin Shcheglov
1382982b60
First try to find the exact library for the given file URI.
...
R=brianwilkerson@google.com
BUG=
Review URL: https://codereview.chromium.org/1710393002 .
2016-02-19 10:19:55 -08:00
Paul Berry
ce830bb3ca
Fix inconsistency with LinkedReference.numTypeParameters
...
Sometimes it included parent type parameters, sometimes it did not.
Now it consistently does not.
R=scheglov@google.com
Review URL: https://codereview.chromium.org/1713083002 .
2016-02-19 09:25:34 -08:00
Konstantin Shcheglov
d32b808fa8
Remove copies of ExportNamespaceBuilder and PublicNamespaceBuilder.
...
R=brianwilkerson@google.com
BUG=
Review URL: https://codereview.chromium.org/1717653002 .
2016-02-19 09:08:45 -08:00
Brian Wilkerson
e46eaa3072
Fix node replacer to handle comments on variable declaration lists (issue 25818)
...
R=scheglov@google.com
Review URL: https://codereview.chromium.org/1715723002 .
2016-02-19 08:45:25 -08:00
Brian Wilkerson
bfacd1878c
Tolerate SDKs that do not include dart:async (issue 25520)
...
R=danrubel@google.com
Review URL: https://codereview.chromium.org/1715563002 .
2016-02-19 07:45:54 -08:00
Brian Wilkerson
039e62d813
Improve error message (issue 25113)
...
R=scheglov@google.com
Review URL: https://codereview.chromium.org/1709013004 .
2016-02-19 06:15:07 -08:00
Brian Slesinsky
6715573c6e
Fix cache corruption in incremental resolver
...
- Add an element Modifier indicating that it's a cache key.
- Don't allow the hashCode to change while it's in the cache.
- Add code in the incremental resolver to remove the cache entry
first if the hashCode will change.
Also, there appears to be a memory leak in AnalysisCache where
CacheEntry.dispose() was not usually called, so I also fixed
that.
BUG=
R=brianwilkerson@google.com
Review URL: https://codereview.chromium.org/1696193003 .
2016-02-18 18:29:42 -08:00
Paul Berry
e8848d970a
Allow linked types to refer to local executables.
...
This allows us to summarize propagated and inferred types for a number
of corner cases where the type is a function type implied by a
closure.
R=scheglov@google.com
Review URL: https://codereview.chromium.org/1713753002 .
2016-02-18 14:17:58 -08:00
John Messerly
9bc31f7bc4
fix #25739 , incorrectly expanding a generic comment multiple times
...
R=brianwilkerson@google.com , rnystrom@google.com
Review URL: https://codereview.chromium.org/1686173002 .
2016-02-18 14:13:39 -08:00
Konstantin Shcheglov
5db3ae73bf
Always set the previous token in AstCloner.
...
R=brianwilkerson@google.com
BUG=
Review URL: https://codereview.chromium.org/1710163002 .
2016-02-18 13:40:32 -08:00
Konstantin Shcheglov
d66aa765a2
Resynthesize enum constant field evaluation results.
...
R=paulberry@google.com
BUG=
Review URL: https://codereview.chromium.org/1710223002 .
2016-02-18 13:27:56 -08:00
Brian Wilkerson
41b9a28cef
Add test for already fixed bug (issue 25730)
...
R=scheglov@google.com
Review URL: https://codereview.chromium.org/1711053002 .
2016-02-18 12:54:30 -08:00
Konstantin Shcheglov
120321a4e2
Serialize and resynthesize labels.
...
R=paulberry@google.com
BUG=
Review URL: https://codereview.chromium.org/1712583003 .
2016-02-18 12:26:16 -08:00
Konstantin Shcheglov
75ee042feb
Remove _PrefixExpectation.inLibraryDefiningUnit.
...
It was used as a shortcut, but now we don't use it.
R=paulberry@google.com
BUG=
Review URL: https://codereview.chromium.org/1713643002 .
2016-02-18 12:20:18 -08:00
Brian Wilkerson
554a5e7f06
Synthetic constructors resulting from mixins should never be const (issue 25738)
...
R=paulberry@google.com
Review URL: https://codereview.chromium.org/1711673003 .
2016-02-18 11:42:50 -08:00
Paul Berry
f7d3a6f76e
Store return types of variable initializers in summaries.
...
This required adding the ability to refer to the "bottom" type in
summaries.
R=scheglov@google.com
Review URL: https://codereview.chromium.org/1713593002 .
2016-02-18 10:19:38 -08:00
Konstantin Shcheglov
712c8d750c
Fix for summarizing typedef typed parameters.
...
R=paulberry@google.com
BUG=
Review URL: https://codereview.chromium.org/1711873002 .
2016-02-18 10:00:00 -08:00
Paul Berry
d5d5dae61f
Set hasImplicitReturnType for variable initializer functions.
...
This will make summary generation for these functions easier, since it
will allow us to re-use most of the logic for storing inferred types
when storing their return types.
R=brianwilkerson@google.com
Review URL: https://codereview.chromium.org/1710913004 .
2016-02-18 09:07:33 -08:00
Konstantin Shcheglov
82d70054c5
Compare variable initializers as functions, skip the return type.
...
R=paulberry@google.com
BUG=
Review URL: https://codereview.chromium.org/1714463002 .
2016-02-18 08:43:52 -08:00
Konstantin Shcheglov
72b43a3d11
Fix for making variable initializer synthetic.
...
R=paulberry@google.com
BUG=
Review URL: https://codereview.chromium.org/1701413005 .
2016-02-18 08:27:55 -08:00
Konstantin Shcheglov
e750c71bd0
Support for 'unary-' in DeclarationResolver.
...
R=brianwilkerson@google.com
BUG=
Review URL: https://codereview.chromium.org/1710763002 .
2016-02-17 19:47:06 -08:00
Konstantin Shcheglov
2329db5f4a
Serialize and resynthesize variable initializers.
...
We need them to be able to bind back elements in DeclarationResolver in
code like: var v = {'1': () => 10};
R=paulberry@google.com
BUG=
Review URL: https://codereview.chromium.org/1707073002 .
2016-02-17 13:32:54 -08:00
Paul Berry
4eaafd3ee5
Deprecate old "isPotentiallyMutated..." API.
...
The getters are rewritten to return `true`. Technically this is not a
breaking change, since all variables are "potentially mutated" in at
least a vacuous sense.
R=brianwilkerson@google.com
Review URL: https://codereview.chromium.org/1711433002 .
2016-02-17 12:36:58 -08:00
John Messerly
acc95d3195
fixes #24507 , allow known functions to be treated as strict arrows
...
In a known function, * -> * will be top -> top.
In all other function types, it will still be bottom -> top.
R=leafp@google.com
Review URL: https://codereview.chromium.org/1700523002 .
2016-02-17 12:14:23 -08:00
Bob Nystrom
47119ed7fe
Get rid of some copy/paste in resolver_test.
...
R=brianwilkerson@google.com , jmesserly@google.com
Review URL: https://codereview.chromium.org/1707593002 .
2016-02-17 11:21:59 -08:00
Konstantin Shcheglov
161accb68a
Set FunctionTypeImpl for synthetic VariableElement.initializer elements.
...
I'd like to serialize initializer functions with their locals, but
as it is not, FunctionElement is incomplete and causes NPE.
R=brianwilkerson@google.com
BUG=
Review URL: https://codereview.chromium.org/1703133002 .
2016-02-17 11:00:30 -08:00
John Messerly
e60ff76196
fixes #25793 , make strong checker tests sane
...
slight code change to pass through the options flag for strong hints
R=leafp@google.com
Review URL: https://codereview.chromium.org/1700403002 .
2016-02-17 09:06:49 -08:00
Brian Wilkerson
722623d295
Discard function elements created while building elements in annotations (issue 25696)
...
R=scheglov@google.com
Review URL: https://codereview.chromium.org/1705773002 .
2016-02-17 08:35:57 -08:00
Paul Berry
c3d98acbeb
Add data structures to AST to indicate potentially mutated variables.
...
These data structures provide the same functionality as
VariableElement.isPotentiallyMutatedInClosure and
VariableElement.isPotentiallyMutatedInScope, but are only accessible
from a resolved AST. In a later CL,
VariableElement.isPotentiallyMutatedInClosure and
VariableElement.isPotentiallyMutatedInScope will be deprecated.
R=brianwilkerson@google.com , jmesserly@google.com
Review URL: https://codereview.chromium.org/1700263002 .
2016-02-16 14:04:25 -08:00
Paul Berry
b5b7a7618c
Add tests to validate assumptions made by summaries about type inference.
...
The summary code assumes that type inference is never done on
initializing formals, constructor parameters, parameters of static
methods, or parameters of top level functions. This CL adds tests
that will fail if strong mode ever starts inferring parameter types
from default parameters, rendering these assumptions wrong.
R=scheglov@google.com
Review URL: https://codereview.chromium.org/1704663002 .
2016-02-16 14:00:09 -08:00
pq
75b1379a0f
Support for line-level error suppression ( #25685 ).
...
Adds filtering logic to apply source-level error suppression using a simple comment convention. For example, suppressing an invalid assignment would look like this:
```
//# ignore: invalid_assignment
int x = '';
```
Lists are supported as well:
```
//# ignore: invalid_assignment, const_initialized_with_non_constant_value
const String y = x;
```
Conversation on final format continues (https://github.com/dart-lang/sdk/issues/25685 ), so this can be treated as provisional but proves out the mechanics. Comments and concerns most welcome.
BUG=
R=brianwilkerson@google.com
Review URL: https://codereview.chromium.org/1702733002 .
2016-02-16 13:53:58 -08:00
Konstantin Shcheglov
511639d6ea
Serialize and resynthesize unresolved constant instance creations.
...
R=paulberry@google.com
BUG=
Review URL: https://codereview.chromium.org/1699243003 .
2016-02-16 13:49:18 -08:00
Konstantin Shcheglov
22b9e79090
Don't set DynamicElementImpl as staticElement for unresolved types.
...
R=brianwilkerson@google.com
BUG=
Review URL: https://codereview.chromium.org/1702713003 .
2016-02-16 11:58:24 -08:00
Konstantin Shcheglov
665b82d04a
Serialize and resynthesize unresolved identifiers.
...
This is surprising, but SDK (dart2js part) has unresolved constant
expressions. So, we need to support them at least to some extent in
order to pass shared tests.
R=paulberry@google.com
BUG=
Review URL: https://codereview.chromium.org/1700203002 .
2016-02-16 09:56:03 -08:00
Konstantin Shcheglov
40e0e329fd
Add a local generic function into the static generic method tests.
...
Before landing https://codereview.chromium.org/1692993004 we were
not able to test this.
R=paulberry@google.com
BUG=
Review URL: https://codereview.chromium.org/1700863002 .
2016-02-16 09:49:19 -08:00