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

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

Issue 770333003: First step to resolving simple API changes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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
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 f42b323b61319c1f2fccf91e01d76fb8c39f20e7..2d8a6baa1d2b1bd48a3e4e814ddbfbc8570bccbf 100644
--- a/pkg/analyzer/test/generated/incremental_resolver_test.dart
+++ b/pkg/analyzer/test/generated/incremental_resolver_test.dart
@@ -1655,6 +1655,20 @@ class A {
''');
}
+ void test_true_method_parameters_type_functionType() {
+ _assertMatches(r'''
+typedef F();
+class A {
+ m(F p) {}
+}
+''', r'''
+typedef F();
+class A {
+ m(F p) {}
+}
+''');
+ }
+
void test_true_part_list_reorder() {
addNamedSource('/unitA.dart', 'part of lib; class A {}');
addNamedSource('/unitB.dart', 'part of lib; class B {}');
@@ -1880,6 +1894,28 @@ class IncrementalResolverTest extends ResolverTestCase {
LibraryElement library;
CompilationUnit unit;
+ void setUp() {
+ super.setUp();
+ test_resolveApiChanges = true;
+ }
+
+ void test_api_method_edit_returnType() {
+ _resolveUnit(r'''
+class A {
+ int m() {
+ return null;
+ }
+}
+main() {
+ A a = new A();
+ var v = a.m();
+}
+''');
+ _resolve(_editString('int m', 'String m'), _isDeclaration);
+ // We don't add or fix an error, but we verify that type of "v"
+ // is updated from "int" to "String".
+ }
+
void test_classMemberAccessor_body() {
_resolveUnit(r'''
class A {
@@ -2172,11 +2208,6 @@ class B {
edit.replacement +
code.substring(offset + edit.length);
CompilationUnit newUnit = _parseUnit(newCode);
- // update tokens
- {
- int delta = edit.replacement.length - edit.length;
- _shiftTokens(unit.beginToken, offset, delta);
- }
// replace the node
AstNode oldNode = _findNodeAt(unit, offset, predicate);
AstNode newNode = _findNodeAt(newUnit, offset, predicate);
@@ -2184,6 +2215,11 @@ class B {
bool success = NodeReplacer.replace(oldNode, newNode);
expect(success, isTrue);
}
+ // update tokens
+ {
+ int delta = edit.replacement.length - edit.length;
+ _shiftTokens(unit.beginToken, offset, delta);
+ }
// do incremental resolution
IncrementalResolver resolver = new IncrementalResolver(
typeProvider,
@@ -3996,8 +4032,6 @@ class _SameResolutionValidator implements AstVisitor {
void _verifyElement(Element a, Element b) {
if (a != b) {
- print(a.location);
- print(b.location);
fail('Expected: $b\n Actual: $a');
}
if (a == null && b == null) {
@@ -4009,7 +4043,9 @@ class _SameResolutionValidator implements AstVisitor {
}
void _verifyType(DartType a, DartType b) {
- expect(a, equals(b));
+ if (a != b) {
+ fail('Expected: $b\n Actual: $a');
+ }
}
void _visitAnnotatedNode(AnnotatedNode node, AnnotatedNode other) {

Powered by Google App Engine
This is Rietveld 408576698