Skip to content

Commit 2d592d3

Browse files
Copilot7sharp9
andcommitted
Update Fantomas.Core to 7.0.5 and add F# 8 dot lambda syntax test
Co-authored-by: 7sharp9 <588746+7sharp9@users.noreply.github.com>
1 parent c308338 commit 2d592d3

File tree

4 files changed

+102
-56
lines changed

4 files changed

+102
-56
lines changed

paket.lock

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
STORAGE: NONE
2-
RESTRICTION: == net9.0
3-
NUGET
4-
remote: https://api.nuget.org/v3/index.json
5-
Aether (8.3.1)
6-
FSharp.Core (>= 4.3.4)
7-
Argu (6.2.5)
8-
FSharp.Core (>= 6.0)
9-
System.Configuration.ConfigurationManager (>= 4.4)
10-
Expecto (10.2.1)
11-
FSharp.Core (>= 7.0.200)
12-
Mono.Cecil (>= 0.11.4 < 1.0)
13-
Fantomas.Core (7.0)
14-
Fantomas.FCS (>= 7.0)
15-
FSharp.Core (>= 8.0.100)
16-
System.Collections.Immutable (>= 8.0)
17-
System.Diagnostics.DiagnosticSource (>= 8.0.1)
18-
System.Memory (>= 4.6)
19-
System.Runtime (>= 4.3.1)
20-
Fantomas.FCS (7.0)
21-
FSharp.Core (>= 8.0.100)
22-
System.Collections.Immutable (>= 8.0)
23-
System.Diagnostics.DiagnosticSource (>= 8.0.1)
24-
System.Memory (>= 4.6)
25-
System.Runtime (>= 4.3.1)
26-
FSharp.Compiler.Service (43.9.101)
27-
FSharp.Core (9.0.101)
28-
System.Buffers (>= 4.5.1)
29-
System.Collections.Immutable (>= 8.0)
30-
System.Diagnostics.DiagnosticSource (>= 8.0)
31-
System.Memory (>= 4.5.5)
32-
System.Reflection.Emit (>= 4.7)
33-
System.Reflection.Metadata (>= 8.0)
34-
System.Runtime.CompilerServices.Unsafe (>= 6.0)
35-
FSharp.Core (9.0.101)
36-
McMaster.NETCore.Plugins (2.0)
37-
Microsoft.NETCore.Platforms (7.0.4)
38-
Microsoft.NETCore.Targets (5.0)
39-
Mono.Cecil (0.11.6)
40-
System.Buffers (4.6)
41-
System.Collections.Immutable (9.0.1)
42-
System.Configuration.ConfigurationManager (9.0.1)
43-
System.Diagnostics.EventLog (>= 9.0.1)
44-
System.Security.Cryptography.ProtectedData (>= 9.0.1)
45-
System.Diagnostics.DiagnosticSource (9.0.1)
46-
System.Diagnostics.EventLog (9.0.1)
47-
System.Memory (4.6)
48-
System.Reflection.Emit (4.7)
49-
System.Reflection.Metadata (9.0.1)
50-
System.Runtime (4.3.1)
51-
Microsoft.NETCore.Platforms (>= 1.1.1)
52-
Microsoft.NETCore.Targets (>= 1.1.3)
53-
System.Runtime.CompilerServices.Unsafe (6.1)
54-
System.Security.Cryptography.ProtectedData (9.0.1)
55-
Tomlyn (0.18)
1+
STORAGE: NONE
2+
RESTRICTION: == net9.0
3+
NUGET
4+
remote: https://api.nuget.org/v3/index.json
5+
Aether (8.3.1)
6+
FSharp.Core (>= 4.3.4)
7+
Argu (6.2.5)
8+
FSharp.Core (>= 6.0)
9+
System.Configuration.ConfigurationManager (>= 4.4)
10+
Expecto (10.2.1)
11+
FSharp.Core (>= 7.0.200)
12+
Mono.Cecil (>= 0.11.4 < 1.0)
13+
Fantomas.Core (7.0.5)
14+
Fantomas.FCS (>= 7.0.5)
15+
FSharp.Core (>= 8.0.100)
16+
System.Collections.Immutable (>= 8.0)
17+
System.Diagnostics.DiagnosticSource (>= 8.0.1)
18+
System.Memory (>= 4.6)
19+
System.Runtime (>= 4.3.1)
20+
Fantomas.FCS (7.0.5)
21+
FSharp.Core (>= 8.0.100)
22+
System.Collections.Immutable (>= 8.0)
23+
System.Diagnostics.DiagnosticSource (>= 8.0.1)
24+
System.Memory (>= 4.6)
25+
System.Runtime (>= 4.3.1)
26+
FSharp.Compiler.Service (43.9.101)
27+
FSharp.Core (9.0.101)
28+
System.Buffers (>= 4.5.1)
29+
System.Collections.Immutable (>= 8.0)
30+
System.Diagnostics.DiagnosticSource (>= 8.0)
31+
System.Memory (>= 4.5.5)
32+
System.Reflection.Emit (>= 4.7)
33+
System.Reflection.Metadata (>= 8.0)
34+
System.Runtime.CompilerServices.Unsafe (>= 6.0)
35+
FSharp.Core (9.0.101)
36+
McMaster.NETCore.Plugins (2.0)
37+
Microsoft.NETCore.Platforms (7.0.4)
38+
Microsoft.NETCore.Targets (5.0)
39+
Mono.Cecil (0.11.6)
40+
System.Buffers (4.6)
41+
System.Collections.Immutable (9.0.1)
42+
System.Configuration.ConfigurationManager (9.0.1)
43+
System.Diagnostics.EventLog (>= 9.0.1)
44+
System.Security.Cryptography.ProtectedData (>= 9.0.1)
45+
System.Diagnostics.DiagnosticSource (9.0.1)
46+
System.Diagnostics.EventLog (9.0.1)
47+
System.Memory (4.6)
48+
System.Reflection.Emit (4.7)
49+
System.Reflection.Metadata (9.0.1)
50+
System.Runtime (4.3.1)
51+
Microsoft.NETCore.Platforms (>= 1.1.1)
52+
Microsoft.NETCore.Targets (>= 1.1.3)
53+
System.Runtime.CompilerServices.Unsafe (6.1)
54+
System.Security.Cryptography.ProtectedData (9.0.1)
55+
Tomlyn (0.18)

test/Myriad.IntegrationPluginTests/FieldsLensDus.fs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,18 @@ module AetherPersonLenses =
105105
(fun (value: AetherAddress) (x: AetherPerson) -> { x with Address = value })
106106
namespace rec TestLens
107107

108+
module RecordWithDotLambdaMemberLenses =
109+
open Input
110+
111+
let count =
112+
(fun (x: RecordWithDotLambdaMember) -> x.count),
113+
(fun (x: RecordWithDotLambdaMember) (value: int) -> { x with count = value })
114+
115+
let value =
116+
(fun (x: RecordWithDotLambdaMember) -> x.value),
117+
(fun (x: RecordWithDotLambdaMember) (value: string) -> { x with value = value })
118+
namespace rec TestLens
119+
108120
module SingleCaseDULenses =
109121
open Input
110122

test/Myriad.IntegrationPluginTests/Input.fs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,12 @@ type AetherAddress = {
7575
type AetherPerson = {
7676
Name : string
7777
Address : AetherAddress
78-
}
78+
}
79+
80+
// Type that uses F# 8 _.property shorthand syntax in a member
81+
[<Generator.Lenses("lens")>]
82+
type RecordWithDotLambdaMember = {
83+
count: int
84+
value: string
85+
} with
86+
member self.upperValues = [ self.value ] |> List.map _.ToUpper()

test/Myriad.IntegrationPluginTests/Tests.fs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,5 +148,31 @@ let tests =
148148
let value = Aether.Optic.get AetherTestLens.AetherPersonLenses.Address updated
149149
Expect.equal value { Street = "Baker st."; HouseNumber = 222 } "Sets the address lens via Aether"
150150
}
151+
152+
testList "F# 8 dot lambda syntax" [
153+
let r = { RecordWithDotLambdaMember.count = 42; value = "hello" }
154+
155+
test "Getter works for record with dot lambda member" {
156+
let getter = fst TestLens.RecordWithDotLambdaMemberLenses.count
157+
Expect.equal 42 (getter r) "getter returns the count value"
158+
}
159+
160+
test "Setter works for record with dot lambda member" {
161+
let setter = snd TestLens.RecordWithDotLambdaMemberLenses.count
162+
let updated = setter r 99
163+
Expect.equal 99 updated.count "setter updates the count value"
164+
}
165+
166+
test "String field getter works for record with dot lambda member" {
167+
let getter = fst TestLens.RecordWithDotLambdaMemberLenses.value
168+
Expect.equal "hello" (getter r) "getter returns the string value"
169+
}
170+
171+
test "String field setter works for record with dot lambda member" {
172+
let setter = snd TestLens.RecordWithDotLambdaMemberLenses.value
173+
let updated = setter r "world"
174+
Expect.equal "world" updated.value "setter updates the string value"
175+
}
176+
]
151177
]
152178
]

0 commit comments

Comments
 (0)