Skip to content

MethodAccessException on equality comparison of a type private to module #17541

Closed

Description

@iminashi

Something that has worked previously now fails with a MethodAccessException when using SDK 9.0.100.

Repro steps

Calling a public function that does an equality comparison on a type that is private to the module.

module Module =
    type private DU = ABC | YYZ

    let publicFunction () : bool =
        ABC = YYZ

Module.publicFunction () |> printfn "%b"

Expected behavior

false is printed.

Actual behavior

Unhandled exception. System.MethodAccessException: Attempt by method 'Program+Module.publicFunction()' to access method 'Program+Module+DU.Equals(DU, System.Collections.IEqualityComparer)' failed.

Related information

  • 9.0.100-preview.7.24407.12

Activity

  1. added this to the Backlog milestone on Aug 15, 2024
  2. vzarytovskii commented on Aug 15, 2024

    @vzarytovskii
    Member

    Duplicate of #17447, likely

  3. iminashi commented on Aug 15, 2024

    @iminashi
    Author

    I ran into this when testing if #17447 was fixed in 9.0.100 (it is).

  4. iminashi commented on Aug 15, 2024

    @iminashi
    Author

    The example above works in 8.0.400, but fails in 9.0.100.

    The example in #17447 fails in 8.0.400, but works in 9.0.100.

  5. T-Gro commented on Aug 15, 2024

    @T-Gro
    Member

    Still repro's in main -> issue has to be fixed.

  6. self-assigned this
    on Aug 15, 2024
  7. KevinRansom commented on Aug 15, 2024

    @KevinRansom
    Contributor

    @iminashi - Thank you for raising this issue, it forced me to properly think about the codegen that needs to happen for Equality(typed, IComparable) which is wierdly enough different from all of the other Augmented Equals and Compare methods.

  8. linked a pull request that will close this issuefixes #17541 - Equals visibility for DU's #17548on Aug 19, 2024
  9. added a commit that references this issue on Sep 24, 2024
    d01da33
  10. added a commit that references this issue on Oct 7, 2024
    c4850d6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions