SwiftDocOrg / swift-doc

A documentation generator for Swift projects
https://swiftdoc.org
MIT License
1.68k stars 100 forks source link

Character substitution in file names can lead to collisions #285

Open Lukas-Stuehrk opened 3 years ago

Lukas-Stuehrk commented 3 years ago

When generating file names for symbols, swift-doc replaces some characters of the symbol's name with underscore (_).

This can lead to the problem that it produces the same file name for different symbols with different names. The second symbol then overwrites the page of the previously declared symbol.

This happens rather often with operators:

infix operator >>>
public func >>> (lhs: String, rhs: String) { }

infix operator <<<
public func <<< (lhs: String, rhs: String) { }

Both create the file ___.

But it can also happen for any other symbol:

public class Outer {
    public struct Inner {}
}

public class Outer_Inner {}

Both symbols create the file Outer_Inner.

mattt commented 3 years ago

Related to #258