Skip to content

Commit ba16d63

Browse files
committed
Allow comment references on generic typedefs
1 parent 98b4c17 commit ba16d63

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/src/model/typedef.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,12 @@ class Typedef extends ModelElement
7171
Map<String, CommentReferable> get referenceChildren {
7272
if (_referenceChildren == null) {
7373
_referenceChildren = {};
74-
_referenceChildren
75-
.addEntriesIfAbsent(parameters.explicitOnCollisionWith(this));
74+
75+
// Only consider parameters if this is a function typedef.
76+
if (isCallable) {
77+
_referenceChildren
78+
.addEntriesIfAbsent(parameters.explicitOnCollisionWith(this));
79+
}
7680
_referenceChildren
7781
.addEntriesIfAbsent(typeParameters.explicitOnCollisionWith(this));
7882
}

testing/test_package/lib/features/generalized_typedefs.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ library generalized_typedefs;
1010

1111
typedef T0 = void;
1212
typedef T1 = Function;
13+
14+
/// [List], [String]
1315
typedef T2<X> = List<X>;
1416
typedef T3<X, Y> = Map<X, Y>;
1517
typedef T4 = void Function();

0 commit comments

Comments
 (0)