Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib/SymbolGraphGen is discarding PATs from declarations #70245

Open
tayloraswift opened this issue Dec 5, 2023 · 2 comments
Open

lib/SymbolGraphGen is discarding PATs from declarations #70245

tayloraswift opened this issue Dec 5, 2023 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels

Comments

@tayloraswift
Copy link
Member

Description

lib/SymbolGraphGen appears to be losing the some Identifiable PAT substitution when printing declaration signatures. here’s an example:

public
func f(_:some Sequence<some Identifiable>)
{
}

which simply renders as

func f(_:some Sequence)

in the generated documentation. there is no indication that this API contains additional generic constraints.

"declarationFragments": [
{
    "kind": "keyword",
    "spelling": "func"
},
{
    "kind": "text",
    "spelling": " "
},
{
    "kind": "identifier",
    "spelling": "f"
},
{
    "kind": "text",
    "spelling": "("
},
{
    "kind": "externalParam",
    "spelling": "_"
},
{
    "kind": "text",
    "spelling": ": some "
},
{
    "kind": "typeIdentifier",
    "spelling": "Sequence",
    "preciseIdentifier": "s:ST"
},
{
    "kind": "text",
    "spelling": ")"
}
],

Reproduction

see above

Expected behavior

the printed signature should include the some Identifiable constraint.

Environment

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

Additional information

No response

@tayloraswift tayloraswift added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Dec 5, 2023
@slavapestov
Copy link
Contributor

The declaration of f() has the same semantic effect as

public func f<T, U>(_: T) where T: Sequence, T.Element == U, U: Identifiable

and the requirements should probably be encoded in the form of a generic signature; I would not expect the type of the parameter to say "Sequence" of any sort.

@tayloraswift
Copy link
Member Author

tayloraswift commented Dec 5, 2023

why is the second type parameter needed? couldn’t it just be

func f<T>(_:T) where T:Sequence, T.Element:Identifiable

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

2 participants