quality: cut dead-code false positives across C++, C#, XAML, tests#190
Merged
Conversation
Five complementary fixes targeting the dominant FP buckets observed in
the wild on desktop .NET / Win32 repositories.
- unused_export now treats an incoming `calls` / `method_implements`
/ `reads` edge on the symbol itself as evidence of life. The
existing pass only checked file-level `imported_names`, which
missed intra-file C++ helpers and qualified `Foo::method`
definitions reached via call resolution rather than headers.
- C++ qualified definitions (`void Foo::method() { … }`) now extract
with `parent_name=Foo` and `kind=method`. New cpp.scm pattern for
two-level `NS::Foo::method` declarations plus a parser helper that
walks the qualified_identifier scope to recover the immediate
enclosing type. Free functions are unaffected.
- `dynamic_hints/dotnet.py` learned `typeof(TypeName)` — catches
`[JsonConverter(typeof(X))]`, `[TypeConverter(...)]`,
`DataTemplate.DataType = typeof(X)`, and manual DI registration.
- `dynamic_hints/xaml.py` learned `<prefix:TypeName …>` element-tag
references — catches converters, controls, templates declared as
XAML elements without a `using` directive on the C# side. Property
syntax (`<Grid.Resources>`) and bare built-in tags are excluded.
- `_NEVER_FLAG_PATTERNS` adds standard test-project globs
(`*Tests/*.cs`, `*.UnitTests/*.cs`, `*FuzzTests/*.cs`,
`*UITest*/*.cs`, `*Tests.cs`, …) plus `*/unittests/*.cpp|.h`.
swati510
approved these changes
May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Five complementary fixes targeting the dominant false-positive buckets observed on desktop .NET / Win32 repositories. Probed against PowerToys; expected reductions estimated read-only from the existing index.
unused_exportnow treats an incomingcalls/method_implements/readsedge on the symbol itself as evidence of life. Previously only file-levelimported_nameswas checked.void Foo::method() { … }now extracts withparent_name=Fooandkind=method. Newcpp.scmpattern for two-levelNS::Foo::methodplus a parser helper that walks thequalified_identifierscope. Free functions unaffected.dynamic_hints/dotnet.pylearnstypeof(TypeName)— covers[JsonConverter(typeof(X))],DataTemplate.DataType = typeof(X), manual DI registration.dynamic_hints/xaml.pylearns<prefix:TypeName …>element-tag references — catches converters, controls, templates declared as XAML elements. Property syntax (<Grid.Resources>) and bare built-in tags are excluded._NEVER_FLAG_PATTERNSadds test-project globs (*Tests/*.cs,*.UnitTests/*.cs,*FuzzTests/*.cs,*UITest*/*.cs,*Tests.cs, …) plus*/unittests/*.cpp|.h.Projected post-fix on PowerToys:
Test plan
test_unused_export_skipped_when_symbol_has_incoming_callstest_qualified_definition_binds_to_class(cppFoo::DoOne, two-levelNS::Bar::DoTwo)test_typeof_type_emits_dynamic_uses,test_typeof_lowercase_local_ignoredtest_element_tag_with_prefix_extracted,test_element_tag_property_syntax_skipped,test_bare_xaml_element_not_a_type_reference