This prevents the ElementFactory's ClassElement for `Object` (which it
stores statically) from getting accidentally shared between separate
unit tests in a single test run, which could cause state to leak
between the tests.
R=brianwilkerson@google.com
Review URL: https://codereview.chromium.org/1752023002 .
If the source kind isn't updated, we get a bogus error:
The imported library ... must not have a part-of directive.
This error is calculated in BuildDirectiveElementsTask.
based on SOURCE_KIND.
SOURCE_KIND is based on whether MODIFICATION_DATE is -1,
so make sure we invalidate MODIFICATION_DATE.
Also, fix an issue where _sourceChanged would have
no effect if incremental resolution isn't run, because
the content has already been updated and is therefore
equal.
Also, remove unused RelativeFileUriResolver and
clarify comments around missing Source handling.
BUG=https://github.com/dart-lang/sdk/issues/25808R=brianwilkerson@google.com
Review URL: https://codereview.chromium.org/1737693004 .
This is to ensure that error.source matches the source of
the ChangeNotice it appears in and the analysis server will
report the error together with other errors for the same file.
(Moving the error seems easier than figuring out how to put it
on a different Source, and it might be that the import/export
is at fault anyway.)
BUG=https://github.com/dart-lang/sdk/issues/25826R=brianwilkerson@google.com
Review URL: https://codereview.chromium.org/1739553003 .
* 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 .
* 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 .
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 .
- 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 .
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 .
It is OK to keep default parameter elements in the cache and so keep
all the analysis results that depend on constants in the cache.
Parameters don't use their offset in their locations, so they don't
get "lost" during incremental resolution.
R=brianwilkerson@google.com, skybrian@google.com
BUG=
Review URL: https://codereview.chromium.org/1693243002 .