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

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

Issue 1610043002: Add propagated types to summary files. (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 667f3cd4c6d7173398a62f121b60a49326920312..cb21e441f7d6147f27bab0b9d27734d9a2317c44 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_test.dart
@@ -509,68 +509,10 @@ 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;');
- }
-
ElementImpl getActualElement(Element element, String desc) {
if (element is ElementHandle) {
return element.actualElement;
@@ -1042,6 +984,46 @@ class C {
}''');
}
+ test_field_propagatedType_const_noDep() {
+ checkLibrary('''
+class C {
+ static const x = 0;
+}''');
+ }
+
+ test_field_propagatedType_final_dep_inLib() {
+ addNamedSource('/a.dart', 'final a = 1;');
+ checkLibrary('''
+import "a.dart";
+class C {
+ final b = a / 2;
+}''');
+ }
+
+ test_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;
+}''');
+ }
+
+ test_field_propagatedType_final_noDep_instance() {
+ checkLibrary('''
+class C {
+ final x = 0;
+}''');
+ }
+
+ test_field_propagatedType_final_noDep_static() {
+ checkLibrary('''
+class C {
+ static final x = 0;
+}''');
+ }
+
test_function_documented() {
checkLibrary('''
// Extra comment so doc comment offset != 0
@@ -1600,6 +1582,31 @@ var x;''');
checkLibrary('var x;');
}
+ test_variable_propagatedType_const_noDep() {
+ checkLibrary('const i = 0;');
+ }
+
+ test_variable_propagatedType_final_dep_inLib() {
+ addNamedSource('/a.dart', 'final a = 1;');
+ checkLibrary('import "a.dart"; final b = a / 2;');
+ }
+
+ test_variable_propagatedType_final_dep_inPart() {
+ addNamedSource('/a.dart', 'part of lib; final a = 1;');
+ checkLibrary('library lib; part "a.dart"; final b = a / 2;');
+ }
+
+ test_variable_propagatedType_final_noDep() {
+ checkLibrary('final i = 0;');
+ }
+
+ test_variable_propagatedType_implicit_dep() {
+ // The propagated type is defined in a library that is not imported.
+ addNamedSource('/a.dart', 'class C {}');
+ addNamedSource('/b.dart', 'import "a.dart"; C f() => null;');
+ checkLibrary('import "b.dart"; final x = f();');
+ }
+
test_variable_setterInPart_getterInPart() {
addNamedSource('/a.dart', 'part of my.lib; void set x(int _) {}');
addNamedSource('/b.dart', 'part of my.lib; int get x => 42;');
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_elements.dart ('k') | pkg/analyzer/test/src/summary/summary_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698