gsc: awaited imported Task[(named)] keeps element names (ADR-0172, #3501) - #3625
Merged
Merged
Conversation
) An imported awaitable whose signature carries reference-nullability metadata arrives wrapped in a NullabilityAnnotatedTypeSymbol, hiding the symbolic constructed Task from TryGetTaskElementType's #2195 fast path — the CLR fallback then rebuilt the element from the closed ValueTuple and erased its names, so `(await Store.RetryAsync(id)).X` died with GS0158 (the code-exploder gate's `Cannot find member AnalysisId` family). Unwrap to the symbolic base exactly when a type argument carries named-tuple content; the base's arguments already carry their element nullability. Regression test: cross-assembly async round trip covering both a plain `await` element access and an if-let unwrap of an awaited nullable named tuple. Known follow-up (pre-existing, reproduced without this change): an async-function `if let` over a NON-awaited imported call returning `Nullable<ValueTuple<…>>` with names emits invalid IL — ILVerify StackUnexpected `found Nullobjref, expected Nullable<ValueTuple<int32, string>>` in MoveNext — filed separately. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nng28yiBdPVdeML7mSZphs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #3622: the code-exploder gate's
GS0158: Cannot find member AnalysisIdfamily. An imported awaitable whose signature carries reference-nullability metadata arrives wrapped inNullabilityAnnotatedTypeSymbol, hiding the symbolic constructedTaskfromTryGetTaskElementType's #2195 fast path — the CLR fallback rebuilt the element from the closedValueTupleand erased its names, so(await store.RetryAsync(id)).AnalysisIdfailed to bind. Fix: unwrap to the symbolic base exactly when a type argument carries named-tuple content (ContainsNamedTupleElementsgate, matching the #3622 projection-gate family); the base's arguments already carry their element nullability.Verified on the pinned code-exploder
Task<(Guid AnalysisId, string? GitRef)?>shape reduced to a minimal cross-assembly repro (compiles + runs), plus a new round-trip test coveringawaitelement access and an if-let unwrap of an awaited nullable named tuple. Async/await suites green (Compiler.Tests 326, Core.Tests 453).Known follow-up (pre-existing, reproduced without this change): an async-function
if letover a non-awaited imported call returningNullable<ValueTuple<…>>-with-names emits invalid IL — ILVerifyStackUnexpected: found Nullobjref, expected Nullable<ValueTuple<int32,string>>inMoveNext— filing separately.🤖 Generated with Claude Code
https://claude.ai/code/session_01Nng28yiBdPVdeML7mSZphs