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

Implement GenericRequirement support for member type disambiguation #1283

Merged
merged 6 commits into from
Mar 3, 2024

Conversation

art-divin
Copy link
Collaborator

Resolves #1087

Context

This PR adds implements to Type & co, so that it is now possible to preserve information about protocol requirements during deserialization of variables and method-related types.

In particular, for cases like:

struct GenericStruct<T>: Equatable where T: Equatable {
  func method(_ arg: T) {}
}

method's argument type's actualTypeName is resolved to (Equatable) instead of simply T.
Before this PR, it was resolved to nil.

Let's also consider the following use case with protocol composition:

struct GenericStruct<T>: Equatable where T: Equatable, T: Codable {
  let value: T
}

here, variable's type is resolved as a ProtocolComposition type with Codable and Equatable Protocol instances bound together, that is, actualTypeName becomes (Codable & Equatable) respectively.

@art-divin art-divin added this to the 2.1.8 milestone Mar 3, 2024
@art-divin art-divin self-assigned this Mar 3, 2024
@art-divin art-divin merged commit 0783692 into master Mar 3, 2024
2 checks passed
@art-divin art-divin deleted the generic-requirements-in-types branch March 3, 2024 14:20
art-divin added a commit that referenced this pull request Mar 17, 2024
…1283)

* Implement GenericRequirement support for member type disambiguation

* Reverted redundant change

* Added missing argument for Type_Linux

* Updated generated files

* Moved Type+SwiftSyntax to separate file

* Removed redundant protocol conformance
art-divin added a commit that referenced this pull request Mar 17, 2024
…1283)

* Implement GenericRequirement support for member type disambiguation

* Reverted redundant change

* Added missing argument for Type_Linux

* Updated generated files

* Moved Type+SwiftSyntax to separate file

* Removed redundant protocol conformance
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.

The generic type is not recognized correctly
1 participant