-
Notifications
You must be signed in to change notification settings - Fork 830
Allow static let bindings in union, record, struct, non-incremental-class types #15343
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
Conversation
Co-authored-by: T-Gro <[email protected]>
|
@T-Gro Would it make sense to add some tests for lowercase DUs? https://github.com/fsharp/fslang-design/blob/main/FSharp-7.0/FS-1126-allow-lower-case-du-cases%20when-require-qualified-access-is%20specified.md [<RequireQualifiedAccess>]
type DU =
| an of int
| B of string
| C
| ``D`` of bool
| ``d`` |
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.
We need to (manually) test the following scenario:
- Build the library with compiler from this branch
- Load it in project with older compiler, which does not have this feature.
- See that we generate IL + pickled info, which is loadable and accessible by earlier compilers.
…ckle state (establish a new precedenc for that)
|
I added a change that will make Fsharp.Core compilation fail if a feature requiring new pickling codes is used. We have discussed this with @dsyme and @vzarytovskii and Fsharp.Core is the only library where we want to support compilation on older tooling - it will fail if new constructs are used in it. Otherwise, it should not be a reason to stop language evolution as library authors can suggest to update tooling. Methodology: I have updated Fsharp.Core to use preview version of the language. I ran the The build has failed with the following two errors when pickling FSharp.Core:
(error reported once for NS2.0, and once for NS2.1) I am now keeping the check itself in the code, and rolling back the changes for making Fsharp.Core fail for demonstrative reasons. Thanks for spotting this, kindly asking for reviewing the new bits. |
|
What about a test in EmittedIL to verify what initialization takes place under the hood? |
Will add, one single file and one multi file (compilation strategy differs) |
|
This is ready now |
This revives #14132 and implements fsharp/fslang-suggestions#1182 .
TODOs:
Order of let static init - tests
Active pattern - tests
DU cases within 'static let' without the type/module being recursive - tests
Plain enum behavior - tests
Hide this behind language feature, and keep producing an error for non-preview versions
Make this fail at typecheck time for plain enums (type E = | A = 0 | B = 1 ). As of now it fails at IL generation first.
Check behavior in recursive situations with circular dependencies between static members depending on static lets
Check behavior in generic types keeping per-TyparInstantion data in a static let binding
Fix regression for losing ' FS0912: This declaration element is not permitted in an augmentation '
Disallow 'static let' for extrinsic augmentations (to types in other assemblies)
Regression - "type Bad4 = member val X = 1 + 1" leads to internal error after a diagnostic is reported .
Regression - nonstatic extensions to records must remain an error (a "val" added, abstract member added)
Multi-file test , static init in not-last file (IlxGen has special behavior for last files)
Multi-file test, static init cascade trough multiple modules