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.Transforms/Beam/Fable2Beam.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,7 @@ and transformValue (com: IBeamCompiler) (ctx: Context) (value: ValueKind) : Beam
else
adjusted

Beam.ErlExpr.Literal(Beam.ErlLiteral.BigInt(string value))
Beam.ErlExpr.Literal(Beam.ErlLiteral.BigInt(string<System.Numerics.BigInteger> value))

| NewRecord(values, ref, _genArgs) ->
match com.TryGetEntity(ref) with
Expand Down
3 changes: 2 additions & 1 deletion src/Fable.Transforms/Dart/Replacements.fs
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,8 @@ let tryEntityIdent (com: Compiler) entFullName =
| Types.averager
| Types.icomparerGeneric
| Types.iequalityComparerGeneric ->
let entFullName = entFullName[entFullName.LastIndexOf(".") + 1 ..]
let entFullName =
entFullName[entFullName.LastIndexOf(".", StringComparison.Ordinal) + 1 ..]

let entFullName =
match entFullName.IndexOf("`", StringComparison.Ordinal) with
Expand Down
4 changes: 2 additions & 2 deletions src/Fable.Transforms/FSharp2Fable.Util.fs
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ module Helpers =

let join sep s o =
(f s)
+ (if o = "" then
+ (if String.IsNullOrEmpty(o) then
""
else
sep + o)
Expand Down Expand Up @@ -1123,7 +1123,7 @@ module Patterns =
memb.IsPropertyGetterMethod
&& not memb.IsDispatchSlot
&& not memb.IsOverrideOrExplicitInterfaceImplementation
&& memb.LogicalName.StartsWith("get_Is")
&& memb.LogicalName.StartsWith("get_Is", StringComparison.Ordinal)
then
let unionCaseName = memb.LogicalName |> Naming.replacePrefix "get_Is" ""
ent.UnionCases |> Seq.tryFind (fun uc -> uc.Name = unionCaseName)
Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Transforms/Fable2Babel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4047,7 +4047,7 @@ but thanks to the optimisation done below we get
"Unable to find a valid constructor for generating interface via ParamObject, please make sure the constructor has at least one parameter."

[]
| members :: [] ->
| [ members ] ->
Declaration.interfaceDeclaration (
Identifier.identifier decl.Name,
members,
Expand Down
4 changes: 2 additions & 2 deletions src/Fable.Transforms/Global/Naming.fs
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,11 @@ module Naming =
let reflectionSuffix = "_$reflection"

let private printPart sanitize separator part overloadSuffix =
(if part = "" then
(if String.IsNullOrEmpty(part) then
""
else
separator + (sanitize part))
+ (if overloadSuffix = "" then
+ (if String.IsNullOrEmpty(overloadSuffix) then
""
else
"_" + overloadSuffix)
Expand Down
12 changes: 6 additions & 6 deletions src/Fable.Transforms/Global/Prelude.fs
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,15 @@ module Path =
#endif

let ChangeExtension (path: string, ext: string) =
let i = path.LastIndexOf(".")
let i = path.LastIndexOf(".", StringComparison.Ordinal)

if i < 0 then
path
else
path.Substring(0, i) + ext

let GetExtension (path: string) =
let i = path.LastIndexOf(".")
let i = path.LastIndexOf(".", StringComparison.Ordinal)

if i < 0 then
""
Expand All @@ -289,12 +289,12 @@ module Path =

let GetFileName (path: string) =
let normPath = normalizePath path
let i = normPath.LastIndexOf("/")
let i = normPath.LastIndexOf("/", StringComparison.Ordinal)
normPath.Substring(i + 1)

let GetFileNameWithoutExtension (path: string) =
let filename = GetFileName path
let i = filename.LastIndexOf(".")
let i = filename.LastIndexOf(".", StringComparison.Ordinal)

if i < 0 then
filename
Expand All @@ -303,7 +303,7 @@ module Path =

let GetDirectoryName (path: string) =
let normPath = normalizePath path
let i = normPath.LastIndexOf("/")
let i = normPath.LastIndexOf("/", StringComparison.Ordinal)

if i < 0 then
""
Expand All @@ -312,7 +312,7 @@ module Path =

let GetDirectoryAndFileNames (path: string) =
let normPath = normalizePath path
let i = normPath.LastIndexOf("/")
let i = normPath.LastIndexOf("/", StringComparison.Ordinal)

if i < 0 then
"", normPath
Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Transforms/OverloadSuffix.fs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ let rec private getTypeFastFullName (genParams: IDictionary<_, _>) (t: Fable.Typ
let genArgs = String.concat "," genArgs

let genArgs =
if genArgs = "" then
if System.String.IsNullOrEmpty(genArgs) then
""
else
"[" + genArgs + "]"
Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Transforms/Php/Fable2Php.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ let rec convertExpr (com: IPhpCompiler) (expr: Fable.Expr) =
// convert calls on Array object by string key.
// in Php $a['Hello'] is equivalent to $a->Hello, we choose this representation.

let meth = m.Substring(m.LastIndexOf(".") + 1)
let meth = m.Substring(m.LastIndexOf(".", StringComparison.Ordinal) + 1)

PhpMethodCall(convertExpr com target, PhpIdent(unscopedIdent meth), convertArgs com (args))

Expand Down
4 changes: 2 additions & 2 deletions src/Fable.Transforms/Python/Prelude.fs
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ module Naming =
name

let private printPart sanitize separator part overloadSuffix =
(if part = "" then
(if String.IsNullOrEmpty(part) then
""
else
separator + (sanitize part))
+ (if overloadSuffix = "" then
+ (if String.IsNullOrEmpty(overloadSuffix) then
""
else
"_" + overloadSuffix)
Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Transforms/Python/Replacements.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2497,7 +2497,7 @@

Helper.ConstructorCall(constructor com ent, t, [], ?loc = r) |> Some
| t ->
$"Cannot create instance of type unresolved at compile time: %A{t}"
$"Cannot create instance of type unresolved at compile time: {t}"

Check warning

Code scanning / Ionide.Analyzers.Cli

Warns about missing type specifiers in interpolated strings Warning

Interpolated hole expression without format detected. Use prefix with the correct % to enforce type safety.
|> addErrorAndReturnNull com ctx.InlinePath r
|> Some
// reference: https://msdn.microsoft.com/visualfsharpdocs/conceptual/operatorintrinsics.powdouble-function-%5bfsharp%5d
Expand Down
4 changes: 2 additions & 2 deletions src/Fable.Transforms/Replacements.Util.fs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ let splitFullName (fullname: string) =
| -1 -> fullname
| i -> fullname[.. i - 1]

match fullname.LastIndexOf(".") with
match fullname.LastIndexOf(".", StringComparison.Ordinal) with
| -1 -> "", fullname
| i -> fullname.Substring(0, i), fullname.Substring(i + 1)

Expand All @@ -404,7 +404,7 @@ let getTypeNameFromFullName (fullname: string) =
| -1 -> fullname
| i -> fullname[.. i - 1]

match fullname.LastIndexOf(".") with
match fullname.LastIndexOf(".", StringComparison.Ordinal) with
| -1 -> fullname
| i -> fullname.Substring(i + 1)

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 @@ -205,7 +205,7 @@ type System.String with
| '\'' -> @"\'"
| '\"' -> @"\"""
| c when System.Char.IsControl(c) -> System.String.Format(@"\u{0}{1:x4}{2}", "{", int c, "}")
| c -> string c
| c -> string<char> c
)
else
self
Expand All @@ -225,7 +225,7 @@ type System.String with
| '\'' -> @"\'"
| '\"' -> @"\"""
| c when c < '\x20' || c > '\x7e' -> System.String.Format(@"\u{0}{1:x4}{2}", "{", int c, "}")
| c -> string c
| c -> string<char> c
)
else
self
Expand Down
17 changes: 12 additions & 5 deletions src/Fable.Transforms/Rust/AST/Rust.AST.Helpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ module Naming =
let rustPrelude = HashSet(kw.RustPrelude)

let rawIdent (ident: string) =
if ident = "" || ident = "_" || ident.StartsWith("r#") then
if
System.String.IsNullOrEmpty(ident)
|| ident = "_"
|| ident.StartsWith("r#", System.StringComparison.Ordinal)
then
ident
else
"r#" + ident

let stripRaw (ident: string) =
if ident.StartsWith("r#") then
if ident.StartsWith("r#", System.StringComparison.Ordinal) then
ident.Substring("r#".Length)
else
ident
Expand Down Expand Up @@ -191,14 +195,14 @@ module Literals =

let mkBoolLit (value: bool) : Lit =
{
token = mkBoolTokenLit ((string value).ToLowerInvariant())
token = mkBoolTokenLit ((string<bool> value).ToLowerInvariant())
kind = LitKind.Bool(value)
span = DUMMY_SP
}

let mkCharLit (value: char) : Lit =
{
token = mkCharTokenLit ((string value).escape_debug ())
token = mkCharTokenLit ((string<char> value).escape_debug ())
kind = LitKind.Char(value)
span = DUMMY_SP
}
Expand Down Expand Up @@ -882,7 +886,10 @@ module Exprs =
let mkEmitExpr (value: string) args : Expr =
let value =
// if value starts and ends with ", escape inside the quotes
if value.StartsWith("\"") && value.EndsWith("\"") then
if
value.StartsWith("\"", System.StringComparison.Ordinal)
&& value.EndsWith("\"", System.StringComparison.Ordinal)
then
"\"" + value[1 .. (value.Length - 2)].escape_debug () + "\""
else
value
Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Transforms/Rust/AST/Rust.AST.State.fs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ let print_emit_expr self value (args: Vec<_>, printArgs) =
let i = int m.Groups[1].Value

for j = i to args.Length - 1 do
rep.Add("$" + string j)
rep.Add("$" + string<int> j)

String.concat ", " rep
)
Expand Down
Loading
Loading