Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: pkg/analyzer/test/src/context/context_test.dart

Issue 2187863003: Always set correspondingStaticParameters and correspondingPropagatedParameters, to clear when we don (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/element_resolver.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/context/context_test.dart
diff --git a/pkg/analyzer/test/src/context/context_test.dart b/pkg/analyzer/test/src/context/context_test.dart
index 7da86ad50931b0d48ba02b5dd8b937a91b87eade..45122e660fe70f5e1ff9a5ed1d636b687adc3999 100644
--- a/pkg/analyzer/test/src/context/context_test.dart
+++ b/pkg/analyzer/test/src/context/context_test.dart
@@ -3493,6 +3493,72 @@ class A {
expect(context.getErrors(b).errors, hasLength(1));
}
+ void test_sequence_clearParameterElements() {
+ Source a = addSource(
+ '/a.dart',
+ r'''
+class A {
+ foo(int p) {}
+}
+final a = new A();
+main() {
+ a.foo(42);
+}
+''');
+ _performPendingAnalysisTasks();
+ Expression find42() {
+ CompilationUnit unit =
+ context.getResult(new LibrarySpecificUnit(a, a), RESOLVED_UNIT);
+ ExpressionStatement statement =
+ AstFinder.getStatementsInTopLevelFunction(unit, 'main').single;
+ MethodInvocation invocation = statement.expression;
+ return invocation.argumentList.arguments[0];
+ }
+ {
+ Expression argument = find42();
+ expect(argument.staticParameterElement, isNull);
+ expect(argument.propagatedParameterElement, isNotNull);
+ }
+ // Update a.dart: add type annotation for 'a'.
+ // '42' has 'staticParameterElement', but not 'propagatedParameterElement'.
+ context.setContents(
+ a,
+ r'''
+class A {
+ foo(int p) {}
+}
+final A a = new A();
+main() {
+ a.foo(42);
+}
+''');
+ _performPendingAnalysisTasks();
+ {
+ Expression argument = find42();
+ expect(argument.staticParameterElement, isNotNull);
+ expect(argument.propagatedParameterElement, isNull);
+ }
+ // Update a.dart: remove type annotation for 'a'.
+ // '42' has 'propagatedParameterElement', but not 'staticParameterElement'.
+ context.setContents(
+ a,
+ r'''
+class A {
+ foo(int p) {}
+}
+final a = new A();
+main() {
+ a.foo(42);
+}
+''');
+ _performPendingAnalysisTasks();
+ {
+ Expression argument = find42();
+ expect(argument.staticParameterElement, isNull);
+ expect(argument.propagatedParameterElement, isNotNull);
+ }
+ }
+
void test_sequence_closureParameterTypesPropagation() {
Source a = addSource(
'/a.dart',
« no previous file with comments | « pkg/analyzer/lib/src/generated/element_resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698