-
Notifications
You must be signed in to change notification settings - Fork 824
Fix SignatureHash to include constant values in hash computation #18771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Add hashConst function with exhaustive pattern matching over Const type - Modify hashNonMemberVal to include literal constant value in hash for deterministic builds - This ensures MVIDs change when constant values change (fixes #18758) Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
tests/fsharp/TestResults/_pkrvmq0rgcvqdmg_2025-07-21_15_40_57.trx
Outdated
Show resolved
Hide resolved
Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
❗ Release notes requiredCaution No release notes found for the changed paths (see table below). Please make sure to add an entry with an informative description of the change as well as link to this pull request, issue and language suggestion if applicable. Release notes for this repository are based on Keep A Changelog format. The following format is recommended for this repository:
If you believe that release notes are not necessary for this PR, please add NO_RELEASE_NOTES label to the pull request. You can open this PR in browser to add release notes: open in github.dev
|
tests/fsharp/TestResults/_pkrvmq0rgcvqdmg_2025-07-21_15_41_19.trx
Outdated
Show resolved
Hide resolved
Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
/run fantomas |
🔧 CLI Command Report
✅ Patch applied: |
Ran fantomas formatting - minor whitespace and indentation fixes applied to TypeHashing.fs in commit a6ce065. |
Problem
SignatureHash was not including the actual values of literal constants in its hash computation, only their names and types. This caused MVIDs to remain unchanged when constant values changed, which is incorrect for deterministic builds and assembly identity.
For example, these two modules would produce the same MVID despite having different constant values:
Solution
This PR modifies the
hashNonMemberVal
function inTypeHashing.fs
to include literal constant values in the hash computation:hashConst
function with exhaustive pattern matching over allConst
cases to deterministically hash constant valueshashNonMemberVal
to check forVal.LiteralValue
and include the constant value hash when presentval_const
isSome
)Verification
Manual testing confirms the fix works correctly:
Related
Fixes #18758
The implementation uses exhaustive pattern matching over the
Const
discriminated union to ensure all constant types are handled correctly and deterministically.Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
1k9vsblobprodcus379.vsblob.vsassets.io
/home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js
(dns block)dotnet restore ./FSharp.Compiler.Service.sln
(dns block)4vyvsblobprodcus361.vsblob.vsassets.io
dotnet restore ./FSharp.Compiler.Service.sln
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
This pull request was created as a result of the following prompt from Copilot chat.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.