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

Error FS1113 when creating a class with a class scope self-identifier and an inline member #17899

Open
AvnonIdo opened this issue Oct 19, 2024 · 0 comments
Labels
Area-Compiler-Checking Type checking, attributes and all aspects of logic checking Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone

Comments

@AvnonIdo
Copy link

Repro steps
The following code can easily reproduce the error:

type TestClass() as SomeSelfIdentifier =
    member inline AnotherSelfIdentifier.test() = 5

It also happens when the self-identifier is the same:

type TestClass() as self =
    member inline self.test() = 5

And even when using '_' for the member-scope self-identifier:

type TestClass() as self =
    member inline _.test() = 5

Expected behavior

Successful build

Actual behavior

The build fails with the following error: "Error FS1113 : The value 'test' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible"

Known workarounds

Either make the inline function external and receive the instance as an argument or rework every 'let' that needs the class-scope self-identifier to be a member that uses a function-scoped self-identifier instead.

Related information

I needed an inline function for a member constraint in my real use case. It worked perfectly until I added the self-identifier for use in some other function.

  • Operating system
    Windows 10
  • .NET Runtime kind (.NET Core, .NET Framework, Mono)
    .NET 8.0
  • Editing Tools (e.g. Visual Studio Version, Visual Studio)
    Rider
@github-actions github-actions bot added this to the Backlog milestone Oct 19, 2024
@abonie abonie added Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code. Area-Compiler-Checking Type checking, attributes and all aspects of logic checking and removed Needs-Triage Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. labels Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compiler-Checking Type checking, attributes and all aspects of logic checking Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.
Projects
Status: New
Development

No branches or pull requests

2 participants