-
Notifications
You must be signed in to change notification settings - Fork 783
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
Allow access modifiers to auto properties getters and setters #16687
Allow access modifiers to auto properties getters and setters #16687
Conversation
❗ Release notes required
|
Where should I add tests to? |
They should go to ComponentTests probably. |
I think this would be a good place https://github.com/dotnet/fsharp/tree/main/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MemberDefinitions |
Should this also be allowed for abstract properties? Such as: type IA =
abstract B: int with get, internal set |
It seems that abstract members doesn't allow access modifiers |
By the way, access modifiers before getter and setter will be ignored and produce a warning in signature files |
will anyone make reviews on this pr? |
Yes, we will shortly, we're a bit short-handed now, a bunch of folks are off. |
Would this mean that a type A() =
member val private X = 0 with public get, private set
let a = A()
a.X // ? If that is the case we should add a compiler error saying that there are conflicting access modifiers. |
Head branch was pushed to by a user without write access
type A() =
// Error: When the visibility for a property is specified, setting the visibility of the set or get method is not allowed.
member val private X = 0 with public get, private set
// Ok
member val X = 0 with public get, private set
// Ok
member val private X = 0 with get, set
type A =
new: unit -> A
member public D: int with get
member private D: int with set |
I found that in ILSpy, internal int A
{
[CompilerGenerated]
[DebuggerNonUserCode]
get
{
return A@;
}
[CompilerGenerated]
[DebuggerNonUserCode]
set
{
A@ = value;
}
} |
Yes, current compiler always emits everything (private and internal) as internal. |
@vzarytovskii Still has a test failed.
|
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
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.
Good stuff as always, thanks!
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.
Good stuff, great testing. Sorry for nitpicking
...cGrammarElements/MemberDefinitions/MethodsAndProperties/AutoPropsWithModifierBeforeGetSet.fs
Outdated
Show resolved
Hide resolved
Head branch was pushed to by a user without write access
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
/azp run |
Caution Repository is on lockdown for maintenance, all merges are on hold. |
Why? Would it be possible to support signatures too?
Can we fix this and allow the same syntax, please? @vzarytovskii I think we should not release the feature without a proper signature support. |
…dotnet#16687)" This reverts commit c4f7bed.
That might so much thing to change... It also relates to the generation of signature files. |
Revert "Allow access modifiers to auto properties getters and setters (#16687)"
Description
Implements this suggestion
Checklist
RFC added
Put it under preview flag
Test cases added
Performance benchmarks added in case of performance changes
Release notes entry updated: