Skip to content

Commit

Permalink
Remove extraneous parens from function-type (#3856)
Browse files Browse the repository at this point in the history
  • Loading branch information
srawlins committed Aug 30, 2024
1 parent 199c7b4 commit e50623b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/src/render/element_type_renderer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ abstract class ElementTypeRenderer<T extends ElementType> {
String wrapNullabilityParens(T elementType, String inner) =>
elementType.nullabilitySuffix.isEmpty
? inner
: '($inner${elementType.nullabilitySuffix})';
: '$inner${elementType.nullabilitySuffix}';
}

// HTML implementations.
Expand Down
9 changes: 4 additions & 5 deletions test/element_type_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,11 @@ void f(int Function(String)? p) {}

expect(
parameterType.linkedName,
// TODO(https://github.com/dart-lang/dartdoc/issues/2381): Fix.
'($intLink Function'
'$intLink Function'
'<span class="signature">'
'(<span class="parameter" id="param-">'
'<span class="type-annotation">$stringLink</span>'
'</span>)</span>?)',
'</span>)</span>?',
);
expect(parameterType.nameWithGenerics, equals('Function'));
});
Expand All @@ -190,11 +189,11 @@ void f(int Function<T>(T)? p) {}

expect(
parameterType.linkedName,
'($intLink Function'
'$intLink Function'
'&lt;<wbr><span class="type-parameter">T</span>&gt;'
'<span class="signature">'
'(<span class="parameter" id="param-">'
'<span class="type-annotation">T</span></span>)</span>?)',
'<span class="type-annotation">T</span></span>)</span>?',
);
expect(
parameterType.nameWithGenerics,
Expand Down

0 comments on commit e50623b

Please sign in to comment.