Skip to content

combined module link issue - public extension of dependent module causes resolution failure #1257

@keeshux

Description

@keeshux

Description

I discovered this while using the https://github.com/swiftlang/swift-docc-plugin, but the error is triggered by the DocC link resolution, so I'm trying to post this here.

After merging multiple targets with --enable-experimental-combined-documentation (yes, this is from the plugin), I noticed that some absolute links failed to resolve and were interpreted as relative, to some extent. Given two targets Main and Dependency, if Main mentions some /Dependency/SomeClass in its documentation, it's normally rendered. However, if Main provides a public extension of any Dependency entity, the link breaks, because it tries to look up /Main/Dependency/SomeClass. The relative link looks up SomeClass in the public extensions of Dependency in Main, so resolution obviously fails.

It's worth adding that /Dependency/SomeClass exists in the .doccarchive, so the link is the only problem.

Checklist

  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue.

Expected Behavior

All links beginning with a / must resolve to an absolute path.

Actual behavior

Absolute links are sometimes resolved to a relative path.

Steps To Reproduce

I have set up a repository to reproduce the behavior consistently.

https://github.com/keeshux/docc-combined-link-bug

Swift-DocC Version Information

6.1.0

Swift Compiler Version Information

swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3)
Target: arm64-apple-macosx15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions