fsharp icon indicating copy to clipboard operation
fsharp copied to clipboard

Allow access modifiers to auto properties getters and setters

Open ijklam opened this issue 1 year ago • 12 comments

Description

Fixes #16854

Checklist

  • [x] Test cases added
  • [x] sig file support
  • [x] new syntax in fsi printing 图片
  • [x] new syntax in quickinfo 图片
  • [x] new syntax in sig file generation
module Program

type A() =
    member val internal B: int = 0 with get, set
    member val D: int = 0 with internal get, private set
    member internal _.F with get() = 1 and set (v: int) = ()
    member internal _.G with get(x: int) = 1 and set (x: int) (v: int) = ()

// above generates
module Program

type A =
    
    new: unit -> A
    
    member B: int with internal get, internal set
    
    member D: int with internal get, private set
    
    member F: int with internal get, internal set
    
    member G: x: int -> int with internal get, internal set
  • [ ] Performance benchmarks added in case of performance changes
  • [x] Release notes entry updated:

ijklam avatar Mar 12 '24 07:03 ijklam

:heavy_exclamation_mark: Release notes required


:white_check_mark: Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/9.0.100.md
LanguageFeatures.fsi docs/release-notes/.Language/preview.md

github-actions[bot] avatar Mar 12 '24 07:03 github-actions[bot]

Could you add a test to https://github.com/dotnet/fsharp/blob/711de175bf0c7ddfda4005c3334606b90bb11146/tests/FSharp.Compiler.ComponentTests/Signatures/SigGenerationRoundTripTests.fs, please?

That will ensure the generated signature is valid for the implementation.

nojaf avatar Mar 13 '24 09:03 nojaf

protected also displayed in tooltip

图片

ijklam avatar Mar 14 '24 11:03 ijklam

Could you add a test to https://github.com/dotnet/fsharp/blob/711de175bf0c7ddfda4005c3334606b90bb11146/tests/FSharp.Compiler.ComponentTests/Signatures/SigGenerationRoundTripTests.fs, please?你能 https://github.com/dotnet/fsharp/blob/711de175bf0c7ddfda4005c3334606b90bb11146/tests/FSharp.Compiler.ComponentTests/Signatures/SigGenerationRoundTripTests.fs 添加一个测试吗?

That will ensure the generated signature is valid for the implementation.这将确保生成的签名对实现有效。

added

ijklam avatar Apr 07 '24 14:04 ijklam

I make the new signature generation way under the preview flag. Then some tests with signature hardcoded into error msg are OK with net8.0 (current version) but not OK under preview.

ijklam avatar Apr 07 '24 14:04 ijklam

add a new error to disallow access modifiers in an SRTP constraint

图片

and will raise a warning in <= 8.0

图片

ijklam avatar Apr 29 '24 13:04 ijklam

@Tangent-90 , will you have time to fix the conflict here? It's pretty simple, but probably best to do it locally and have the .xlf files be generated again (instead of doing it manually)

abonie avatar May 06 '24 17:05 abonie

@Tangent-90 , will you have time to fix the conflict here? It's pretty simple, but probably best to do it locally and have the .xlf files be generated again (instead of doing it manually)

Maybe two days later

ijklam avatar May 06 '24 22:05 ijklam

Hey @Tangent-90, awesome work! For posterity, can you link the RFC and the original discussion in the top (i.e., in your original description)? It's kinda hidden behind several other issues now.

For your convenience, just copy/paste:

* [Original suggestion](https://github.com/fsharp/fslang-suggestions/issues/430)
* [RFC](https://github.com/fsharp/fslang-design/pull/764)
* [Previous merged work](https://github.com/dotnet/fsharp/pull/16687)

(you may also delete the Release notes comments in the OP, these are just from the PR template and add clutter ;)

abelbraaksma avatar May 17 '24 14:05 abelbraaksma

Hey @Tangent-90, awesome work! For posterity, can you link the RFC and the original discussion in the top (i.e., in your original description)? It's kinda hidden behind several other issues now.

For your convenience, just copy/paste:

* [Original suggestion](https://github.com/fsharp/fslang-suggestions/issues/430)
* [RFC](https://github.com/fsharp/fslang-design/pull/764)
* [Previous merged work](https://github.com/dotnet/fsharp/pull/16687)

(you may also delete the Release notes comments in the OP, these are just from the PR template and add clutter ;)

Updated. Thanks. ❤❤❤

ijklam avatar May 20 '24 14:05 ijklam

Please don’t forget about this PR.

edgarfgp avatar Jun 26 '24 15:06 edgarfgp

I might've broken it with merge. Reassigned some warnings numbers for PR which went in earlier. Will fix it later.

vzarytovskii avatar Jun 26 '24 16:06 vzarytovskii

I might've broken it with merge. Reassigned some warnings numbers for PR which went in earlier. Will fix it later.

Thanks for taking the time. I know you are busy.

edgarfgp avatar Jul 01 '24 16:07 edgarfgp

/azp run

vzarytovskii avatar Jul 17 '24 11:07 vzarytovskii

Azure Pipelines successfully started running 2 pipeline(s).

azure-pipelines[bot] avatar Jul 17 '24 11:07 azure-pipelines[bot]

This seems to be ready, apart from conflicts. Would be good to have this in please 🙏

edgarfgp avatar Aug 07 '24 18:08 edgarfgp

@Tangent-90 will you have time to get to this or maybe you have fresh thoughts? If no - which is understood since we didn't get to this in a timely manner - I can probably fix the conflicts and give it a proper review next week.

psfinaki avatar Aug 09 '24 13:08 psfinaki

@Tangent-90 will you have time to get to this or maybe you have fresh thoughts? If no - which is understood since we didn't get to this in a timely manner - I can probably fix the conflicts and give it a proper review next week.

Sorry for the lately response, I may try to fix it in this weekend.

ijklam avatar Aug 10 '24 13:08 ijklam