Skip to content

Incorrect range for SynInterpolatedStringPart.String in extended interpolated string #16418

@nojaf

Description

@nojaf

Consider parsing

$$$"""{{{5}}}"""

This will lead to

SynExpr.InterpolatedString(
    SynInterpolatedStringPart.String(value = "", range = R("(1,0--1,9)")) 
    SynInterpolatedStringPart.FillExpr(fillExpr = SynExpr.Const(constant = SynConst.Int32(5), range = R("(1,9--1,10)")), qualifiers = None)
    SynInterpolatedStringPart.String(value = "", range = R("(1,12--1,16)"))
)

The range of the opening SynInterpolatedStringPart.String covers $$$"""{{{, while the closing SynInterpolatedStringPart.String only covers the range of }""".

Expected behaviour

It should cover }}}""" instead.

Actual behavior

The range only starts from the last }.

Related information

Discovered via fsprojects/fantomas#3012

@abonie as you worked on this, could you give me a pointer where in the lexer this could be fixed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Compiler-Syntaxlexfilter, indentation and parsingBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions