… projection diagnostic
The `controlFlowPreventingContentProjection` diagnostic (NG8011) counted `@let`
declarations as root nodes of a control flow block, so a block like
`@if (x) { @let a = 1; <div foo>{{a}}</div> }` was reported as preventing
`<div foo>` from being projected into its slot. The compiler skips `@let`
declarations when it picks the node to project (since angular#58607), so the node is
projected correctly and the warning is a false positive.
Skip `@let` declarations when counting root nodes, like the compiler does.
Fixes angular#71172
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
NG8011 fires when a @let declaration sits next to the node at the root of a control flow block:
The warning says <span error> won't be projected into the [error] slot, but it is. Since #58607 the compiler skips @let declarations when it looks for the single root node of a block. The diagnostic does its own count in TcbControlFlowContentProjectionOp.shouldCheck and still treats the @let as a second root node.
Issue Number: Fixes #71172
What is the new behavior?
shouldCheck skips @let declarations, so the diagnostic agrees with what the compiler does. I added two tests: one for the case above (no diagnostic), and one with a @let plus a stray text node, which is still reported. The first one fails without the change.
Does this PR introduce a breaking change?
Other information
It only removes a false-positive warning; the generated code doesn't change.