Skip to content

(SymbolGraphGen) encoding of same-type generic constraints loses information for shadowed types #74406

Open
@tayloraswift

Description

@tayloraswift

Description

currently, given a module M that vends its own Int type, and two generic constraints T == Array<Swift.Int>, T == Array<M.Int>, lib/SymbolGraphGen will emit the exact same information for both constraints, causing extension members to appear in the wrong extension.

this happens because lib/SymbolGraphGen identifies the constraint with rhs of the string Array<Int> and rhsPrecise pointing to Array<T>, without substituting types.

Reproduction

public
enum Namespace
{
    public
    enum E<T>
    {
        case e(T)
    }
}
public
enum Int
{
}
public
enum Generic<T>
{
}
extension Generic:Equatable where T == Namespace.E<Int>
{
}
extension Generic:Sendable where T == Namespace.E<Swift.Int>
{
}

Expected behavior

the conditions for the two conformances should be distinguishable

Environment

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

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    SymbolGraphGenThe swiftSymbolGraphGen library, responsible for gathering and emitting symbol graphs.bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions