Uh oh!
There was an error while loading. Please reload this page.
Update error message of parsMultipleAccessibilitiesForGetSet - #15424
Conversation
vzarytovskii
commented
Jun 16, 2023
I don't think that's right. |
T-Gro
commented
Jun 16, 2023
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.
This comment was marked as duplicate.
This comment was marked as duplicate.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
@nojaf - I believe this is not the correct fix.
typeFoo()=memberf.Xwithinternal get (key1, key2)=trueandprivateset(key1,key2)value =()memberinternalf.Ywith get (key1,key2)=trueandprivateset(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.
publicstringShowSomething{set;privateget;}="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."
nojaf
commented
Jun 19, 2023
Thanks everyone, I was indeed confused about all of this. |
Head branch was pushed to by a user without write access
Fixes#15423