Uh oh!
There was an error while loading. Please reload this page.
[WIP] RFC-TBD Ease restrictions on static members and let in union and records - #14132
[WIP] RFC-TBD Ease restrictions on static members and let in union and records#14132dsyme wants to merge 9 commits into
Conversation
edgarfgp
commented
Nov 24, 2022
@vzarytovskii will be this inserted in VS and sdk for 17.5 ? |
T-Gro
commented
Mar 23, 2023
Hi @dsyme , would you mind if I attempt to revive this, learn something new and continue where you ended + cover it with tests? Or are you planning to continue yourself? |
dsyme
commented
Mar 24, 2023
@T-Gro Please do! I'll review and leave further notes |
dsyme
commented
Mar 24, 2023
I think my only concerns were about initialization for union types, but I'll take a look and write notes for testing too |
T-Gro
commented
Jun 8, 2023
/run fantomas |
Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
Ran fantomas: https://github.com/dotnet/fsharp/actions/runs/5210064817 |
T-Gro
commented
Jun 13, 2023
@dsyme I revived the branch and continued here. |
dsyme
commented
Jun 14, 2023
@T-Gro This is great!
The slight concern is that for union types we emit Context:
I think covering a range of common cases of static init will be enough. Check particularly the singleton cases, e.g. Here accessing T.X from another file should obv trigger. I guess the important thing here is that initialization of the file content needs to access initialization of the static content of T (but not vice-versa) With variations
On a quick glance I think I've seen these in the tests and it all looks ok tbh |
Thanks @dsyme for the insight. I know do remember that from the IlxGen file-level init code, and is actually something I have missed in the tests - I should have at least some scenario for multi-file test cases, of static init not being in the final file. (because IlxGen has different logic for the very last file) (i.e. an action in main triggering static init of another file later, not immediately) ==> I will add those ( I will reuse some of the existing test code I already wrote, but just call it from another file added to the compilation) |
T-Gro
commented
Jun 20, 2023
I have now covered the multi-file scenario as well: It does work as expected:
|
vzarytovskii
commented
Jul 21, 2023
@T-Gro feel free to close if everything is covered in your PR. |
This is the beginning of fsharp/fslang-suggestions#1182
Basically, allow static members and let in a wider range of type definitions