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

[swift2objc] Support Parsing Generic Types and Type Constraints #1831

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

nikeokoronkwo
Copy link
Contributor

Generic Types in Swift are similar to generics in Dart, and are used for similar purposes in structs, classes, typealiases and functions.

Type Constraints are a Swift feature where the type in a generic function or class can be restricted based on whether it implements either a given protocol or a given class:

func myFunc<T: Equatable>(param: T) {
  // function body
}

Dart has a similar feature where a generic is constrained to extend a given class.

This pull request adds support for not only parsing type generics but also for parsing type constraints by

  • Adding support for parsing type generics in Swift
  • Being able to easily access generics used in compound declarations from the methods, properties and nested declarations in it
  • Including fields for the constraints applied on the given generic type
  • Adding support for parsing such constraints from functions
  • Adding support for parsing such constraints from compound declarations
  • Adding support for getting type constraints used in Swift Extensions

More information can be found here: #1814

@nikeokoronkwo
Copy link
Contributor Author

At the moment, Type Constraint tests do not succeed completely because support for protocols have not been implemented, so either of #1828 or #1827 have to be implemented to make successful tests for these

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

Successfully merging this pull request may close these issues.

1 participant