Skip to content

Publicize enclosing types of publicized nested types - #200

Merged
krafs merged 1 commit into
mainfrom
fix-publicize-enclosing-types
Jul 22, 2026
Merged

Publicize enclosing types of publicized nested types#200
krafs merged 1 commit into
mainfrom
fix-publicize-enclosing-types

Conversation

@krafs

@krafs krafs commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Targeting a member of a nested type (e.g. Asm:Ns.Outer+Inner.field) made Inner NestedPublic but left the enclosing Outer internal, so the member stayed unreachable with CS0122 — the whole point of publicizing it defeated whenever Outer wasn't otherwise opened up. PublicizeType now walks up the DeclaringType chain 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.

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
krafs marked this pull request as ready for review July 22, 2026 17:59
@krafs
krafs force-pushed the fix-publicize-enclosing-types branch from 2c4ef43 to a48800b Compare July 22, 2026 17:59
@krafs
krafs merged commit 00d2bc2 into main Jul 22, 2026
10 checks passed
@krafs
krafs deleted the fix-publicize-enclosing-types branch July 22, 2026 18:02
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant