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

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

Issue 1711873002: Fix for summarizing typedef typed parameters. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/generated/resolver_test.dart
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index 05516361075026f511386907b189f7e7105870e0..6e83f056e24f68f466bc8be3aff2340b587e2a31 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -220,6 +220,7 @@ class AnalysisContextFactory {
}
FunctionElementImpl thenOnValue = ElementFactory.functionElement3(
'onValue', futureThenR, [futureElement.typeParameters[0]], null);
+ thenOnValue.synthetic = true;
DartType futureRType = futureElement.type.substitute4([futureThenR.type]);
MethodElementImpl thenMethod = ElementFactory
@@ -256,12 +257,13 @@ class AnalysisContextFactory {
];
DartType returnType = streamSubscriptionElement.type
.substitute4(streamElement.type.typeArguments);
- List<DartType> parameterTypes = <DartType>[
- ElementFactory
- .functionElement3('onData', VoidTypeImpl.instance.element,
- <TypeDefiningElement>[streamElement.typeParameters[0]], null)
- .type,
- ];
+ FunctionElementImpl listenOnData = ElementFactory.functionElement3(
+ 'onData',
+ VoidTypeImpl.instance.element,
+ <TypeDefiningElement>[streamElement.typeParameters[0]],
+ null);
+ listenOnData.synthetic = true;
+ List<DartType> parameterTypes = <DartType>[listenOnData.type,];
// TODO(brianwilkerson) This is missing the optional parameters.
MethodElementImpl listenMethod =
ElementFactory.methodElement('listen', returnType, parameterTypes);
@@ -16957,10 +16959,25 @@ class _StaticTypeAnalyzer2TestShared extends ResolverTestCase {
Source testSource;
CompilationUnit testUnit;
- SimpleIdentifier _findIdentifier(String search) {
- SimpleIdentifier identifier = EngineTestCase.findNode(
- testUnit, testCode, search, (node) => node is SimpleIdentifier);
- return identifier;
+ /**
+ * Looks up the identifier with [name] and validates that its type type
+ * stringifies to [type] and that its generics match the given stringified
+ * output.
+ */
+ _expectFunctionType(String name, String type,
+ {String elementTypeParams: '[]',
+ String typeParams: '[]',
+ String typeArgs: '[]',
+ String typeFormals: '[]'}) {
+ SimpleIdentifier identifier = _findIdentifier(name);
+ // Element is either ExecutableElement or ParameterElement.
+ var element = identifier.staticElement;
+ FunctionTypeImpl functionType = identifier.staticType;
+ expect(functionType.toString(), type);
+ expect(element.typeParameters.toString(), elementTypeParams);
+ expect(functionType.typeParameters.toString(), typeParams);
+ expect(functionType.typeArguments.toString(), typeArgs);
+ expect(functionType.typeFormals.toString(), typeFormals);
}
/**
@@ -17004,27 +17021,6 @@ class _StaticTypeAnalyzer2TestShared extends ResolverTestCase {
}
/**
- * Looks up the identifier with [name] and validates that its type type
- * stringifies to [type] and that its generics match the given stringified
- * output.
- */
- _expectFunctionType(String name, String type,
- {String elementTypeParams: '[]',
- String typeParams: '[]',
- String typeArgs: '[]',
- String typeFormals: '[]'}) {
- SimpleIdentifier identifier = _findIdentifier(name);
- // Element is either ExecutableElement or ParameterElement.
- var element = identifier.staticElement;
- FunctionTypeImpl functionType = identifier.staticType;
- expect(functionType.toString(), type);
- expect(element.typeParameters.toString(), elementTypeParams);
- expect(functionType.typeParameters.toString(), typeParams);
- expect(functionType.typeArguments.toString(), typeArgs);
- expect(functionType.typeFormals.toString(), typeFormals);
- }
-
- /**
* Validates that [type] matches [expected].
*
* If [expected] is a string, validates that the type stringifies to that
@@ -17038,6 +17034,12 @@ class _StaticTypeAnalyzer2TestShared extends ResolverTestCase {
}
}
+ SimpleIdentifier _findIdentifier(String search) {
+ SimpleIdentifier identifier = EngineTestCase.findNode(
+ testUnit, testCode, search, (node) => node is SimpleIdentifier);
+ return identifier;
+ }
+
void _resolveTestUnit(String code) {
testCode = code;
testSource = addSource(testCode);
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_elements.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698