Skip to content

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

Closed

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?

Activity

  1. added this to the Backlog milestone on Dec 11, 2023
  2. abonie commented on Dec 11, 2023

    @abonie
    Member

    Hmm... Somewhere in this section I bet.

    Thanks for reporting. Are you planning to look into it @nojaf?

  3. nojaf commented on Dec 11, 2023

    @nojaf
    ContributorAuthor

    Are you planning to look into it @nojaf?

    Well, I took a peek at it yesterday. Indeed, around the area you suggested here, but I wasn't able to make a dent.

    Would you mind skimming through it maybe?

  4. abonie commented on Dec 11, 2023

    @abonie
    Member

    I will give it at least a once-over

  5. added
    Impact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.
    and removed on Dec 11, 2023
  6. nojaf commented on Dec 17, 2023

    @nojaf
    ContributorAuthor

    So @abonie, did you have any fun with this 😸?

  7. abonie commented on Dec 19, 2023

    @abonie
    Member

    Yeah, no luck so far either

  8. removed their assignment
    on Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions