Skip to content

Commit be3fbca

Browse files
committed
Avoid double filter
1 parent 61d6c02 commit be3fbca

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

src/FSharp.Formatting.Common/YaafFSharpScripting.fs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -282,14 +282,18 @@ module internal CompilerServiceExtensions =
282282
|> Seq.filter (fun file ->
283283
let fileName = Path.GetFullPath file |> Path.GetFileName
284284

285-
dllFiles
286-
|> List.exists (fun (dllFile: string) -> Path.GetFileName dllFile =? fileName)
287-
|> not)
288-
|> Seq.filter (fun file ->
289-
if Path.GetFileName file =? "FSharp.Core.dll" then
290-
FSharpAssemblyHelper.tryCheckFsCore file |> Option.isSome
291-
else
292-
true)
285+
let dllNotAlreadyReferenced =
286+
dllFiles
287+
|> List.exists (fun (dllFile: string) -> Path.GetFileName dllFile =? fileName)
288+
|> not
289+
290+
let checkFSharpCore =
291+
if Path.GetFileName file =? "FSharp.Core.dll" then
292+
FSharpAssemblyHelper.tryCheckFsCore file |> Option.isSome
293+
else
294+
true
295+
296+
dllNotAlreadyReferenced && checkFSharpCore)
293297
|> Seq.toList
294298

295299
// See https://github.com/tpetricek/FSharp.Formatting/commit/5d14f45cd7e70c2164a7448ea50a6b9995166489
@@ -350,7 +354,6 @@ type internal FsiEvaluationException
350354
(Log.formatArgs args)
351355
(base.ToString())
352356

353-
354357
/// Exception for invalid expression types
355358
type internal FsiExpressionTypeException =
356359
val private value: obj option

0 commit comments

Comments
 (0)