Skip to content

Commit 588ab10

Browse files
mrinaldiKevinRansom
authored andcommitted
Fix FS0052 warnings (#1543)
1 parent bc95eff commit 588ab10

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

src/fsharp/FSharp.Core/local.fs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,12 @@ module internal List =
148148
let mutable ie = dict.GetEnumerator()
149149
if not (ie.MoveNext()) then []
150150
else
151-
let res = freshConsNoTail (keyf ie.Current.Key, ie.Current.Value)
151+
let current = ie.Current
152+
let res = freshConsNoTail (keyf current.Key, current.Value)
152153
let mutable cons = res
153154
while ie.MoveNext() do
154-
let cons2 = freshConsNoTail (keyf ie.Current.Key, ie.Current.Value)
155+
let current = ie.Current
156+
let cons2 = freshConsNoTail (keyf current.Key, current.Value)
155157
setFreshConsTail cons cons2
156158
cons <- cons2
157159
setFreshConsTail cons []

src/fsharp/FSharp.Core/map.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ namespace Microsoft.FSharp.Collections
576576
let rec loop () =
577577
let m1 = e1.MoveNext()
578578
let m2 = e2.MoveNext()
579-
(m1 = m2) && (not m1 || ((e1.Current.Key = e2.Current.Key) && (Unchecked.equals e1.Current.Value e2.Current.Value) && loop()))
579+
(m1 = m2) && (not m1 || let e1c, e2c = e1.Current, e2.Current in ((e1c.Key = e2c.Key) && (Unchecked.equals e1c.Value e2c.Value) && loop()))
580580
loop()
581581
| _ -> false
582582

src/fsharp/FSharp.Core/printf.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ module internal PrintfImpl =
10941094
mi.Invoke(null, args)
10951095

10961096
let buildPlainFinal(args : obj[], argTypes : Type[]) =
1097-
let mi = typeof<Specializations<'S, 'Re, 'Res>>.GetMethod("Final" + (argTypes.Length.ToString()), NonPublicStatics)
1097+
let mi = typeof<Specializations<'S, 'Re, 'Res>>.GetMethod("Final" + (let x = argTypes.Length in x.ToString()), NonPublicStatics)
10981098
#if DEBUG
10991099
verifyMethodInfoWasTaken mi
11001100
#else
@@ -1103,7 +1103,7 @@ module internal PrintfImpl =
11031103
mi.Invoke(null, args)
11041104

11051105
let buildPlainChained(args : obj[], argTypes : Type[]) =
1106-
let mi = typeof<Specializations<'S, 'Re, 'Res>>.GetMethod("Chained" + ((argTypes.Length - 1).ToString()), NonPublicStatics)
1106+
let mi = typeof<Specializations<'S, 'Re, 'Res>>.GetMethod("Chained" + (let x = (argTypes.Length - 1) in x.ToString()), NonPublicStatics)
11071107
#if DEBUG
11081108
verifyMethodInfoWasTaken mi
11091109
#else

src/fsharp/FSharp.Core/reflect.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ module internal Impl =
128128
let args = a.ConstructorArguments
129129
let flags =
130130
match args.Count with
131-
| 1 -> ((args.[0].Value :?> SourceConstructFlags), 0, 0)
132-
| 2 -> ((args.[0].Value :?> SourceConstructFlags), (args.[1].Value :?> int), 0)
133-
| 3 -> ((args.[0].Value :?> SourceConstructFlags), (args.[1].Value :?> int), (args.[2].Value :?> int))
131+
| 1 -> ((let x = args.[0] in x.Value :?> SourceConstructFlags), 0, 0)
132+
| 2 -> ((let x = args.[0] in x.Value :?> SourceConstructFlags), (let x = args.[1] in x.Value :?> int), 0)
133+
| 3 -> ((let x = args.[0] in x.Value :?> SourceConstructFlags), (let x = args.[1] in x.Value :?> int), (let x = args.[2] in x.Value :?> int))
134134
| _ -> (enum 0, 0, 0)
135135
res <- Some flags
136136
res

0 commit comments

Comments
 (0)