Publicize enclosing types of publicized nested types - #200
Merged
Conversation
PublicizeType set NestedPublic on the target but never walked up DeclaringType, so targeting a member of a nested type left the enclosing type internal and the member unreachable (CS0122). Walk the declaring chain and publicize each enclosing type.
krafs
marked this pull request as ready for review
July 22, 2026 17:59
krafs
force-pushed
the
fix-publicize-enclosing-types
branch
from
July 22, 2026 17:59
2c4ef43 to
a48800b
Compare
krafs
added a commit
that referenced
this pull request
Aug 3, 2026
Publicizing a nested type walks up and publicizes its enclosers, which silently undid a DoNotPublicize naming one of them: the exclusion does not reach nested types, so the sweep publicized them and the walk-up dragged the excluded type public again. Regression since #200, in 2.3.1. The walk-up is the engine's own inference, so it now yields to a type the user excluded by name. Reaching a denied type directly still publicizes it, which keeps an explicitly named member usable.
krafs
added a commit
that referenced
this pull request
Aug 3, 2026
Publicizing a nested type walks up and publicizes its enclosers, which silently undid a DoNotPublicize naming one of them: the exclusion does not reach nested types, so the sweep publicized them and the walk-up dragged the excluded type public again. Regression since #200, in 2.3.1. The walk-up is the engine's own inference, so it now yields to a type the user excluded by name. Reaching a denied type directly still publicizes it, which keeps an explicitly named member usable.
krafs
added a commit
that referenced
this pull request
Aug 3, 2026
Publicizing a nested type walks up and publicizes its enclosers, which silently undid a DoNotPublicize naming one of them: the exclusion does not reach nested types, so the sweep publicized them and the walk-up dragged the excluded type public again. Regression since #200, in 2.3.1. The walk-up is the engine's own inference, so it now yields to a type the user excluded by name. Reaching a denied type directly still publicizes it, which keeps an explicitly named member usable.
krafs
added a commit
that referenced
this pull request
Aug 3, 2026
Publicizing a nested type walks up and publicizes its enclosers, which silently undid a DoNotPublicize naming one of them: the exclusion does not reach nested types, so the sweep publicized them and the walk-up dragged the excluded type public again. Regression since #200, in 2.3.1. The walk-up is the engine's own inference, so it now yields to a type the user excluded by name. Reaching a denied type directly still publicizes it, which keeps an explicitly named member usable.
This was referenced Aug 24, 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.
Targeting a member of a nested type (e.g.
Asm:Ns.Outer+Inner.field) madeInnerNestedPublicbut left the enclosingOuterinternal, so the member stayed unreachable withCS0122— the whole point of publicizing it defeated wheneverOuterwasn't otherwise opened up.PublicizeTypenow walks up theDeclaringTypechain and publicizes each enclosing type.This changes publicization output, so assemblies cached by an earlier Publicizer are stale. #201 handles that automatically: the first build after upgrading re-publicizes them. No action needed on upgrade.