-
Notifications
You must be signed in to change notification settings - Fork 843
RFC FS 1126 Allow lower-case DU cases when RequireQualifiedAccess is specified #13432
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
RFC FS 1126 Allow lower-case DU cases when RequireQualifiedAccess is specified #13432
Conversation
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 still need these parts of CheckUnionCaseName because the compiled form must generate a type and enum case for these - better to pass in hasRequireQualifiedAccessAttribute to that routine?
if name = "Tags" then
errorR(Error(FSComp.SR.tcUnionCaseNameConflictsWithGeneratedType(name, "Tags"), id.idRange))
CheckNamespaceModuleOrTypeName g idThere 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.
Updated based on your suggestion.
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.
Please add a test case with a dodgy lower case name that is not a valid type name for .NET, e.g.
type DU =
| ``not.allowed``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.
Added more testing. Thanks for pointing this out .
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.
@vzarytovskii I was wondering if should put this behind a preview flag ?
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.
Yeah, let's put it under preview version.
|
@dsyme this is ready for another review . Added more testing and put the feature under the preview. |
| // #Conformance #TypesAndModules #Unions | ||
| // This testcase verifies that lower-case discriminated union are not allowed | ||
| //<Expects status="error"></Expects> |
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.
Just a note: those are actually not required for newly written tests, they are there for the tests which were auto-migrated from the old framework.
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.
Cool I will remove them :)
|
@edgarfgp thank you a lot for this addition! Sorry it took long to merge it. |
|
@vzarytovskii No worries . I already looking for the next contribution to help the compiler 😀 |
* ValRepInfoForDisplay added for improved quick info for functions defined in expressions * Update * Update QuickInfoTests.fs * Update QuickInfoTests.fs * Update * add identifier analysis script (#13486) * add identifier analysis script * add identifier analysis script * Update fantomas alpha 11 (#13481) * Allow lower-case DU cases when RequireQualifiedAccess is specified (#13432) * Allow lower-case DU cases when RequireQualifiedAccess is specified * Fix PR suggestions and Add more testing * Protect feature under preview version * Add a NotUpperCaseConstructorWithoutRQA warning to be raised in lang version preview * Fix formatting * regularize some names (#13489) * normalize some names * format code * fix build * Subtraction of two chars, new conversions, and fixes for dynamic operator invocations and QuotationToExpression (#11681) Co-authored-by: Vlad Zarytovskii <[email protected]> Co-authored-by: Don Syme <[email protected]> * Mark backing fields as CompilerGenerated (fixes serialization of fields in FSI multiemit) (#13494) Co-authored-by: Don Syme <[email protected]> Co-authored-by: Peter Semkin <[email protected]> Co-authored-by: Don Syme <[email protected]> Co-authored-by: Florian Verdonck <[email protected]> Co-authored-by: Petr Semkin <[email protected]> Co-authored-by: Edgar Gonzalez <[email protected]> Co-authored-by: Hadrian Tang <[email protected]> Co-authored-by: Vlad Zarytovskii <[email protected]> Co-authored-by: Kevin Ransom (msft) <[email protected]>
Implementation for Allow lower-case DU cases when RequireQualifiedAccess is specified fsharp/fslang-suggestions#131
RFC: 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