Fix spurious FS0410 for tuple patternInput bindings (#4161)#19947
Draft
KirtiRamchandani wants to merge 1 commit into
Draft
Fix spurious FS0410 for tuple patternInput bindings (#4161)#19947KirtiRamchandani wants to merge 1 commit into
KirtiRamchandani wants to merge 1 commit into
Conversation
Contributor
❗ Release notes requiredYou can open this PR in browser to add release notes: open in github.dev
|
Author
@dotnet-policy-service agree |
Skip accessibility checks on compiler-generated patternInput module bindings. These temps are module-init scaffolding whose visibility does not reflect the enclosing let-binding scope, which caused false FS0410 errors when tuple deconstruction referenced private types in the same module. Fixes dotnet#4161
e29e017 to
0c0aafc
Compare
4 tasks
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
Fixes #4161.
Tuple deconstruction (
let b, c = ...) introduces a compiler-generatedpatternInputmodule binding for module init. FS0410 incorrectly fires on that temp when its type exposes private tycons (e.g.PT * PT), while the equivalent single binding (let a = ...) compiles fine because objexpr types don't trigger the same check.This skips the FS0410 accessibility check only for compiler-generated
patternInputbindings. Genuine violations still report FS0410 (tuples03.fs,tuples04.fs).Related prior work: #18426 (closed unmerged; maintainer noted a deeper codegen fix may be preferable long-term).
Verification (local)
Built
fsc15.2.101.0 from this branch and compiled:repro4161.fs(private module tuple deconstruction)tuples02.fs(public + private modules)tuples03.fs(public module + internal type)tuples04.fs(internal module + private type)repro4161.fs --realsig+Release ComponentTests build succeeded locally (6205 passed in prior full run).
Fixes #4161