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

Extract NS_TYPED_ENUM and NS_TYPED_EXTENSIBLE_ENUM #440

Closed
4 tasks done
ronaldoussoren opened this issue Feb 20, 2022 · 0 comments
Closed
4 tasks done

Extract NS_TYPED_ENUM and NS_TYPED_EXTENSIBLE_ENUM #440

ronaldoussoren opened this issue Feb 20, 2022 · 0 comments

Comments

@ronaldoussoren
Copy link
Owner

ronaldoussoren commented Feb 20, 2022

NS_TYPED_ENUM and NS_TYPED_EXTENSIBLE_ENUM are basically comparable with typing.NewType(), find a way to extract these using the metadata scanner and add NewType definitions for them to metadata, as was done earlier for NS_ENUM (with with a different base type).

A problem with this: at least up to Xcode 13.3 the information is not easily extractable using clang's C API.

It might be easier to just maintain these manually, there appear to be only 235 definitions of those in framework headers.

For now:

  • Update PyObjCTools.TestSupport (TestCase.assertIsTypedEnum(tp, basetype)
  • Update metadata compiler
  • Add tests for NS_TYPED*_ENUM in all framework wrappers
  • Manually add metadata for these typed enums to framework wrappers

Updating the metadata extractor can wait.

Note that this issue is only a small step toward static typing support, it allows using Cocoa type names in type annotations, but does not help in actually running a static type checker that will require generating typing stubs for framework bindings.

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

No branches or pull requests

1 participant