Skip to content

Commit 8460c9a

Browse files
simolus3jcollins-g
andauthored
Allow comment references on generic typedefs (#2756)
Co-authored-by: Janice Collins <[email protected]>
1 parent 2c393eb commit 8460c9a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Diff for: lib/src/model/typedef.dart

+6-2
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
}

Diff for: testing/test_package/lib/features/generalized_typedefs.dart

+2
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)