Skip to content

Commit c6a5f50

Browse files
abelbraaksmabaronfel
authored andcommitted
Move String.length to the top of its module so that the length function is in scope (#9481)
1 parent e3e5617 commit c6a5f50

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/fsharp/FSharp.Core/string.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ namespace Microsoft.FSharp.Core
1212
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
1313
[<RequireQualifiedAccess>]
1414
module String =
15+
[<CompiledName("Length")>]
16+
let length (str:string) = if isNull str then 0 else str.Length
17+
1518
[<CompiledName("Concat")>]
1619
let concat sep (strings : seq<string>) =
1720
String.Join(sep, strings)
@@ -101,6 +104,3 @@ namespace Microsoft.FSharp.Core
101104
else
102105
let rec check i = (i < str.Length) && (predicate str.[i] || check (i+1))
103106
check 0
104-
105-
[<CompiledName("Length")>]
106-
let length (str:string) = if isNull str then 0 else str.Length

0 commit comments

Comments
 (0)