rdl reader: drop TypeAttributes::Public for ExclusiveTo interfaces#4162
rdl reader: drop TypeAttributes::Public for ExclusiveTo interfaces#4162
Conversation
Agent-Logs-Url: https://github.com/microsoft/windows-rs/sessions/7ee48006-98fe-4b30-ae34-6c18277f0a9c Co-authored-by: kennykerr <9845234+kennykerr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/windows-rs/sessions/7ee48006-98fe-4b30-ae34-6c18277f0a9c Co-authored-by: kennykerr <9845234+kennykerr@users.noreply.github.com>
…declarations Agent-Logs-Url: https://github.com/microsoft/windows-rs/sessions/b92e41b2-7898-4254-abf7-02c09a0dc751 Co-authored-by: kennykerr <9845234+kennykerr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/windows-rs/sessions/b92e41b2-7898-4254-abf7-02c09a0dc751 Co-authored-by: kennykerr <9845234+kennykerr@users.noreply.github.com>
|
|
||
| #[test] | ||
| pub fn exclusive_to_with_use() { | ||
| reader() |
There was a problem hiding this comment.
@copilot the only thing this needs to be testing is that the resulting TypeDef in the winmd is not public.
- Use
reader().input_str("class ... interface ... ") ...to write a winmd with an exclusive interface. - Use
windows-metadatareader to check the interfaceTypeAttributes::Publicflag is present on the class but not present on the interface.
There was a problem hiding this comment.
Done in 8d61cb6. The test now:
- Uses
reader().input_str(...)withuse Windows::Foundation::Metadata::*+#[ExclusiveTo(Foo)] - Reads back the winmd via
windows_metadata::reader::TypeIndexand assertsFoohasTypeAttributes::PublicwhileIFoodoes not.
…To visibility Agent-Logs-Url: https://github.com/microsoft/windows-rs/sessions/e0a53afd-3a7f-4e7b-9cb4-9636e4ecf339 Co-authored-by: kennykerr <9845234+kennykerr@users.noreply.github.com>
|
@copilot fmt failed |
Agent-Logs-Url: https://github.com/microsoft/windows-rs/sessions/3df256d2-2ad8-42e9-a9f9-1ec490623ead Co-authored-by: kennykerr <9845234+kennykerr@users.noreply.github.com>
|
@copilot - check the build - this change means the winmd files that are checked in will have to be commited as they would have changed. |
Agent-Logs-Url: https://github.com/microsoft/windows-rs/sessions/c1b90523-0a1a-4189-a384-817861f35bc8 Co-authored-by: kennykerr <9845234+kennykerr@users.noreply.github.com>
Done in bad108a. All 6 checked-in winmd files that contain ExclusiveTo interfaces have been regenerated with the updated |
|
@copilot more diff winmd files |
WinRT interfaces marked with
Windows.Foundation.Metadata.ExclusiveToAttributeareNotPublicin Windows SDK metadata — they're implementation details bound to a specific class. The RDL reader was unconditionally settingTypeAttributes::Publicon all encoded interfaces, causing a flag mismatch when roundtripping.reader/attribute_ref.rs: Addedis_exclusive_to_attributehelper usingfind_attribute_type— same pattern asis_guid_attribute. This correctly handlesuseglob imports so both#[Windows::Foundation::Metadata::ExclusiveTo(Foo)]and ause-shortened#[ExclusiveTo(Foo)]are detected.reader/interface.rs:encode_interfaceomitsTypeAttributes::Publicwhenis_exclusive_to_attributematches any attribute on the interface.exclusive-to.rdl) for the full-qualified form;exclusive_to_with_usetest inuse-declarations.rsusesreader().input_str(...)with ause Windows::Foundation::Metadata::*glob import and#[ExclusiveTo(Foo)], then reads back the winmd viawindows_metadata::reader::TypeIndexto assert that the class carriesTypeAttributes::Publicwhile the exclusive interface does not.TypeAttributes—tests/winrt/reference/metadata.winmd,tests/winrt/events/metadata.winmd,tests/misc/component/component.winmd,samples/robot/component/robot.winmd,samples/robot/component_cpp/robot.winmd, andsamples/json/json_validator_winrt/sample.winmd.