swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.3k stars 10.33k forks source link

(lib/SymbolGraphGen) clip the ACL of nested declarations to the ACL of their lexical parents #75917

Open tayloraswift opened 4 weeks ago

tayloraswift commented 4 weeks ago

Description

lib/SymbolGraphGen believes S “inherits” the nominally public P.f method, even though the protocol and all its members are internal.

Reproduction

protocol P
{
    func f()
}
extension P
{
    public
    func f()
    {
    }
}
public
struct S:P
{
}

Expected behavior

lib/SymbolGraphGen should clip the ACL of child declarations to the ACL of their lexical parent.

Environment

swift --version Swift version 5.10 (swift-5.10-RELEASE) Target: x86_64-unknown-linux-gnu

Additional information

No response

tayloraswift commented 4 weeks ago

on closer inspection, i believe the “inheritance” relationship is correct as the feature indeed exists internally within the module, the bug is that the child declaration is recorded as public when in fact it should be internal.