From 741201bd882208930adc3ac5f6ac7ef76dc9edb9 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Fri, 29 May 2020 11:06:24 +0200 Subject: [PATCH] Use IsNil instead of .Length --- src/fsharp/IlxGen.fs | 2 +- src/fsharp/TypedTreeOps.fs | 4 ++-- src/fsharp/fsi/fsi.fs | 2 +- src/fsharp/service/ServiceAnalysis.fs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/fsharp/IlxGen.fs b/src/fsharp/IlxGen.fs index 16a6094d1fb..c07dc03b8f3 100644 --- a/src/fsharp/IlxGen.fs +++ b/src/fsharp/IlxGen.fs @@ -7645,7 +7645,7 @@ let CodegenAssembly cenv eenv mgbuf fileImpls = // top-level initialization code. let extraBindings = mgbuf.GrabExtraBindingsToGenerate() //printfn "#extraBindings = %d" extraBindings.Length - if extraBindings.Length > 0 then + if not (isNil extraBindings) then let mexpr = TMDefs [ for b in extraBindings -> TMDefLet(b, range0) ] let _emptyTopInstrs, _emptyTopCode = CodeGenMethod cenv mgbuf ([], "unused", eenv, 0, (fun cgbuf eenv -> diff --git a/src/fsharp/TypedTreeOps.fs b/src/fsharp/TypedTreeOps.fs index ea0d42a959f..01158a11f9b 100644 --- a/src/fsharp/TypedTreeOps.fs +++ b/src/fsharp/TypedTreeOps.fs @@ -3887,8 +3887,8 @@ module DebugPrint = and appL g flayout tys args = let z = flayout - let z = if tys.Length > 0 then z ^^ instL typeL tys else z - let z = if args.Length > 0 then z --- spaceListL (List.map (atomL g) args) else z + let z = if isNil tys then z else z ^^ instL typeL tys + let z = if isNil args then z else z --- spaceListL (List.map (atomL g) args) z and implFileL g (TImplFile (_, _, mexpr, _, _, _)) = diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index 84040569579..3520cc7b2fe 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -1479,7 +1479,7 @@ type internal FsiDynamicCompiler for folder in result.Roots do tcConfigB.AddIncludePath(m, folder, "") let scripts = result.SourceFiles |> Seq.toList - if scripts |> Seq.length > 0 then + if not (isNil scripts) then fsiDynamicCompiler.EvalSourceFiles(ctok, istate, m, scripts, lexResourceManager, errorLogger) else istate with _ -> diff --git a/src/fsharp/service/ServiceAnalysis.fs b/src/fsharp/service/ServiceAnalysis.fs index d71ee6a0b83..69d2d774669 100644 --- a/src/fsharp/service/ServiceAnalysis.fs +++ b/src/fsharp/service/ServiceAnalysis.fs @@ -181,7 +181,7 @@ module UnusedOpens = | true, scopes -> openStatement.AppliedScope :: scopes | _ -> [openStatement.AppliedScope] usedModules.[openedModule.Entity] <- scopes - newlyOpenedModules.Length > 0 + not (isNil newlyOpenedModules) /// Incrementally filter out the open statements one by one. Filter those whose contents are referred to somewhere in the symbol uses. /// Async to allow cancellation.