Chromium Code Reviews| Index: pkg/analyzer/test/src/summary/resynthesize_test.dart |
| diff --git a/pkg/analyzer/test/src/summary/resynthesize_test.dart b/pkg/analyzer/test/src/summary/resynthesize_test.dart |
| index 7ff458dc35c45e156fc6349b61c2dc28f5af1a21..b079d8234cac9bc2b32e7266c73eb09b5f3888fa 100644 |
| --- a/pkg/analyzer/test/src/summary/resynthesize_test.dart |
| +++ b/pkg/analyzer/test/src/summary/resynthesize_test.dart |
| @@ -242,7 +242,6 @@ class ResynthTest extends ResolverTestCase { |
| compareConstantExpressions(r, o.expression, desc); |
| } else if (o is SimpleIdentifier && r is SimpleIdentifier) { |
| expect(r.name, o.name); |
|
Paul Berry
2016/02/01 16:11:40
Leave a comment here explaining why we shouldn't c
|
| - compareTypes(r.staticType, o.staticType, desc); |
| compareElements(r.staticElement, o.staticElement, desc); |
| } else if (o is PrefixedIdentifier) { |
| // We don't resynthesize prefixed identifiers. |
| @@ -599,7 +598,9 @@ class ResynthTest extends ResolverTestCase { |
| VariableElementImpl original, String desc) { |
| compareElements(resynthesized, original, desc); |
| compareTypes(resynthesized.type, original.type, desc); |
| - if (shouldCompareConstValues) { |
| + // TODO(scheglov) implement and validate other constant variable types |
| + if (shouldCompareConstValues && |
| + original is ConstTopLevelVariableElementImpl) { |
| compareConstantExpressions(resynthesized.constantInitializer, |
| original.constantInitializer, desc); |
| } |
| @@ -1006,6 +1007,57 @@ class E {}'''); |
| checkLibrary('class C {} class D {}'); |
| } |
| + test_const_reference_type() { |
| + shouldCompareConstValues = true; |
| + checkLibrary(r''' |
| +class C {} |
| +class D<T> {} |
| +enum E {a, b, c} |
| +typedef F(int a, String b); |
| +const vDynamic = dynamic; |
| +const vNull = Null; |
| +const vObject = Object; |
| +const vClass = C; |
| +const vGenericClass = D; |
| +const vEnum = E; |
| +const vFunctionTypeAlias = F; |
| +'''); |
| + } |
| + |
| + test_const_reference_type_imported() { |
| + shouldCompareConstValues = true; |
| + addLibrarySource( |
| + '/a.dart', |
| + r''' |
| +class C {} |
| +enum E {a, b, c} |
| +typedef F(int a, String b); |
| +'''); |
| + checkLibrary(r''' |
| +import 'a.dart'; |
| +const vClass = C; |
| +const vEnum = E; |
| +const vFunctionTypeAlias = F; |
| +'''); |
| + } |
| + |
| + test_const_reference_type_imported_withPrefix() { |
| + shouldCompareConstValues = true; |
| + addLibrarySource( |
| + '/a.dart', |
| + r''' |
| +class C {} |
| +enum E {a, b, c} |
| +typedef F(int a, String b); |
| +'''); |
| + checkLibrary(r''' |
| +import 'a.dart' as p; |
| +const vClass = p.C; |
| +const vEnum = p.E; |
| +const vFunctionTypeAlias = p.F; |
| +'''); |
| + } |
| + |
| test_const_topLevel_binary() { |
| shouldCompareConstValues = true; |
| checkLibrary(r''' |