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

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

Issue 1445273002: Revert "Use FunctionElementImpl for inline function type parameters" (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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/resolver.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 0c1a4a040c58b7200c9da1f29f8eaac8eacf8f33..66380677ec31404b455a47d541cdf6d61177ad40 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -207,17 +207,20 @@ class AnalysisContextFactory {
ElementFactory.requiredParameter2(
"value", futureElement.typeParameters[0].type)
];
- FunctionElementImpl onValueFunction = new FunctionElementImpl.forNode(null);
- onValueFunction.synthetic = true;
- onValueFunction.parameters = parameters;
- onValueFunction.returnType = provider.dynamicType;
- onValueFunction.enclosingElement = futureElement;
- onValueFunction.type = new FunctionTypeImpl(onValueFunction);
+ FunctionTypeAliasElementImpl aliasElement =
+ new FunctionTypeAliasElementImpl.forNode(null);
+ aliasElement.synthetic = true;
+ aliasElement.parameters = parameters;
+ aliasElement.returnType = provider.dynamicType;
+ aliasElement.enclosingElement = asyncUnit;
+ aliasElement.shareTypeParameters(futureElement.typeParameters);
+ FunctionTypeImpl aliasType = new FunctionTypeImpl.forTypedef(aliasElement);
+ aliasElement.type = aliasType;
DartType futureDynamicType =
futureElement.type.substitute4([provider.dynamicType]);
MethodElement thenMethod = ElementFactory.methodElementWithParameters(
futureElement, "then", futureDynamicType, [
- ElementFactory.requiredParameter2("onValue", onValueFunction.type),
+ ElementFactory.requiredParameter2("onValue", aliasType),
ElementFactory.namedParameter2("onError", provider.functionType)
]);
futureElement.methods = <MethodElement>[thenMethod];
@@ -12212,30 +12215,6 @@ main() {
expect(ft.toString(), '(String) → List<int>');
}
- void test_genericMethod_functionTypedParameter() {
- _resolveTestUnit(r'''
-class C<E> {
- List/*<T>*/ f/*<T>*/(/*=T*/ f(E e)) => null;
-}
-main() {
- C<String> cOfString;
-}
-''');
- SimpleIdentifier f = _findIdentifier('f');
- MethodElementImpl e = f.staticElement;
- expect(e.typeParameters.toString(), '[T]');
- expect(e.type.typeParameters.toString(), '[T, E]');
- expect(e.type.typeArguments.toString(), '[T, E]');
- expect(e.type.toString(), '((E) → T) → List<T>');
-
- SimpleIdentifier c = _findIdentifier('cOfString');
- FunctionType ft = (c.staticType as InterfaceType).getMethod('f').type;
- expect(ft.toString(), '((String) → T) → List<T>');
- DartType t = e.typeParameters[0].type;
- ft = ft.substitute2([typeProvider.intType], [t]);
- expect(ft.toString(), '((String) → int) → List<int>');
- }
-
void test_pseudoGeneric_max_doubleDouble() {
String code = r'''
import 'dart:math';
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698