Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/fsharp/FSharp.Core/list.fs
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ namespace Microsoft.FSharp.Collections
[<CompiledName("Initialize")>]
let init length initializer = Microsoft.FSharp.Primitives.Basics.List.init length initializer

let rec initConstAcc n x acc =
if n <= 0 then acc else initConstAcc (n-1) x (x :: acc)

[<CompiledName("Replicate")>]
let replicate count initial =
if count < 0 then invalidArg "count" (SR.GetString(SR.inputMustBeNonNegative))
initConstAcc count initial []
let mutable result = []
for i in 0..count-1 do
result <- initial :: result
result

[<CompiledName("Iterate2")>]
let iter2 action list1 list2 =
Expand Down
2 changes: 1 addition & 1 deletion src/fsharp/FSharp.Core/local.fs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ open System.Collections.Generic

module internal List =

let arrayZeroCreate (n:int) = (# "newarr !0" type ('T) n : 'T array #)
let inline arrayZeroCreate (n:int) = (# "newarr !0" type ('T) n : 'T array #)

[<SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")>]
let nonempty x = match x with [] -> false | _ -> true
Expand Down
2 changes: 1 addition & 1 deletion src/fsharp/TypeChecker.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5482,7 +5482,7 @@ and TcPat warnOnUpper cenv env topValInfo vFlags (tpenv, names, takenNames) ty p
| [SynPatErrorSkip(SynPat.Tuple (false, args, _)) | SynPatErrorSkip(SynPat.Paren(SynPatErrorSkip(SynPat.Tuple (false, args, _)), _))] when numArgTys > 1 -> args

// note: we allow both 'C _' and 'C (_)' regardless of number of argument of the pattern
| [SynPatErrorSkip(SynPat.Wild _ as e) | SynPatErrorSkip(SynPat.Paren(SynPatErrorSkip(SynPat.Wild _ as e), _))] -> Array.toList (Array.create numArgTys e)
| [SynPatErrorSkip(SynPat.Wild _ as e) | SynPatErrorSkip(SynPat.Paren(SynPatErrorSkip(SynPat.Wild _ as e), _))] -> List.replicate numArgTys e
| [arg] -> [arg]
| _ when numArgTys = 0 -> error(Error(FSComp.SR.tcUnionCaseDoesNotTakeArguments(), m))
| _ when numArgTys = 1 -> error(Error(FSComp.SR.tcUnionCaseRequiresOneArgument(), m))
Expand Down