Repository navigation
Add coverage for StrictIn local home handling - #85758
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Co-authored-by: AlekseyTs <10522107+AlekseyTs@users.noreply.github.com>
| public class CodeGenInParametersTests : CompilingTestBase | ||
| { | ||
| [Fact, WorkItem(85757, "https://github.com/dotnet/roslyn/issues/85757")] | ||
| public void HasHome_StrictInLocal() |
There was a problem hiding this comment.
@copilot While a test like this is useful to preserve the behavior, please try to come up with another unit-test that exercises the code path while compiling some valid C# code.
There was a problem hiding this comment.
I instrumented the exact branch and tried valid-source scenarios across the extension-indexer/extension-member, reordered explicit in, inline-array, async-spill, and dynamic code-generation paths, including running the full relevant test classes. None reached it: the current lowering producers of StrictIn locals only flow those locals to readonly consumers (ReadOnly/ReadOnlyStrict), so a writable/constrained HasHome check is not presently source-reachable. I restored the instrumentation and kept the direct unit test as the focused coverage for this defensive branch.
There was a problem hiding this comment.
@copilot Please add similar direct unit-test for this code path
There was a problem hiding this comment.
Added the direct BoundDup coverage in af678b1. The test verifies a StrictIn duplicate has a readonly home, and the now-covered fail-fast assertion was removed.
Co-authored-by: AlekseyTs <10522107+AlekseyTs@users.noreply.github.com>
Co-authored-by: AlekseyTs <AlekseyTs@users.noreply.github.com>
|
@dotnet/roslyn-compiler Please review |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved review issues remain.
Review effort: Lite
Findings: None
What changed in this PR
Adds compiler test coverage for CodeGenerator.HasHome handling of lowered StrictIn locals and duplicates.
Changes:
- Adds writable and read-only home behavior tests.
- Removes temporary debug assertions.
| File | Description |
|---|---|
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenInParametersTests.cs |
Adds focused StrictIn local and duplicate coverage. |
src/Compilers/CSharp/Portable/CodeGen/CodeGenerator_HasHome.cs |
Removes temporary assertions. |
| } | ||
| else if (localRefKind == RefKindExtensions.StrictIn) | ||
| { | ||
| Debug.Assert(localRefKind != RefKindExtensions.StrictIn, "Add a test if this assert fails for the scenario."); |
There was a problem hiding this comment.
The added unit tests call this method directly, not via some full compilation scenario; is that because it's not observable like that?
There was a problem hiding this comment.
The added unit tests call this method directly, not via some full compilation scenario; is that because it's not observable like that?
See Copilot's response at #85758 (comment)
CodeGenerator.HasHomelacked coverage for checking whether a loweredStrictInlocal has a writable home.Changes
StrictInlocal and verifies it has no writable home.CodeGenerator.HasHome#85757