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

Unified Diff: pkg/analyzer/lib/src/dart/element/type.dart

Issue 2664643002: fix #28519, assertion incorrectly triggering (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | pkg/analyzer/lib/src/generated/error_verifier.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/element/type.dart
diff --git a/pkg/analyzer/lib/src/dart/element/type.dart b/pkg/analyzer/lib/src/dart/element/type.dart
index b9508032f303e2594666ac27e9a59a7b794e72fb..3e40fb67421c0c72e1bf847ff641e1dbd5157c84 100644
--- a/pkg/analyzer/lib/src/dart/element/type.dart
+++ b/pkg/analyzer/lib/src/dart/element/type.dart
@@ -959,6 +959,8 @@ class FunctionTypeImpl extends TypeImpl implements FunctionType {
* and return TArgs.
*
* This function must be called with type [f] that was instantiated from [g].
+ *
+ * If [g] is not generic, returns an empty list.
*/
static Iterable<DartType> recoverTypeArguments(
FunctionType g, FunctionType f) {
@@ -968,7 +970,11 @@ class FunctionTypeImpl extends TypeImpl implements FunctionType {
//
// For now though, this is a pretty quick operation.
assert(identical(g.element, f.element));
- assert(g.typeFormals.isNotEmpty && f.typeFormals.isEmpty);
+ if (g.typeFormals.isEmpty) {
+ assert(g == f);
+ return DartType.EMPTY_LIST;
+ }
+ assert(f.typeFormals.isEmpty);
assert(g.typeFormals.length + g.typeArguments.length ==
f.typeArguments.length);
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/error_verifier.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698