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

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

Issue 2813543007: Pass ElementImpl as a context for resynthesizing types. (Closed)
Patch Set: Created 3 years, 8 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 748deea1f0e8524c517b746be61b590dfa5b13dc..aee2ada282422f0fdd95c5ef0a6f4678ae632f6f 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_common.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -8549,6 +8549,82 @@ class C<T, U> {
}
}
+ test_genericFunction_asFunctionReturnType() {
+ shouldCompareLibraryElements = false;
+ var library = checkLibrary(r'''
+int Function(int a, String b) f() => null;
+''');
+ checkElementText(
+ library,
+ r'''
+(int, String) → int f() {}
+''');
+ }
+
+ test_genericFunction_asFunctionTypedParameterReturnType() {
+ shouldCompareLibraryElements = false;
+ var library = checkLibrary(r'''
+void f(int Function(int a, String b) p(num c)) => null;
+''');
+ checkElementText(
+ library,
+ r'''
+void f((num) → (int, String) → int p) {}
+''');
+ }
+
+ test_genericFunction_asGenericFunctionReturnType() {
+ shouldCompareLibraryElements = false;
+ var library = checkLibrary(r'''
+typedef F = void Function(String a) Function(int b);
+''');
+ checkElementText(
+ library,
+ r'''
+typedef F = (String) → void Function(int b);
+''');
+ }
+
+ test_genericFunction_asMethodReturnType() {
+ shouldCompareLibraryElements = false;
+ var library = checkLibrary(r'''
+class C {
+ int Function(int a, String b) m() => null;
+}
+''');
+ checkElementText(
+ library,
+ r'''
+class C {
+ (int, String) → int m() {}
+}
+''');
+ }
+
+ test_genericFunction_asParameterType() {
+ shouldCompareLibraryElements = false;
+ var library = checkLibrary(r'''
+void f(int Function(int a, String b) p) => null;
+''');
+ checkElementText(
+ library,
+ r'''
+void f((int, String) → int p) {}
+''');
+ }
+
+ test_genericFunction_asTopLevelVariableType() {
+ shouldCompareLibraryElements = false;
+ var library = checkLibrary(r'''
+int Function(int a, String b) v;
+''');
+ checkElementText(
+ library,
+ r'''
+(int, String) → int v;
+''');
+ }
+
test_getElement_constructor_named() {
String text = 'class C { C.named(); }';
Source source = addLibrarySource('/test.dart', text);
« 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