Skip to content

Add snapshot test: projectable constructor with NullConditionalRewriteSupport.Ignore - #211

Draft
PhenX with Copilot wants to merge 4 commits into
masterfrom
copilot/fix-constructor-syntax-issue
Draft

Add snapshot test: projectable constructor with NullConditionalRewriteSupport.Ignore#211
PhenX with Copilot wants to merge 4 commits into
masterfrom
copilot/fix-constructor-syntax-issue

Conversation

CopilotAI commented May 28, 2026

Copy link
Copy Markdown
Contributor

No test coverage existed for [Projectable] constructors that use null-conditional operators (?.) together with NullConditionalRewriteSupport.Ignore. The syntax shown in the issue — a DTO constructor projecting from an entity with optional navigation properties — was untested.

Changes

  • New snapshot testProjectableConstructor_WithNullConditionalIgnore in ConstructorTests.cs covering a constructor body that combines:
    • Null-conditional property access (source.Dossier?.Numero)
    • Null-conditional method call (source.Type?.ToString())
    • Ternary assignment (source.IsForfait ? "Yes" : "No")
    • Plain property mapping
[Projectable(NullConditionalRewriteSupport=NullConditionalRewriteSupport.Ignore)]publicProjection(Sourcesource){Libelle=source.Libelle;NumeroDossier=source.Dossier?.Numero;TotalHt=source.TotalHt;TypeValue=source.Type?.ToString();IsForfaitDisplay=source.IsForfait?"Yes":"No";}

The generator correctly strips ?. to plain . access under Ignore mode, producing a valid EF Core-translatable member-init expression. The snapshot locks in this behaviour as a regression guard.

CopilotAI linked an issue May 28, 2026 that may be closed by this pull request
CopilotAI changed the title [WIP] Fix constructor syntax to generate code correctlyFix target-typed new() expressions failing in [Projectable] methodsMay 28, 2026
CopilotAI requested a review from PhenXMay 28, 2026 14:56
CopilotAI changed the title Fix target-typed new() expressions failing in [Projectable] methodsVerify target-typed new(args) (constructor form) is handled correctly by implicit new rewriterMay 28, 2026
Copilot stopped work on behalf of PhenX due to an error May 28, 2026 15:39
…eSupport.Ignore and null-conditional operators
CopilotAI changed the title Verify target-typed new(args) (constructor form) is handled correctly by implicit new rewriterAdd snapshot test: projectable constructor with NullConditionalRewriteSupport.IgnoreMay 28, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Constructor syntax cannot generate code

2 participants

@PhenX