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

Unified Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 1508183002: fixes #25094, type params in static methods shouldn't always be an error (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merged Created 5 years 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/generated/error_verifier.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/generated/resolver_test.dart
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index 6de6602645c6399fa129acdeaa042b6682ac52ff..41347297615d02e4cc41675b3bb6ff0f84b1ab74 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -12743,6 +12743,27 @@ main() {
expect(ft.toString(), '(String) → String');
}
+ void test_genericFunction_static() {
+ _resolveTestUnit(r'''
+class C<E> {
+ static /*=T*/ f/*<T>*/(/*=T*/ x) => null;
+}
+''');
+ SimpleIdentifier f = _findIdentifier('f');
+ MethodElementImpl e = f.staticElement;
+ expect(e.typeParameters.toString(), '[T]');
+ expect(e.type.boundTypeParameters.toString(), '[T]');
+ // TODO(jmesserly): we could get rid of this {E/E} substitution, but it's
+ // probably harmless, as E won't be used in the function (error verifier
+ // checks this), and {E/E} is a no-op anyway.
+ expect(e.type.typeParameters.toString(), '[E]');
+ expect(e.type.typeArguments.toString(), '[E]');
+ expect(e.type.toString(), '<T>(T) → T');
+
+ FunctionType ft = e.type.instantiate([typeProvider.stringType]);
+ expect(ft.toString(), '(String) → String');
+ }
+
void test_genericFunction_typedef() {
String code = r'''
typedef T F<T>(T x);
« no previous file with comments | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698