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 Type Constraints #1814

Open
nikeokoronkwo opened this issue Dec 16, 2024 · 2 comments
Open

[swift2objc] Support Type Constraints #1814

nikeokoronkwo opened this issue Dec 16, 2024 · 2 comments

Comments

@nikeokoronkwo
Copy link
Contributor

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 should be relatively easy to parse, as the symbol graph provides constraints information concerning this

@nikeokoronkwo
Copy link
Contributor Author

For the sake of completeness, this issue will also include support for type constraints for extensions, which is enforced in swift via the where clause.

extension Collection where Element: SomeProtocol {
    func someFunc() -> Bool where Element: Numeric {
        // function body
    }
}

@nikeokoronkwo
Copy link
Contributor Author

Noticed that type generics in general haven't been supported in the parsing frontend, so will work on both together.

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

No branches or pull requests

1 participant