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

Leverage AlsoUsableForAttribute for more interoperable typedefs #930

Merged
merged 7 commits into from
May 9, 2023

Conversation

mikebattista
Copy link
Contributor

Fixed #199
Fixed #924

Adds implicit conversion operators between AlsoUsableFor types. An existing example included in the tests is BCRYPT_KEY_HANDLE -> BCRYPT_HANDLE.

When microsoft/win32metadata#1517 is fixed, this will also support HMODULE <=> HINSTANCE conversions.

Generates an implicit conversion operator for each AlsoUsableFor type. Assumes the other type is in the same namespace for now. Open question how this would behave with cyclical relationships like HMODULE and HINSTANCE.
@mikebattista mikebattista added the enhancement New feature or request label May 8, 2023
@mikebattista mikebattista requested a review from AArnott May 8, 2023 22:10
Copy link
Member

@AArnott AArnott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good. Just a couple changes please.

test/Microsoft.Windows.CsWin32.Tests/StructTests.cs Outdated Show resolved Hide resolved
src/Microsoft.Windows.CsWin32/Generator.TypeDef.cs Outdated Show resolved Hide resolved
src/Microsoft.Windows.CsWin32/Generator.TypeDef.cs Outdated Show resolved Hide resolved
Copy link
Member

@AArnott AArnott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. Thanks. I don't think I ever finished explaining the set of tests we have to run locally. I'll run them myself and then merge.

@AArnott AArnott merged commit 96083e6 into main May 9, 2023
@AArnott AArnott deleted the mikebattista/alsousablefor branch May 9, 2023 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HINSTANCE is missing Leverage AlsoUsableForAttribute for more interoperable typedefs
2 participants