Skip to content
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

Fixes #17447 -MethodAccessException on equality comparison of a record with private fields #17467

Merged
merged 2 commits into from
Jul 31, 2024

Conversation

KevinRansom
Copy link
Member

@KevinRansom KevinRansom commented Jul 30, 2024

Fixes: #17447

The generation of Augmented Equals methods, were created with an incorrect visibility. It should have restricted the visibility to match the type that contained the method. Instead it set the visibility to match the scope of the field.
I.e private.

This meant that the compiler generated it:

.method assembly hidebysig instance bool Equals (class Module1/Value obj, class [mscorlib]System.Collections.IEqualityComparer comp) cil managed 

However, because the type is: 'class Module1/Value' it should be marked public

.method public hidebysig  instance bool Equals (class Module1/Value obj, class [mscorlib]System.Collections.IEqualityComparer comp) cil managed 

@KevinRansom KevinRansom requested a review from a team as a code owner July 30, 2024 21:46
Copy link
Contributor

github-actions bot commented Jul 30, 2024

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/9.0.100.md

@psfinaki psfinaki enabled auto-merge (squash) July 31, 2024 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

MethodAccessException on equality comparison of a record with private fields
3 participants