Skip to content

Allow comment references on generic typedefs #2756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/src/model/typedef.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@ class Typedef extends ModelElement
Map<String, CommentReferable> get referenceChildren {
if (_referenceChildren == null) {
_referenceChildren = {};
_referenceChildren
.addEntriesIfAbsent(parameters.explicitOnCollisionWith(this));

// Only consider parameters if this is a function typedef.
if (isCallable) {
_referenceChildren
.addEntriesIfAbsent(parameters.explicitOnCollisionWith(this));
}
_referenceChildren
.addEntriesIfAbsent(typeParameters.explicitOnCollisionWith(this));
}
Expand Down
2 changes: 2 additions & 0 deletions testing/test_package/lib/features/generalized_typedefs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ library generalized_typedefs;

typedef T0 = void;
typedef T1 = Function;

/// [List], [String]
typedef T2<X> = List<X>;
typedef T3<X, Y> = Map<X, Y>;
typedef T4 = void Function();
Expand Down