fsprojects / fantomas-tools

Collection of tools used when developing for Fantomas
https://fsprojects.github.io/fantomas-tools/
MIT License
34 stars 8 forks source link

Verbatim strings produce unescaped quotes in AST output #604

Closed OwnageIsMagic closed 11 months ago

OwnageIsMagic commented 11 months ago
let main _ =
    let oldId = 1
    let newId = 2
    printfn $@"Migrate notes of file ""{oldId}"" to new file ""{newId}""."
    0
SynExpr.InterpolatedString(
    contents = [                                                    //  ↓
        SynInterpolatedStringPart.String(value = "Migrate notes of file "", range = R("(4,12--4,40)"))
        SynInterpolatedStringPart.FillExpr(fillExpr = SynExpr.Ident(Ident("oldId", R("(4,40--4,45)"))), qualifiers = None)
                                                            //  ↓
        SynInterpolatedStringPart.String(value = "" to new file "", range = R("(4,45--4,64)"))
        SynInterpolatedStringPart.FillExpr(fillExpr = SynExpr.Ident(Ident("newId", R("(4,64--4,69)"))), qualifiers = None)
                                              //  ↓
        SynInterpolatedStringPart.String(value = "".", range = R("(4,69--4,74)"))
    ],
    synStringKind = SynStringKind.Verbatim,
    range = R("(4,12--4,74)")
),

https://fsprojects.github.io/fantomas-tools/#/ast?data=N4KABGBEAmCmBmBLAdrAzpAXFSAacUiaAYmolmPAIYA2as%2BEkAxgPZwWQ2wAuYAtlRRgA%2BmAC8AHQBOk5BAjc%2BrGtACS0CWACMMuQrBKwqAO4atAJj3yFAB2koe8eQBIAApMgBZRAHNpVDywxqxBaGCs8JSI3GCensAq6tAAvvGQYDysxrAm0bHpwKYaaZCeAHTxsjYQAAzWeASQsAAetlTI0BQ80gCusCApQA

nojaf commented 11 months ago

Hi there, this works as expected to me. The untyped tree isn't accurate when it comes to strings. I'm not sure if there is anything actionable here.