Skip to content

[xabt] Fix redundant ternary in GenerateResourceDesignerAssembly#11214

Open
jonathanpeppers wants to merge 1 commit intomainfrom
op-fix-redundant-ternary-designer
Open

[xabt] Fix redundant ternary in GenerateResourceDesignerAssembly#11214
jonathanpeppers wants to merge 1 commit intomainfrom
op-fix-redundant-ternary-designer

Conversation

@jonathanpeppers
Copy link
Copy Markdown
Member

@jonathanpeppers jonathanpeppers commented Apr 24, 2026

Summary

Simplify a dead conditional in GenerateResourceDesignerAssembly.cs where both ternary branches produced the same value (TypeAttributes.Public).

Changes

Before:

TypeAttributes attrib = AssemblyName.IsNullOrEmpty () ? TypeAttributes.Public : TypeAttributes.Public;

After:

TypeAttributes attrib = TypeAttributes.Public;

Context

This dead conditional was introduced in the original commit (dc3ccf28c, PR #6427). The IVT attribute added at lines 108-114 suggests one branch may have been intended to use TypeAttributes.NotPublic, but since the ResourceConstant type has been public since inception, changing visibility would be a behavioral change. The IVT attribute is harmless when the type is already public, so this PR simply removes the redundant ternary without altering behavior.

This is a zero-semantic-difference simplification — no behavioral change.

Both branches of the ternary on line 155 produced TypeAttributes.Public,
making the conditional dead code. Simplify to a direct assignment.

The IVT at lines 108-114 suggests one branch may have been intended to use
NotPublic, but since the type has been public since inception (PR #6427),
changing visibility would be a behavioral change best handled separately.
The IVT attribute remains harmless when the type is already public.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 24, 2026 21:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes a dead/ redundant conditional in GenerateResourceDesignerAssembly while preserving existing behavior for the generated ResourceConstant type inside the resource designer assembly generation task.

Changes:

  • Replace a ternary expression that always evaluated to TypeAttributes.Public with a direct assignment to TypeAttributes.Public.

@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants