You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Multiple accessibilities given for property getter or setter is not raised for property #15423
Get and set properties cannot have different visibility for the getter and setter
Repro steps
Example:
typeFoo()=memberf.Xwithinternal get (key1, key2)=trueandprivateset(key1,key2)value =()memberinternalf.Ywith get (key1,key2)=trueandprivateset(key1,key2)value =()
Expected behavior
Both X and Y show the same diagnostic (FS0558)
Actual behavior
f.X won't produce any diagnostics and will create an internal getter and setter.
A property declaration may also be split into two, so the getter and the setter would be analysed separately.
And then comes the fact that F# allows overloading properties, so we won't even know if two accessor declarations will belong to the same property until after type checking is done.
Activity
T-Gro commentedon Jun 16, 2023
The error works a little diffently.
You can have visiblity:
When you mix outer and inner, you get the error you screenshoted
If you omit outer and use two inner ones, they can be as they wish.
This also gets reflected in the IL (just follows the standard the privates in F# become internals in IL, but that's it)
https://sharplab.io/#v2:DYLgZgzgNALiCWwA+BtAPAOQPYFECOArgIbDwwCeAfALoCwAUOtgMJYC2ADkQE7wRYA7GgwocApgAIAYliwAKAJQSAvAwnqJbMWwBGY7hLAA6ABoS1GywHcyAC3P1LTjRwI7SAYwkBzMTAly/FoAaiRKyhIw3ASSFs5EAgAmEhy8AG5EMJIQfgFBYqHAShnAMSoBCkA=
auduchinok commentedon Jun 16, 2023
A property declaration may also be split into two, so the getter and the setter would be analysed separately.
And then comes the fact that F# allows overloading properties, so we won't even know if two accessor declarations will belong to the same property until after type checking is done.
0101 commentedon Jun 19, 2023
Get and set properties can have different visibility for the getter and setter. But the error message is confusing and should be fixed.
T-Gro commentedon Jun 19, 2023
Will be resolved by updating the error message in #15424