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

Unified Diff: pkg/analyzer/test/generated/incremental_resolver_test.dart

Issue 1024553006: Issue 22962. Adding/removing method/accessor body is a declartion mismatch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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/incremental_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/generated/incremental_resolver_test.dart
diff --git a/pkg/analyzer/test/generated/incremental_resolver_test.dart b/pkg/analyzer/test/generated/incremental_resolver_test.dart
index e8349ffeb3c196cb09b4cd5c4267f0613a632f04..8b664f98014ae062ce88ebf9814d3267451cefc6 100644
--- a/pkg/analyzer/test/generated/incremental_resolver_test.dart
+++ b/pkg/analyzer/test/generated/incremental_resolver_test.dart
@@ -910,6 +910,30 @@ main(int callback(int a, String b)) {
''');
}
+ void test_false_getter_body_add() {
+ _assertDoesNotMatchOK(r'''
+class A {
+ int get foo;
+}
+''', r'''
+class A {
+ int get foo => 0;
+}
+''');
+ }
+
+ void test_false_getter_body_remove() {
+ _assertDoesNotMatchOK(r'''
+class A {
+ int get foo => 0;
+}
+''', r'''
+class A {
+ int get foo;
+}
+''');
+ }
+
void test_false_implementsClause_add() {
_assertDoesNotMatch(r'''
class A {}
@@ -1088,6 +1112,30 @@ class A {
''');
}
+ void test_false_method_body_add() {
+ _assertDoesNotMatchOK(r'''
+class A {
+ void foo();
+}
+''', r'''
+class A {
+ void foo() {}
+}
+''');
+ }
+
+ void test_false_method_body_remove() {
+ _assertDoesNotMatchOK(r'''
+class A {
+ void foo() {}
+}
+''', r'''
+class A {
+ void foo();
+}
+''');
+ }
+
void test_false_method_generator_add() {
_assertDoesNotMatchOK(r'''
class A {
@@ -1622,6 +1670,30 @@ class B<T> = A<T> with M<T>;
''');
}
+ void test_true_constructor_body_add() {
+ _assertMatches(r'''
+class A {
+ A(int p);
+}
+''', r'''
+class A {
+ A(int p) {}
+}
+''');
+ }
+
+ void test_true_constructor_body_remove() {
+ _assertMatches(r'''
+class A {
+ A(int p) {}
+}
+''', r'''
+class A {
+ A(int p);
+}
+''');
+ }
+
void test_true_constructor_named_same() {
_assertMatches(r'''
class A {
@@ -3838,9 +3910,8 @@ class ResolutionContextBuilderTest extends EngineTestCase {
unit.declarations.add(classNode);
ClassElement classElement = ElementFactory.classElement2(className);
classNode.name.staticElement = classElement;
- (unit.element as CompilationUnitElementImpl).types = <ClassElement>[
- classElement
- ];
+ (unit.element as CompilationUnitElementImpl).types =
+ <ClassElement>[classElement];
return classNode;
}
@@ -3852,9 +3923,8 @@ class ResolutionContextBuilderTest extends EngineTestCase {
unit.declarations.add(classNode);
ClassElement classElement = ElementFactory.classElement2(className);
classNode.name.staticElement = classElement;
- (unit.element as CompilationUnitElementImpl).types = <ClassElement>[
- classElement
- ];
+ (unit.element as CompilationUnitElementImpl).types =
+ <ClassElement>[classElement];
return classNode;
}
@@ -3876,9 +3946,8 @@ class ResolutionContextBuilderTest extends EngineTestCase {
ConstructorElement constructorElement =
ElementFactory.constructorElement2(classNode.element, null);
constructorNode.element = constructorElement;
- (classNode.element as ClassElementImpl).constructors = <ConstructorElement>[
- constructorElement
- ];
+ (classNode.element as ClassElementImpl).constructors =
+ <ConstructorElement>[constructorElement];
return constructorNode;
}
@@ -3891,9 +3960,8 @@ class ResolutionContextBuilderTest extends EngineTestCase {
FunctionElement functionElement =
ElementFactory.functionElement(functionName);
functionNode.name.staticElement = functionElement;
- (unit.element as CompilationUnitElementImpl).functions = <FunctionElement>[
- functionElement
- ];
+ (unit.element as CompilationUnitElementImpl).functions =
+ <FunctionElement>[functionElement];
return functionNode;
}
@@ -3922,9 +3990,8 @@ class ResolutionContextBuilderTest extends EngineTestCase {
MethodElement methodElement =
ElementFactory.methodElement(methodName, null);
methodNode.name.staticElement = methodElement;
- (classNode.element as ClassElementImpl).methods = <MethodElement>[
- methodElement
- ];
+ (classNode.element as ClassElementImpl).methods =
+ <MethodElement>[methodElement];
return methodNode;
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/incremental_resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698