feat(shims): suppress SHIM001 for consumer-bridged types (#69 follow-up)#141
Merged
Merged
Conversation
The TransitionShimGenerator pre-pass now walks the consuming compilation's own namespaces and collects FQNs of every top-level public type under the target shim prefix. When the canonical-side walk would emit (or warn-skip) a type whose target FQN already exists in that set, the generator silently defers to the hand-written bridge — no source emitted, no SHIM001. Drops 20 of the live SHIM001 warnings on the Nuke.Common shim build (the 10 CI host singletons × 2 referenced-assembly paths from session 4). Remaining SHIM001 counts: 76 enum, 14 delegate, 8 no-accessible-ctor (4 unique: AbsolutePath, AzureKeyVault, MSBuildProject, DelegateDisposable), 4 struct, 4 ambiguous-across-assemblies, 2 sealed-class (GlobbingOptionsAttribute). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Merged
3 tasks
ChrisonSimtian
added a commit
that referenced
this pull request
May 24, 2026
…types (#69 session 5) (#142) DelegateDisposable falls in the no-accessible-ctor bucket (private ctor), but unlike the other 3 candidates it exposes its full surface via public static factories (CreateBracket × 2, SetAndRestore). A static-class shim re-exposing those factories actually helps real consumers — the factories return the canonical IDisposable, so calls flow through naturally. For the other 3 no-accessible-ctor types, hand-bridges would be empty or decorative: - AbsolutePath: dominant consumer usage is implicit string/AbsolutePath conversion and operator/ — neither can be carried by a static-class shim - AzureKeyVault, MSBuildProject: zero public statics, framework-constructed only; nothing to re-expose These three are documented as fallout-migrate rename targets in a new "What's NOT covered (and won't be)" README section. Drops 2 SHIM001 warnings (DelegateDisposable × 2 referenced-assembly paths) via the suppression mechanism from #141. Remaining no-accessible-ctor types in the live build (AbsolutePath, AzureKeyVault, MSBuildProject) are exactly the three documented fallout-migrate targets. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 tasks
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
Cleans up the 20 SHIM001 warnings left over from session 4 (the 10 CI host singleton hand-bridges × 2 referenced-assembly paths).
The
TransitionShimGeneratornow pre-walks the consuming compilation's own namespaces under the target shim prefix and collects FQNs of every top-level public type the consumer has hand-written. When the canonical-side walk would emit a shim for a type whose target FQN already exists in that set, the generator silently defers to the hand-bridge — no source emitted, no SHIM001 diagnostic.Why no annotation?
Considered an explicit
[assembly: SkipShimForCanonical(typeof(...))]marker. Rejected because:NukeBuildhand-bridge inNuke.Common.NukeBuild.csand any future hand-bridges with zero ceremony.A canonical name + arity match via
INamedTypeSymbol.MetadataNamekeeps arity-correctness for generics.Live impact
Before this PR (the Nuke.Common shim build):
After:
The 4 remaining unique
no-accessible-ctortypes —AbsolutePath,AzureKeyVault,MSBuildProject,DelegateDisposable— are the natural session-5 candidates.Verification
SkipsCanonicalTypesAlreadyHandBridgedByConsumercovers both the sealed-class case (would otherwise warn) and the regular-class case (would otherwise emit). Both should be silent when a hand-bridge exists.Fallout.SourceGenerators.Testspass — no snapshot regression on the existing 5.Nuke.Commonshim builds clean (0 errors) with the 20 CI host SHIM001 warnings now silent.tests/Nuke.Common.Shim.Testsstill builds clean.Test plan
NukeBuildhand-bridge is also auto-discovered (no behavior change there since the canonical name isFalloutBuild, notNukeBuild— different name, no collision)🤖 Generated with Claude Code