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

Substitute underlying type from typealias #1292

Merged
merged 4 commits into from
Mar 5, 2024

Conversation

art-divin
Copy link
Collaborator

@art-divin art-divin commented Mar 5, 2024

Resolves #831

Context

This PR adds a type by name lookup for recognizing types hidden "behind" a typealias.

Using the following template, wrong results were produced:

<%
let foo = types.structs.first { $0.name == "Foo" }!

let bar = foo.instanceVariables.first { $0.name == "bar" }!
print(bar.type.name)
print(bar.typeName)
print(bar.typeName.actualTypeName)
%>
Query Before After
print(bar.type) nil Optional(Int)
print(bar.typeName) Bar Bar
print(bar.typeName.actualTypeName) nil Optional(Int)

@art-divin art-divin added this to the 2.1.8 milestone Mar 5, 2024
@art-divin art-divin self-assigned this Mar 5, 2024
@art-divin art-divin changed the title Swifttemplate underlying type typealias Substitute underlying type from typealias Mar 5, 2024
@art-divin art-divin merged commit 8a5e896 into master Mar 5, 2024
2 checks passed
@art-divin art-divin deleted the swifttemplate-underlying-type-typealias branch March 5, 2024 18:02
art-divin added a commit that referenced this pull request Mar 17, 2024
* Attempt to fix the missing underlying type when typealias is used

* Reverted redundant change

* Updated generated code

* Replaced API from macOS(v13) to v12
art-divin added a commit that referenced this pull request Mar 17, 2024
* Attempt to fix the missing underlying type when typealias is used

* Reverted redundant change

* Updated generated code

* Replaced API from macOS(v13) to v12
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

Successfully merging this pull request may close these issues.

Feature request: resolve typealiases inherited from protocols
1 participant