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

Unified Diff: pkg/analyzer/test/src/summary/resynthesize_test.dart

Issue 1650833002: Resynthesize type references. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
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..89a57779efba07085c202ea85a4d0069f821d61e 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_test.dart
@@ -599,7 +599,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 +1008,55 @@ class E {}''');
checkLibrary('class C {} class D {}');
}
+ test_const_reference_type() {
Paul Berry 2016/01/31 13:41:02 There should be a test case for the problem mentio
scheglov 2016/01/31 18:55:29 Done.
+ shouldCompareConstValues = true;
+ checkLibrary(r'''
+class C {}
+enum E {a, b, c}
+typedef F(int a, String b);
+const vDynamic = dynamic;
+const vNull = Null;
+const vObject = Object;
+const vClass = C;
+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'''

Powered by Google App Engine
This is Rietveld 408576698