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

[SR-15852] Add structural type data to symbol graph #66

Closed
WFT opened this issue Feb 11, 2022 · 2 comments
Closed

[SR-15852] Add structural type data to symbol graph #66

WFT opened this issue Feb 11, 2022 · 2 comments

Comments

@WFT
Copy link

WFT commented Feb 11, 2022

Previous ID SR-15852
Radar None
Original Reporter @WFT
Type New Feature
Additional Detail from JIRA
Votes 0
Component/s Swift-DocC
Labels New Feature
Assignee None
Priority Medium

md5: 5e91a1a29db3a0603ba5134fd34897a1

Issue Description:

Filed based on discussion on swift forums. Filed under "Swift-DocC" because there isn't a separate "SymbolKit" component.

Declarations/symbols (properties, methods, subscripts, etc.) should have their type information encoded as structural data. This helps with the goal of visualizing the connections between types and declarations.

An example: for the following declaration of bar(baz: ), we should be able to pull out both that the parameter baz takes an Optional with the generic Wrapped parameter substituted with String AND that the return type is a tuple with element .0 equal to Int and element .what equal to Array with the generic Element parameter substituted by UInt. For each type mentioned here I’d like to be able to pull out the USR/“precise identifier” of the type if there is one (i.e. not for the anonymous tuple) along with any generic parameters substituted.

struct Foo {
    func bar(baz: String?) -> (Int, what: [UInt]) { (0, what: []) }
}

Ideally I’d be able to draw out from the information above that given the result of calling bar(baz: ) I can get a UInt by accessing the Array subscript of the .what member. That requires being able to take the generic substitution map from [UInt] and apply it to a symbol like Array’s subscript. If I could then also connect that to Sequence.Element (so I can tell that iteration can also extract a UInt), that would be fantastic!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 3, 2022
@d-ronnqvist d-ronnqvist transferred this issue from apple/swift-docc Dec 21, 2023
@d-ronnqvist
Copy link
Contributor

The symbol graph contains type signatures (parameters and return values) for functions/methods, and as of apple/swift#70207 also for subscripts and initializers.

@d-ronnqvist
Copy link
Contributor

If you want to request more type signature information that's not already in symbol graph files today, please open new issues on the compiler for that source language (for issues on the Swift compiler please prefix the issue with "[SymbolGraphGen]")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants