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

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

Issue 1586493002: Tests for propagated type of final/const fields/top-levels. (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c27b507966ad4b9aa95a6e4f46393425ad423045..0e06726623350456c2e4bb44cb4d6edb0db0c310 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_test.dart
@@ -371,6 +371,7 @@ class ResynthTest extends ResolverTestCase {
PropertyInducingElementImpl original,
String desc) {
compareVariableElements(resynthesized, original, desc);
+ compareTypes(resynthesized.propagatedType, original.propagatedType, desc);
if (original.getter == null) {
expect(resynthesized.getter, isNull);
} else {
@@ -487,10 +488,68 @@ class ResynthTest extends ResolverTestCase {
// TODO(paulberry): test initializer
}
+ fail_field_propagatedType_const_noDep() {
+ checkLibrary('''
+class C {
+ static const x = 0;
+}''');
+ }
+
+ fail_field_propagatedType_final_dep_inLib() {
+ addNamedSource('/a.dart', 'final a = 1;');
+ checkLibrary('''
+import "a.dart";
+class C {
+ final b = a / 2;
+}''');
+ }
+
+ fail_field_propagatedType_final_dep_inPart() {
+ addNamedSource('/a.dart', 'part of lib; final a = 1;');
+ checkLibrary('''
+library lib;
+part "a.dart";
+class C {
+ final b = a / 2;
+}''');
+ }
+
+ fail_field_propagatedType_final_noDep_instance() {
+ checkLibrary('''
+class C {
+ final x = 0;
+}''');
+ }
+
+ fail_field_propagatedType_final_noDep_static() {
+ checkLibrary('''
+class C {
+ static final x = 0;
+}''');
+ }
+
fail_library_hasExtUri() {
checkLibrary('import "dart-ext:doesNotExist.dart";');
}
+ fail_variable_propagatedType_const_noDep() {
+ checkLibrary('const i = 0;');
+ }
+
+ fail_variable_propagatedType_final_dep_inLib() {
+ addNamedSource('/a.dart', 'final a = 1;');
+ checkLibrary('import "a.dart"; final b = a / 2;');
+ }
+
+ fail_variable_propagatedType_final_dep_inPart() {
+ addNamedSource('/a.dart', 'part of lib; final a = 1;');
+ checkLibrary('library lib; part "a.dart"; final b = a / 2;');
+ }
+
+ fail_variable_propagatedType_final_noDep() {
+ checkLibrary('final i = 0;');
+ }
+
LibraryElementImpl resynthesizeLibrary(
Source source, LibraryElementImpl original, bool allowErrors,
{int resynthesisCount: 1}) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698