Fix interface macro to handle qualified IUnknown parent #1732
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1687
We have to differentiate between
IUnknown
and any other parent COM interface. This is becauseIUnknown::new
only have two generic parameters (T: IUknownImpl
andOFFSET
) while all other interfaces havenew
function that takes three generic parameters (Identify: IUnknownImpl
,Impl
the interface impl, andOFFSET
).This change makes our check for
IUnknown
a bit more sophisticated. However, this is still a syntactic check and if a ident that is semantically equivalent toIUnknown
(but syntactically equivalent) is provided (e.g.,type MyIUnknown = windows::core::IUnknown
oruse core::windows::IUnknown as MyIUnknown
), this check will not detect that it'sIUnknown
and the user will get the bad error message again which just says we're providing three generic arguments tonew
when two are expected.The way to actually fix this is to not special case
IUnknown
and treat it like any other parent interface, but that's a bigger change that will require moving other things around.