Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

Commit aa08162

Browse files
forkinosami
authored andcommitted
Use IsNil instead of .Length (dotnet#9337)
1 parent 22cbe13 commit aa08162

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/fsharp/IlxGen.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7645,7 +7645,7 @@ let CodegenAssembly cenv eenv mgbuf fileImpls =
76457645
// top-level initialization code.
76467646
let extraBindings = mgbuf.GrabExtraBindingsToGenerate()
76477647
//printfn "#extraBindings = %d" extraBindings.Length
7648-
if extraBindings.Length > 0 then
7648+
if not (isNil extraBindings) then
76497649
let mexpr = TMDefs [ for b in extraBindings -> TMDefLet(b, range0) ]
76507650
let _emptyTopInstrs, _emptyTopCode =
76517651
CodeGenMethod cenv mgbuf ([], "unused", eenv, 0, (fun cgbuf eenv ->

src/fsharp/TypedTreeOps.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3887,8 +3887,8 @@ module DebugPrint =
38873887

38883888
and appL g flayout tys args =
38893889
let z = flayout
3890-
let z = if tys.Length > 0 then z ^^ instL typeL tys else z
3891-
let z = if args.Length > 0 then z --- spaceListL (List.map (atomL g) args) else z
3890+
let z = if isNil tys then z else z ^^ instL typeL tys
3891+
let z = if isNil args then z else z --- spaceListL (List.map (atomL g) args)
38923892
z
38933893

38943894
and implFileL g (TImplFile (_, _, mexpr, _, _, _)) =

src/fsharp/fsi/fsi.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1479,7 +1479,7 @@ type internal FsiDynamicCompiler
14791479
for folder in result.Roots do
14801480
tcConfigB.AddIncludePath(m, folder, "")
14811481
let scripts = result.SourceFiles |> Seq.toList
1482-
if scripts |> Seq.length > 0 then
1482+
if not (isNil scripts) then
14831483
fsiDynamicCompiler.EvalSourceFiles(ctok, istate, m, scripts, lexResourceManager, errorLogger)
14841484
else istate
14851485
with _ ->

src/fsharp/service/ServiceAnalysis.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ module UnusedOpens =
181181
| true, scopes -> openStatement.AppliedScope :: scopes
182182
| _ -> [openStatement.AppliedScope]
183183
usedModules.[openedModule.Entity] <- scopes
184-
newlyOpenedModules.Length > 0
184+
not (isNil newlyOpenedModules)
185185

186186
/// Incrementally filter out the open statements one by one. Filter those whose contents are referred to somewhere in the symbol uses.
187187
/// Async to allow cancellation.

0 commit comments

Comments
 (0)