Skip to content

Commit 7264c80

Browse files
committed
Fix standalone build and interpolated string analyzer warnings
Add QuotationEmitter.fs to Fable.Standalone.fsproj and add type-safe format specifiers to interpolated strings in QuotationEmitter.fs.
1 parent a63ded8 commit 7264c80

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/Fable.Transforms/QuotationEmitter.fs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -367,14 +367,14 @@ and private typeToString (t: Type) : string =
367367
| Unit -> "Microsoft.FSharp.Core.Unit"
368368
| Any -> "System.Object"
369369
| LambdaType(argType, returnType) ->
370-
$"Microsoft.FSharp.Core.FSharpFunc`2[{typeToString argType},{typeToString returnType}]"
370+
$"Microsoft.FSharp.Core.FSharpFunc`2[%s{typeToString argType},%s{typeToString returnType}]"
371371
| Tuple(genArgs, _) ->
372372
let args = genArgs |> List.map typeToString |> String.concat ","
373-
$"System.Tuple`{genArgs.Length}[{args}]"
373+
$"System.Tuple`%d{genArgs.Length}[%s{args}]"
374374
| DeclaredType(entRef, _genArgs) -> entRef.FullName
375-
| Option(genArg, _) -> $"Microsoft.FSharp.Core.FSharpOption`1[{typeToString genArg}]"
376-
| List genArg -> $"Microsoft.FSharp.Collections.FSharpList`1[{typeToString genArg}]"
377-
| Array(genArg, _) -> $"{typeToString genArg}[]"
375+
| Option(genArg, _) -> $"Microsoft.FSharp.Core.FSharpOption`1[%s{typeToString genArg}]"
376+
| List genArg -> $"Microsoft.FSharp.Collections.FSharpList`1[%s{typeToString genArg}]"
377+
| Array(genArg, _) -> $"%s{typeToString genArg}[]"
378378
| _ -> "System.Object"
379379

380380
and private makeArray (elementType: Type) (elements: Expr list) : Expr =
@@ -385,7 +385,7 @@ and private emitLiteral (com: Compiler) (ctorName: string) (args: Expr list) : E
385385
Helper.LibCall(com, "Quotation", "mkValue", Any, [ lit ])
386386

387387
and private emitUnsupported (com: Compiler) (nodeName: string) : Expr =
388-
let msg = $"Unsupported quotation node: {nodeName}"
388+
let msg = $"Unsupported quotation node: %s{nodeName}"
389389
com.AddLog(msg, Severity.Warning, tag = "FABLE")
390390
let lit = Helper.LibCall(com, "Quotation", "mkString", Any, [ makeStrConst msg ])
391391
Helper.LibCall(com, "Quotation", "mkValue", Any, [ lit ])

src/fable-standalone/src/Fable.Standalone.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
<Compile Include="../../Fable.Transforms/Beam/Beam.AST.fs" />
3838
<Compile Include="../../Fable.Transforms/Beam/Replacements.fs" />
3939
<Compile Include="../../Fable.Transforms/Replacements.fs" />
40+
<Compile Include="../../Fable.Transforms/QuotationEmitter.fs" />
4041
<Compile Include="../../Fable.Transforms/Replacements.Api.fs" />
4142
<Compile Include="../../Fable.Transforms/FSharp2Fable.fs" />
4243
<Compile Include="../../Fable.Transforms/FableTransforms.fs" />

0 commit comments

Comments
 (0)