-
Notifications
You must be signed in to change notification settings - Fork 826
WIP: with-
keyword support for anonymous records
#11911
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. | ||
|
||
namespace FSharp.Compiler.ComponentTests.Language | ||
|
||
open Xunit | ||
open FSharp.Test.Compiler | ||
|
||
module ``Anonymous records tests`` = | ||
|
||
[<Fact>] | ||
let ``Simple with- should remove one field`` () = | ||
Fsx """ | ||
type A = { X: int; Y: int } | ||
let a = { X = 1; Y = 2 } | ||
let b = {| a with- Y |} | ||
""" | ||
|> compile | ||
|> shouldSucceed | ||
|
||
[<Fact>] | ||
let ``with- shouldn't remove the only field`` () = | ||
Fsx """ | ||
type A = { X: int } | ||
let a = { X = 1 } | ||
let b = {| a with- X |} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would be quite a use case for #6941 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would expect a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The flow of fields should allow an empty state where more fields can be added later. |
||
""" | ||
|> compile | ||
|> shouldSucceed |
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.
Could we have the range of the
with-
keyword in the tree as well?This would be useful for Fantomas if the code has a comment after the
with-
for example.