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 .
The two in src/mock_sdk.dart and src/context/mock_sdk.dart were almost
identical. The former was only used in one place, so I made the latter
support that case.
Also cleaned up a few other minor things I noticed along the way.
R=brianwilkerson@google.com
Review URL: https://codereview.chromium.org/1691603002 .
In the process, I fixed a bug where one version of this same lump of
code wasn't correct anymore now that you can have arbitrarily long
chains of type parameters.
DartType isn't maybe the ideal place for resolveToBound(). I wanted it
somewhere that:
1. Would be obvious enough that someone coming along later would
discover it instead of reinventing it again.
2. Had access to the various data it needs.
3. Wouldn't need a "is TypeParameterType" guard at every callsite
before it could be used.
I could put it on TypeProvider instead, since it needs access to Object,
but that felt arbitrary.
It could be a top level function, but then I don't think it would be
very discoverable.
R=brianwilkerson@google.com, jmesserly@google.com
Review URL: https://codereview.chromium.org/1686893002 .
There are two changes:
1. Modify `_isPeekGenericTypeParametersAndOpenParen` to call
`_skipTypeParameterList` instead of `_skipTypeArgumentList`. This
fixes parsing of generic function declarations like `f<@a T>() {}`,
which previously couldn't be parsed because `<@a T>` isn't a valid
type argument list.
2. Rename `_isLikelyParameterList` to `_isLikelyArgumentList` to
reflect how it is actually used (and what it actually does). This is
no user-visible effect.
R=brianwilkerson@google.com
Review URL: https://codereview.chromium.org/1674043002 .