-
Notifications
You must be signed in to change notification settings - Fork 162
Description
Description
Note This issue was first discussed here.
Having Lib1 depending on Lib2, and a third target Main reexporting Lib1 and Lib2, and in Lib1 having the extensions defined to the types declared in Lib2, the variables defined in these extensions, are shown on the root level of the doc archive.
E.g. this code produces a top level symbol func foo() in the documentation archive.
// Lib1
public struct Lib1Struct { }
// Lib2
import Lib1
public extension Lib1Struct {
func foo() { }
}
// Main
@_exported import Lib1
@_exported import Lib2Checklist
- If possible, I've reproduced the issue using the
mainbranch of this package. - This issue hasn't been addressed in an existing GitHub issue.
Expected Behavior
The expected behavior depends on the discussion around #331. If we decide to implement #331, and do not emit symbols from @_exported imports entirely, we of course would expect the extensions across the re-exported libraries to disappear as well.
If we reject #331 in favor of the current behavior, the expected behavior would be for the symbols resulting from these cross-re-export extensions to be presented as part of the re-exporting target (Main in the example`). These extensions would not be considered extensions to external types, as the types, as well as the extensions, are all re-exported by the same target. That is, there would be no Extended Module sections under which the extension-based symbols are listed. The expected structure of the archive would be as follows:
- Main:
- Lib1Struct:
- foo()
Actual behavior
Currently, the structure generated for the example above is as follows:
- Main:
- Lib1Struct
- foo()
Steps To Reproduce
- Make sure you have a setup ready that can produce extension block symbols, e.g. a recent nightly toolchain.
- Build the symbol graph files with
-emit-extension-block-symbols:swift build --target Main -Xswiftc -emit-symbol-graph -Xswiftc -emit-symbol-graph-dir -Xswiftc .build/symbol-graphs -Xswiftc -omit-extension-block-symbols -Xswiftc -emit-extension-block-symbols - Preview the documentation as usual with
docc. Make sure you use an up to date version (mainbranch).
Swift-DocC Version Information
Swift Compiler Version Information
Swift version 5.8-dev (LLVM c10fcd3e640b373, Swift 11d9927b51f90d4)
Target: arm64-apple-macosx12.0