Fix #7931: Resolve opened namespaces for attributes in recursive scopes#19502
Draft
Fix #7931: Resolve opened namespaces for attributes in recursive scopes#19502
Conversation
Member
|
@copilot : Try again |
Copilot stopped work on behalf of
T-Gro due to an error
March 27, 2026 08:41
Member
|
@copilot : Try again. |
Copilot stopped work on behalf of
T-Gro due to an error
March 27, 2026 11:55
Member
|
@copilot Try again |
Contributor
Author
Implemented the fix in commit Root cause: In recursive scopes ( Fix: Added |
Copilot
AI
changed the title
[WIP] Copilot Request
Fix #7931: Resolve opened namespaces for attributes in recursive scopes
Mar 31, 2026
c8d283c to
676aa49
Compare
Contributor
❗ Release notes required
|
676aa49 to
898193d
Compare
Pre-process open declarations before Phase1A attribute checking in recursive scopes (namespace rec / module rec). Previously, opens were only processed in Phase1AB after module entities were built, but module attributes needed access to opened namespaces during Phase1A. The fix adds preProcessOpensForPhase1A which silently resolves opens before Phase1A, making opened namespaces available for attribute resolution on modules and types in recursive scopes. Agent-Logs-Url: https://github.com/dotnet/fsharp/sessions/20a6e4bb-a5f1-45cc-b80d-ee1110cd8812 Co-authored-by: abonie <20281641+abonie@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/fsharp/sessions/20a6e4bb-a5f1-45cc-b80d-ee1110cd8812 Co-authored-by: abonie <20281641+abonie@users.noreply.github.com>
30a7b89 to
7f17efd
Compare
…ublished Move release notes entry to 11.0.200.md to match the new FSharpLibrariesChangelogVersion. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
7f17efd to
baf9133
Compare
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.
Description
Fixes nested module attributes not being resolved in
namespace rec/module recscopes. Previously, using[<Extension>]on a module insidenamespace recwould fail withFS0039: The type 'Extension' is not defined, even whenopen System.Runtime.CompilerServiceswas in scope.Root Cause
In recursive scopes, open declarations are processed in Phase1AB — after Phase1A builds module/type entities. But module attributes are checked during Phase1A using
envInitial, which doesn't yet include the opened namespaces. In non-recursive scopes, opens are processed sequentially before module attributes are checked, so this issue doesn't occur.Changes Made
src/Compiler/Checking/CheckDeclarations.fs: AddedpreProcessOpensForPhase1Ahelper that silently resolves open declarations before Phase1A attribute checking. UsessuppressErrorReportingandTemporarilySuspendReportingTypecheckResultsToSinkto avoid duplicate diagnostics (since opens are re-processed properly in Phase1AB). Applied at two levels:TcMutRecDefns_Phase1(fixesnamespace reccase)TcTyconDefnCore_Phase1A_BuildInitialModule(fixes nested module case)AttributeResolutionInRecursiveScopes.fscovering the issue scenarios (Extension attribute on modules/types innamespace rec, nested modules, multiple opens,module rec, and non-recursive baseline).docs/release-notes/.FSharp.Compiler.Service/11.0.100.md.Testing
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.