Skip to content

Commit

Permalink
Fix validation of @link tags to symbols outside documentation
Browse files Browse the repository at this point in the history
Resolves #2681
  • Loading branch information
Gerrit0 committed Aug 23, 2024
1 parent 158ef93 commit bd5cd66
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### Bug Fixes

- Fixed an issue where links in packages mode would be resolved incorrectly, #2680.
- `@link` tags to symbols which are not included in the documentation will produce invalid link warnings again, #2681.
- Fixed handling of `@param` tags on comments attached to function callback parameters, #2683.

## v0.26.6 (2024-08-18)
Expand Down
3 changes: 2 additions & 1 deletion src/lib/validation/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
type Comment,
type CommentDisplayPart,
type ProjectReflection,
ReflectionSymbolId,
} from "../models";
import type { Logger } from "../utils";

Expand All @@ -16,7 +17,7 @@ function getBrokenPartLinks(parts: readonly CommentDisplayPart[]) {
if (
part.kind === "inline-tag" &&
linkTags.includes(part.tag) &&
!part.target
(!part.target || part.target instanceof ReflectionSymbolId)
) {
links.push(part.text.trim());
}
Expand Down
4 changes: 4 additions & 0 deletions src/test/converter2/issues/gh2681.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* {@link Generator}
*/
export const bug = 123;
10 changes: 10 additions & 0 deletions src/test/issues.c2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1671,6 +1671,16 @@ describe("Issue Tests", () => {
logger.expectNoOtherMessages();
});

it("#2681 reports warnings on @link tags which resolve to a type not included in the documentation", () => {
const project = convert();
app.options.setValue("validation", false);
app.options.setValue("validation", { invalidLink: true });
app.validate(project);
logger.expectMessage(
'warn: Failed to resolve link to "Generator" in comment for bug',
);
});

it("#2683 supports @param on parameters with functions", () => {
const project = convert();
const action = querySig(project, "action");
Expand Down

0 comments on commit bd5cd66

Please sign in to comment.