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

Unified Diff: pkg/analyzer/lib/src/summary/resynthesize.dart

Issue 2808093004: Fix use of generic function type aliases for fields (issue 29237) (Closed)
Patch Set: added failing tests 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
Index: pkg/analyzer/lib/src/summary/resynthesize.dart
diff --git a/pkg/analyzer/lib/src/summary/resynthesize.dart b/pkg/analyzer/lib/src/summary/resynthesize.dart
index a6620cc6f5b8f6920815ab98cf92b9ebfb2964e1..fc9cf16b698cd36e199c1010cd03b03a4ada0d18 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -1256,11 +1256,23 @@ class _ReferenceInfo {
*/
DartType buildType(bool instantiateToBoundsAllowed, int numTypeArguments,
DartType getTypeArgument(int i), List<int> implicitFunctionTypeIndices) {
- DartType result =
- (numTypeParameters == 0 && implicitFunctionTypeIndices.isEmpty)
- ? type
- : _buildType(instantiateToBoundsAllowed, numTypeArguments,
- getTypeArgument, implicitFunctionTypeIndices);
+ DartType result;
+ if (numTypeParameters == 0 && implicitFunctionTypeIndices.isEmpty) {
+ if (element is GenericTypeAliasElementHandle) {
+ List<DartType> argumentTypes = <DartType>[];
+ for (int i = 0; i < numTypeArguments; i++) {
+ argumentTypes.add(getTypeArgument(i));
+ }
+ GenericTypeAliasElementImpl actualElement =
+ (element as GenericTypeAliasElementHandle).actualElement;
+ result = actualElement.typeAfterSubstitution(argumentTypes);
+ } else {
+ result = type;
+ }
+ } else {
+ result = _buildType(instantiateToBoundsAllowed, numTypeArguments,
+ getTypeArgument, implicitFunctionTypeIndices);
+ }
if (result == null) {
return DynamicTypeImpl.instance;
}
@@ -1837,6 +1849,11 @@ class _UnitResynthesizer {
case ReferenceKind.typedef:
element = new FunctionTypeAliasElementHandle(
summaryResynthesizer, location);
+ if ((element as ElementHandle).actualElement
+ is GenericTypeAliasElement) {
+ element = new GenericTypeAliasElementHandle(
+ summaryResynthesizer, location);
+ }
isDeclarableType = true;
break;
case ReferenceKind.variable:
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | pkg/analyzer/test/generated/non_error_resolver_driver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698