Skip to content
Open
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
2 changes: 1 addition & 1 deletion src/Fable.AST/Fable.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be safe right @MangelMaxime ? It will not be a breaking change for Fable.AST?

| NewUnion of values: Expr list * tag: int * ref: EntityRef * genArgs: Type list

member this.Type =
Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Compiler/Globbing.fs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ module Glob =
let path = normalizePath path

let regex =
let outRegex: ref<Regex> = ref null
let outRegex: Regex ref = ref null

if globRegexCache.TryGetValue(pattern, outRegex) then
outRegex.Value
Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Compiler/ProjectCracker.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
12 changes: 6 additions & 6 deletions src/Fable.Compiler/Util.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -759,7 +759,7 @@ module Json =
else
writer.WriteNumberValue(value)

type StringPoolReader(pool: string[]) =
type StringPoolReader(pool: string array) =
inherit JsonConverter<string>()

override _.Read(reader, _typeToConvert, _options) =
Expand Down Expand Up @@ -818,7 +818,7 @@ module Json =
let path = path.[0 .. path.Length - ext.Length - 1] + "_strings.json"

let jsonReadOnlySpan: ReadOnlySpan<byte> = File.ReadAllBytes(path)
JsonSerializer.Deserialize<string[]>(jsonReadOnlySpan)
JsonSerializer.Deserialize<string array>(jsonReadOnlySpan)

let options = getOptions ()
options.Converters.Add(StringPoolReader(strings))
Expand Down Expand Up @@ -879,7 +879,7 @@ type PrecompiledInfoJson =
CompilerOptions: Fable.CompilerOptions
FableLibDir: string
Files: Map<string, PrecompiledFileJson>
InlineExprHeaders: string[]
InlineExprHeaders: string array
}

type PrecompiledInfoImpl(fableModulesDir: string, info: PrecompiledInfoJson) =
Expand Down Expand Up @@ -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
)

Expand Down Expand Up @@ -987,7 +987,7 @@ module Reflection =
/// Prevent ReflectionTypeLoadException
/// From http://stackoverflow.com/a/7889272
let getTypes (asm: System.Reflection.Assembly) =
let mutable types: Option<Type[]> = None
let mutable types: Option<Type array> = None

try
types <- Some(asm.GetTypes())
Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Compiler/Util.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ type PrecompiledInfoJson =
CompilerOptions: Fable.CompilerOptions
FableLibDir: string
Files: Map<string, PrecompiledFileJson>
InlineExprHeaders: string[]
InlineExprHeaders: string array
}

type PrecompiledInfoImpl =
Expand Down
10 changes: 5 additions & 5 deletions src/Fable.Transforms/BabelPrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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()))

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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, @"(?<!\\)\\", @"\\")

Expand Down Expand Up @@ -1154,7 +1154,7 @@ module PrinterExtensions =
printer.Print(": ")
printer.Print(returnType)

member printer.PrintAbstractMembers(members: AbstractMember[], ?singleLine: bool) =
member printer.PrintAbstractMembers(members: AbstractMember array, ?singleLine: bool) =
let singleLine = defaultArg singleLine false

if singleLine then
Expand Down Expand Up @@ -1530,7 +1530,7 @@ module PrinterExtensions =
printer.PrintCommaSeparatedArray(parameters)
printer.Print(">")

member printer.Print(parameters: TypeAnnotation[]) =
member printer.Print(parameters: TypeAnnotation array) =
if parameters.Length > 0 then
printer.Print("<")
printer.PrintCommaSeparatedArray(parameters)
Expand Down
4 changes: 2 additions & 2 deletions src/Fable.Transforms/Dart/Fable2Dart.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =

Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Transforms/Dart/Replacements.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/Fable.Transforms/FSharp2Fable.Util.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ open Fable.Transforms
open Fable.Transforms.FSharp2Fable

module Extensions =
let areParamTypesEqual genArgs (args1: Fable.Type[]) (args2: IList<IList<FSharpParameter>>) =
let areParamTypesEqual genArgs (args1: Fable.Type array) (args2: IList<IList<FSharpParameter>>) =
// 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 =
Expand Down Expand Up @@ -411,7 +411,7 @@ type FsEnt(maybeAbbrevEnt: FSharpEntity) =
(
compiledName: string,
isInstance: bool,
?argTypes: Fable.Type[],
?argTypes: Fable.Type array,
?genArgs,
// ?searchHierarchy: bool,
?requireDispatchSlot: bool
Expand Down Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions src/Fable.Transforms/Fable2Babel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2721,7 +2721,7 @@ but thanks to the optimisation done below we get
(evalExpr: Fable.Expr)
cases
defaultCase
: Statement[]
: Statement array
=
let transformGuard =
function
Expand Down Expand Up @@ -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) ->
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/Fable.Transforms/Global/Babel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Transforms/Global/Compiler.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions src/Fable.Transforms/Global/Prelude.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ open System
module Extensions =
type String with

member str.StartsWithAny([<ParamArray>] patterns: string[]) =
member str.StartsWithAny([<ParamArray>] patterns: string array) =
patterns |> Array.exists (fun p -> str.StartsWith(p, StringComparison.Ordinal))

module Dictionary =
Expand Down Expand Up @@ -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()
Expand All @@ -82,7 +82,7 @@ module Seq =

[<RequireQualifiedAccess>]
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
Expand All @@ -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()

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Transforms/Replacements.Util.fs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ let makeStringTemplate
{|
Index: int
Length: int
|}[])
|} array)
values
=
let mutable prevIndex = 0
Expand Down
4 changes: 2 additions & 2 deletions src/Fable.Transforms/Rust/AST/Rust.AST.Adapters.fs
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,13 @@ type Macros =

[<AutoOpen>]
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
Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Transforms/Rust/AST/Rust.AST.Types.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ type LitKind =
/// A string literal (`"foo"`).
| Str of Symbol * StrStyle
/// A byte string (`b"foo"`).
| ByteStr of Lrc<u8[]>
| ByteStr of Lrc<u8 array>
/// A byte char (`b'f'`).
| Byte of u8
/// A character literal (`'a'`).
Expand Down
5 changes: 3 additions & 2 deletions src/Fable.Transforms/Rust/Fable2Rust.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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<obj>) ]
| [ :? string as name; :? (obj array) as items ] -> [ mkAttr name (items |> Array.map string<obj>) ]
| _ -> []
// translate test methods attributes
// TODO: support more test frameworks
Expand All @@ -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<obj>) ]
| [ :? string as name; :? (obj array) as items ] ->
[ mkInnerAttr name (items |> Array.map string<obj>) ]
| _ -> []
else
[]
Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Transforms/State.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down
Loading
Loading