Azure / Azure/azure-sdk-tools

[Swift APIView] APIView missing type inheritance that appears in code

Open
#3,090 0 comments 0 reactions 0 assignees View on GitHub
APIView Client Swift
Dominant language
C#
Stars
135
Forks
260
Avg merge
3d 1h
Merged PRs (30d)
143

Description

We have this example from Apple's documentation:

```Swift
extension Array: TextRepresentable where Element: TextRepresentable {
public var textualDescription: String {
let itemsAsText = self.map { $0.textualDescription }
return "[" + itemsAsText.joined(separator: ", ") + "]"
}
}
```

This renders in APIView as:
```Swift
extension Array where Element: TextRepresentable {
public var textualDescription: String
}
```

The curious thing is that the `TextRepresentable` annotation on `Array` is removed. Looking into the AST, it appears this information is `nil` in the node, suggesting that perhaps it isn't relevant or the compiler deems it redundant. The other alternative is a bug in the AST library.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Apple documentation example in Swift APIView and inspect the AST node for the extension's type inheritance, where the TextRepresentable annotation appears to be nil. Compare the rendered output with the source; done when the Array inheritance annotation is preserved in the APIView output.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.