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

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

Issue 2651773003: Add summary support to CL 2647833002.
Patch Set: Clean up Created 3 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 | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | 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_common.dart
diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart
index e1448b4333ef7faaa83c94476cc460821772d40c..e320bed6cd945ce1a4900ce676fbf62e9acedafb 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_common.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -3287,6 +3287,52 @@ f() {}''');
checkLibrary('f() {} g() {}');
}
+ test_futureOr() {
+ var library = checkLibrary('import "dart:async"; FutureOr<int> x;');
+ var variables = library.definingCompilationUnit.topLevelVariables;
+ expect(variables, hasLength(1));
+ if (createOptions().strongMode) {
+ expect(variables[0].type.toString(), 'FutureOr<int>');
+ } else {
+ expect(variables[0].type.toString(), 'dynamic');
+ }
+ }
+
+ test_futureOr_const() {
+ var library = checkLibrary('import "dart:async"; const x = FutureOr;');
+ var variables = library.definingCompilationUnit.topLevelVariables;
+ expect(variables, hasLength(1));
+ var x = variables[0] as ConstTopLevelVariableElementImpl;
+ if (createOptions().strongMode) {
+ expect(x.type.toString(), 'Type');
+ } else {
+ expect(x.type.toString(), 'dynamic');
+ }
+ expect(x.constantInitializer.toString(), 'FutureOr');
+ }
+
+ test_futureOr_inferred() {
+ var library = checkLibrary('''
+import "dart:async";
+FutureOr<int> f() => null;
+var x = f();
+var y = x.then((z) => z.asDouble());
+''');
+ var variables = library.definingCompilationUnit.topLevelVariables;
+ expect(variables, hasLength(2));
+ var x = variables[0];
+ expect(x.name, 'x');
+ var y = variables[1];
+ expect(y.name, 'y');
+ if (createOptions().strongMode) {
+ expect(x.type.toString(), 'FutureOr<int>');
+ expect(y.type.toString(), 'dynamic');
+ } else {
+ expect(x.type.toString(), 'dynamic');
+ expect(y.type.toString(), 'dynamic');
+ }
+ }
+
test_generic_gClass_gMethodStatic() {
prepareAnalysisContext(createOptions());
checkLibrary('''
« no previous file with comments | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698