diff --git a/src/Fable.AST/Fable.fs b/src/Fable.AST/Fable.fs index 8e2d9b2b56..9a6647954c 100644 --- a/src/Fable.AST/Fable.fs +++ b/src/Fable.AST/Fable.fs @@ -537,7 +537,7 @@ type ValueKind = | NewList of headAndTail: (Expr * Expr) option * typ: Type | NewTuple of values: Expr list * isStruct: bool | NewRecord of values: Expr list * ref: EntityRef * genArgs: Type list - | NewAnonymousRecord of values: Expr list * fieldNames: string[] * genArgs: Type list * isStruct: bool + | NewAnonymousRecord of values: Expr list * fieldNames: string array * genArgs: Type list * isStruct: bool | NewUnion of values: Expr list * tag: int * ref: EntityRef * genArgs: Type list member this.Type = diff --git a/src/Fable.Compiler/Globbing.fs b/src/Fable.Compiler/Globbing.fs index e311fdfca9..fa56a040e2 100644 --- a/src/Fable.Compiler/Globbing.fs +++ b/src/Fable.Compiler/Globbing.fs @@ -237,7 +237,7 @@ module Glob = let path = normalizePath path let regex = - let outRegex: ref = ref null + let outRegex: Regex ref = ref null if globRegexCache.TryGetValue(pattern, outRegex) then outRegex.Value diff --git a/src/Fable.Compiler/ProjectCracker.fs b/src/Fable.Compiler/ProjectCracker.fs index 42c14ad79e..e91104e4d8 100644 --- a/src/Fable.Compiler/ProjectCracker.fs +++ b/src/Fable.Compiler/ProjectCracker.fs @@ -762,7 +762,7 @@ let copyFableLibraryAndPackageSourcesPy (opts: CrackerOptions) (pkgs: FablePacka getFableLibraryPath opts shouldCopy, pkgRefs // See #1455: F# compiler generates *.AssemblyInfo.fs in obj folder, but we don't need it -let removeFilesInObjFolder (sourceFiles: string[]) = +let removeFilesInObjFolder (sourceFiles: string array) = let reg = Regex(@"[\\\/]obj[\\\/]") sourceFiles |> Array.filter (reg.IsMatch >> not) diff --git a/src/Fable.Compiler/Util.fs b/src/Fable.Compiler/Util.fs index c38192a4c6..47c22595e0 100644 --- a/src/Fable.Compiler/Util.fs +++ b/src/Fable.Compiler/Util.fs @@ -662,7 +662,7 @@ module Observable = } let throttle (ms: int) (obs: IObservable<'T>) = - { new IObservable<'T[]> with + { new IObservable<'T array> with member _.Subscribe w = let events = ResizeArray() let timer = new Timers.Timer(float ms, AutoReset = false) @@ -759,7 +759,7 @@ module Json = else writer.WriteNumberValue(value) - type StringPoolReader(pool: string[]) = + type StringPoolReader(pool: string array) = inherit JsonConverter() override _.Read(reader, _typeToConvert, _options) = @@ -818,7 +818,7 @@ module Json = let path = path.[0 .. path.Length - ext.Length - 1] + "_strings.json" let jsonReadOnlySpan: ReadOnlySpan = File.ReadAllBytes(path) - JsonSerializer.Deserialize(jsonReadOnlySpan) + JsonSerializer.Deserialize(jsonReadOnlySpan) let options = getOptions () options.Converters.Add(StringPoolReader(strings)) @@ -879,7 +879,7 @@ type PrecompiledInfoJson = CompilerOptions: Fable.CompilerOptions FableLibDir: string Files: Map - InlineExprHeaders: string[] + InlineExprHeaders: string array } type PrecompiledInfoImpl(fableModulesDir: string, info: PrecompiledInfoJson) = @@ -924,7 +924,7 @@ type PrecompiledInfoImpl(fableModulesDir: string, info: PrecompiledInfoJson) = fun _ -> lazy PrecompiledInfoImpl.GetInlineExprsPath(fableModulesDir, index) - |> Json.readWithStringPool<(string * Fable.InlineExpr)[]> + |> Json.readWithStringPool<(string * Fable.InlineExpr) array> |> Map ) @@ -987,7 +987,7 @@ module Reflection = /// Prevent ReflectionTypeLoadException /// From http://stackoverflow.com/a/7889272 let getTypes (asm: System.Reflection.Assembly) = - let mutable types: Option = None + let mutable types: Option = None try types <- Some(asm.GetTypes()) diff --git a/src/Fable.Compiler/Util.fsi b/src/Fable.Compiler/Util.fsi index 79e86081fd..35fdbddf88 100644 --- a/src/Fable.Compiler/Util.fsi +++ b/src/Fable.Compiler/Util.fsi @@ -154,7 +154,7 @@ type PrecompiledInfoJson = CompilerOptions: Fable.CompilerOptions FableLibDir: string Files: Map - InlineExprHeaders: string[] + InlineExprHeaders: string array } type PrecompiledInfoImpl = diff --git a/src/Fable.Transforms/BabelPrinter.fs b/src/Fable.Transforms/BabelPrinter.fs index d99ad34b3b..b2886af045 100644 --- a/src/Fable.Transforms/BabelPrinter.fs +++ b/src/Fable.Transforms/BabelPrinter.fs @@ -81,7 +81,7 @@ module PrinterExtensions = printer.Print(s) printSeparator |> Option.iter (fun f -> f printer) - member printer.PrintProductiveStatements(statements: Statement[]) = + member printer.PrintProductiveStatements(statements: Statement array) = for s in statements do printer.PrintProductiveStatement(s, (fun p -> p.PrintStatementSeparator())) @@ -140,7 +140,7 @@ module PrinterExtensions = if i < items.Length - 1 then printSeparator printer - member printer.PrintParameters(items: Parameter array, ?accessModifers: AccessModifier[]) = + member printer.PrintParameters(items: Parameter array, ?accessModifers: AccessModifier array) = let accessModifiers = defaultArg accessModifers [||] let len = items.Length let mutable i = 0 @@ -400,7 +400,7 @@ module PrinterExtensions = printer.Print(" " + operator + " ") printer.ComplexExpressionWithParens(right) - member printer.PrintJsxTemplate(parts: string[], values: Expression[]) = + member printer.PrintJsxTemplate(parts: string array, values: Expression array) = // Do we need to escape backslashes here? let escape str = str //Regex.Replace(str, @"(?") - member printer.Print(parameters: TypeAnnotation[]) = + member printer.Print(parameters: TypeAnnotation array) = if parameters.Length > 0 then printer.Print("<") printer.PrintCommaSeparatedArray(parameters) diff --git a/src/Fable.Transforms/Dart/Fable2Dart.fs b/src/Fable.Transforms/Dart/Fable2Dart.fs index 0296fa0953..088a9f729b 100644 --- a/src/Fable.Transforms/Dart/Fable2Dart.fs +++ b/src/Fable.Transforms/Dart/Fable2Dart.fs @@ -81,9 +81,9 @@ type IDartCompiler = abstract TransformFunction: Context * string option * Fable.Ident list * Fable.Expr -> Ident list * Statement list * Type - abstract WarnOnlyOnce: string * ?values: obj[] * ?range: SourceLocation -> unit + abstract WarnOnlyOnce: string * ?values: obj array * ?range: SourceLocation -> unit - abstract ErrorOnlyOnce: string * ?values: obj[] * ?range: SourceLocation -> unit + abstract ErrorOnlyOnce: string * ?values: obj array * ?range: SourceLocation -> unit module Util = diff --git a/src/Fable.Transforms/Dart/Replacements.fs b/src/Fable.Transforms/Dart/Replacements.fs index 5bca9082f0..5761eb9326 100644 --- a/src/Fable.Transforms/Dart/Replacements.fs +++ b/src/Fable.Transforms/Dart/Replacements.fs @@ -868,7 +868,7 @@ let printJsTaggedTemplate {| Index: int Length: int - |}[]) + |} array) (printHoleContent: int -> string) = // Escape ` quotations for JS. Note F# escapes for {, } and % are already replaced by the compiler diff --git a/src/Fable.Transforms/FSharp2Fable.Util.fs b/src/Fable.Transforms/FSharp2Fable.Util.fs index bff29f9e05..e152b82e37 100644 --- a/src/Fable.Transforms/FSharp2Fable.Util.fs +++ b/src/Fable.Transforms/FSharp2Fable.Util.fs @@ -12,7 +12,7 @@ open Fable.Transforms open Fable.Transforms.FSharp2Fable module Extensions = - let areParamTypesEqual genArgs (args1: Fable.Type[]) (args2: IList>) = + let areParamTypesEqual genArgs (args1: Fable.Type array) (args2: IList>) = // Not entirely sure why, but it seems members with a single unit argument sometimes have this parameter // and sometimes none, so just to be sure always remove single unit arguments let args2 = @@ -411,7 +411,7 @@ type FsEnt(maybeAbbrevEnt: FSharpEntity) = ( compiledName: string, isInstance: bool, - ?argTypes: Fable.Type[], + ?argTypes: Fable.Type array, ?genArgs, // ?searchHierarchy: bool, ?requireDispatchSlot: bool @@ -1713,7 +1713,7 @@ module TypeHelpers = (ent: FSharpEntity) (compiledName: string) (isInstance: bool) - (argTypes: Fable.Type[] option) + (argTypes: Fable.Type array option) = let entRef = FsEnt.Ref ent diff --git a/src/Fable.Transforms/Fable2Babel.fs b/src/Fable.Transforms/Fable2Babel.fs index 15a481350b..3d6bbde8a3 100644 --- a/src/Fable.Transforms/Fable2Babel.fs +++ b/src/Fable.Transforms/Fable2Babel.fs @@ -2721,7 +2721,7 @@ but thanks to the optimisation done below we get (evalExpr: Fable.Expr) cases defaultCase - : Statement[] + : Statement array = let transformGuard = function @@ -2817,7 +2817,7 @@ but thanks to the optimisation done below we get returnStrategy targetIndex boundValues - : Statement[] + : Statement array = match returnStrategy with | Some(Target targetId) -> @@ -3031,7 +3031,7 @@ but thanks to the optimisation done below we get returnStrategy (targets: (Fable.Ident list * Fable.Expr) list) (treeExpr: Fable.Expr) - : Statement[] + : Statement array = let doesNotNeedExtraSwitch cases defaultCase = @@ -3504,8 +3504,8 @@ but thanks to the optimisation done below we get (ent: Fable.Entity) entName (doc: string option) - (consArgs: Parameter[]) - (consArgsModifiers: AccessModifier[]) + (consArgs: Parameter array) + (consArgsModifiers: AccessModifier array) (consBody: BlockStatement) (superClass: SuperClass option) classMembers @@ -3676,7 +3676,7 @@ but thanks to the optimisation done below we get (ent: Fable.Entity) entName doc - (consArgs: Parameter[]) + (consArgs: Parameter array) (consBody: BlockStatement) baseExpr classMembers diff --git a/src/Fable.Transforms/Global/Babel.fs b/src/Fable.Transforms/Global/Babel.fs index 3226c7647e..fa54308339 100644 --- a/src/Fable.Transforms/Global/Babel.fs +++ b/src/Fable.Transforms/Global/Babel.fs @@ -25,7 +25,7 @@ type AssignmentOperator = type Expression = | CommentedExpression of comment: string * expr: Expression | JsxElement of componentOrTag: Expression * props: (string * Expression) list * children: Expression list - | JsxTemplate of parts: string[] * values: Expression[] + | JsxTemplate of parts: string array * values: Expression array | Literal of Literal | Identifier of Identifier | ClassExpression of @@ -474,7 +474,7 @@ type ClassMember = type ClassMethodKind = - | ClassPrimaryConstructor of AccessModifier[] + | ClassPrimaryConstructor of AccessModifier array | ClassFunction of key: Expression * isComputed: bool | ClassGetter of key: Expression * isComputed: bool | ClassSetter of key: Expression * isComputed: bool diff --git a/src/Fable.Transforms/Global/Compiler.fs b/src/Fable.Transforms/Global/Compiler.fs index 14c4e2a12a..c5a26eaf84 100644 --- a/src/Fable.Transforms/Global/Compiler.fs +++ b/src/Fable.Transforms/Global/Compiler.fs @@ -69,7 +69,7 @@ type Compiler = abstract OutputType: OutputType abstract ProjectFile: string abstract ProjectOptions: FSharpProjectOptions - abstract SourceFiles: string[] + abstract SourceFiles: string array abstract Options: CompilerOptions abstract Plugins: CompilerPlugins abstract IncrementCounter: unit -> int diff --git a/src/Fable.Transforms/Global/Prelude.fs b/src/Fable.Transforms/Global/Prelude.fs index 0dccbf8a30..5b2649fd35 100644 --- a/src/Fable.Transforms/Global/Prelude.fs +++ b/src/Fable.Transforms/Global/Prelude.fs @@ -6,7 +6,7 @@ open System module Extensions = type String with - member str.StartsWithAny([] patterns: string[]) = + member str.StartsWithAny([] patterns: string array) = patterns |> Array.exists (fun p -> str.StartsWith(p, StringComparison.Ordinal)) module Dictionary = @@ -56,7 +56,7 @@ module Seq = let mapToList (f: 'a -> 'b) (xs: 'a seq) : 'b list = ([], xs) ||> Seq.fold (fun li x -> (f x) :: li) |> List.rev - let mapToArray (f: 'a -> 'b) (xs: 'a seq) : 'b[] = + let mapToArray (f: 'a -> 'b) (xs: 'a seq) : 'b array = let ar = ResizeArray() xs |> Seq.iter (fun x -> ar.Add(f x)) ar.ToArray() @@ -82,7 +82,7 @@ module Seq = [] module Array = - let filteri (filter: int -> 'a -> bool) (xs: 'a[]) : 'a[] = + let filteri (filter: int -> 'a -> bool) (xs: 'a array) : 'a array = let mutable i = -1 xs @@ -91,7 +91,7 @@ module Array = filter i x ) - let partitionBy (f: 'T -> Choice<'T1, 'T2>) (xs: 'T[]) = + let partitionBy (f: 'T -> Choice<'T1, 'T2>) (xs: 'T array) = let r1 = ResizeArray() let r2 = ResizeArray() @@ -181,12 +181,12 @@ module List = ar.ToArray() let mapToArray (f: 'a -> 'b) (xs: 'a list) = - let ar: 'b[] = List.length xs |> Array.zeroCreate + let ar: 'b array = List.length xs |> Array.zeroCreate xs |> List.iteri (fun i x -> ar.[i] <- f x) ar let mapiToArray (f: int -> 'a -> 'b) (xs: 'a list) = - let ar: 'b[] = List.length xs |> Array.zeroCreate + let ar: 'b array = List.length xs |> Array.zeroCreate xs |> List.iteri (fun i x -> ar.[i] <- f i x) ar @@ -430,11 +430,11 @@ module Path = // let isDir = IO.Directory.Exists getRelativeFileOrDirPath (isDir fromFullPath) fromFullPath (isDir toFullPath) toFullPath - let getCommonPrefix (xs: string[] list) = - let rec getCommonPrefix (prefix: string[]) = + let getCommonPrefix (xs: string array list) = + let rec getCommonPrefix (prefix: string array) = function | [] -> prefix - | (x: string[]) :: xs -> + | (x: string array) :: xs -> let mutable i = 0 while i < prefix.Length && i < x.Length && x.[i] = prefix.[i] do diff --git a/src/Fable.Transforms/Replacements.Util.fs b/src/Fable.Transforms/Replacements.Util.fs index 5df3422f42..1ccea1dbaa 100644 --- a/src/Fable.Transforms/Replacements.Util.fs +++ b/src/Fable.Transforms/Replacements.Util.fs @@ -439,7 +439,7 @@ let makeStringTemplate {| Index: int Length: int - |}[]) + |} array) values = let mutable prevIndex = 0 diff --git a/src/Fable.Transforms/Rust/AST/Rust.AST.Adapters.fs b/src/Fable.Transforms/Rust/AST/Rust.AST.Adapters.fs index 37277dd68f..86e7e375dc 100644 --- a/src/Fable.Transforms/Rust/AST/Rust.AST.Adapters.fs +++ b/src/Fable.Transforms/Rust/AST/Rust.AST.Adapters.fs @@ -275,13 +275,13 @@ type Macros = [] module ArrayHelpers = - let split_first (arr: 'T[]) = + let split_first (arr: 'T array) = if arr.Length = 0 then None else Some(arr[0], arr[1..]) - let split_last (arr: 'T[]) = + let split_last (arr: 'T array) = if arr.Length = 0 then None else diff --git a/src/Fable.Transforms/Rust/AST/Rust.AST.Types.fs b/src/Fable.Transforms/Rust/AST/Rust.AST.Types.fs index 2f79529703..a08d3723e0 100644 --- a/src/Fable.Transforms/Rust/AST/Rust.AST.Types.fs +++ b/src/Fable.Transforms/Rust/AST/Rust.AST.Types.fs @@ -1130,7 +1130,7 @@ type LitKind = /// A string literal (`"foo"`). | Str of Symbol * StrStyle /// A byte string (`b"foo"`). - | ByteStr of Lrc + | ByteStr of Lrc /// A byte char (`b'f'`). | Byte of u8 /// A character literal (`'a'`). diff --git a/src/Fable.Transforms/Rust/Fable2Rust.fs b/src/Fable.Transforms/Rust/Fable2Rust.fs index a800acf71d..67f32d99fc 100644 --- a/src/Fable.Transforms/Rust/Fable2Rust.fs +++ b/src/Fable.Transforms/Rust/Fable2Rust.fs @@ -4262,7 +4262,7 @@ module Util = match a.ConstructorArgs with | [ :? string as name ] -> [ mkAttr name [] ] | [ :? string as name; :? string as value ] -> [ mkEqAttr name value ] - | [ :? string as name; :? (obj[]) as items ] -> [ mkAttr name (items |> Array.map string) ] + | [ :? string as name; :? (obj array) as items ] -> [ mkAttr name (items |> Array.map string) ] | _ -> [] // translate test methods attributes // TODO: support more test frameworks @@ -4282,7 +4282,8 @@ module Util = match att.ConstructorArgs with | [ :? string as name ] -> [ mkInnerAttr name [] ] | [ :? string as name; :? string as value ] -> [ mkInnerEqAttr name value ] - | [ :? string as name; :? (obj[]) as items ] -> [ mkInnerAttr name (items |> Array.map string) ] + | [ :? string as name; :? (obj array) as items ] -> + [ mkInnerAttr name (items |> Array.map string) ] | _ -> [] else [] diff --git a/src/Fable.Transforms/State.fs b/src/Fable.Transforms/State.fs index ecee362a89..fd899d0964 100644 --- a/src/Fable.Transforms/State.fs +++ b/src/Fable.Transforms/State.fs @@ -237,7 +237,7 @@ type Project |> Dictionary.tryFind memberUniqueName |> Option.map (fun e -> e.Calculate(com)) - member _.GetFileInlineExprs(com: Compiler) : (string * InlineExpr)[] = + member _.GetFileInlineExprs(com: Compiler) : (string * InlineExpr) array = match Map.tryFind com.CurrentFile implFiles with | None -> [||] | Some implFile -> diff --git a/src/Fable.Transforms/Transforms.Util.fs b/src/Fable.Transforms/Transforms.Util.fs index 80bb5a71ec..51f59ea9ed 100644 --- a/src/Fable.Transforms/Transforms.Util.fs +++ b/src/Fable.Transforms/Transforms.Util.fs @@ -1142,14 +1142,14 @@ module AST = | Unit, _ -> UnitConstant |> makeValue r // Arrays with small data type (ushort, byte) are represented // in F# AST as BasicPatterns.Const - | Array(Number(kind, uom), arrayKind), (:? (byte[]) as arr) -> + | Array(Number(kind, uom), arrayKind), (:? (byte array) as arr) -> let values = arr |> Array.map (fun x -> NumberConstant(NumberValue.UInt8 x, uom) |> makeValue None) |> Seq.toList NewArray(ArrayValues values, Number(kind, uom), arrayKind) |> makeValue r - | Array(Number(kind, uom), arrayKind), (:? (uint16[]) as arr) -> + | Array(Number(kind, uom), arrayKind), (:? (uint16 array) as arr) -> let values = arr |> Array.map (fun x -> NumberConstant(NumberValue.UInt16 x, uom) |> makeValue None)