-
Notifications
You must be signed in to change notification settings - Fork 830
Update error message of parsMultipleAccessibilitiesForGetSet #15424
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
Conversation
|
I don't think that's right. |
|
Please see the comment here #15423 (comment) . The error is only in case of mixing "outer" and "inner" declaration of visibility for a property. |
This comment was marked as duplicate.
This comment was marked as duplicate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nojaf - I believe this is not the correct fix.
type Foo() =
member f.X with internal get (key1, key2) = true and private set (key1, key2) value = ()
member internal f.Y with get (key1, key2) = true and private set (key1, key2) value = ()If you do not specify the visibility of the property F# allows you specify individual visibilities for the getter and setter, as shown in the X property of the repro.
The reason F# needs this behaviour is for C# interop which also allows, distinct visibilities for the getter or setter,
E.g.
public string ShowSomething { set; private get; } = "Some text value";The Y property has an error because if you specify the visibility of the property, then you are not allowed to specify the visibility of the getters and setters.
I think improving the error message would have been better. Something like, "When the visibility for a property is specified, setting the visibility of the set or get method is not allowed."
|
Thanks everyone, I was indeed confused about all of this. |
Head branch was pushed to by a user without write access
Fixes #15423