Skip to content

The range of SynAttribute looks incorrect. #13983

@nojaf

Description

@nojaf

Please provide a succinct description of the issue.

Given the following F# code:

[<assembly: SuppressMessage("Gendarme.Rules.Performance",
                            "AvoidRepetitiveCallsToPropertiesRule",
                            Scope = "member",  // MethodDefinition
                            Target = "AltCover.Recorder.Instance/I/CallTrack::instance()",
                            Justification = "Bytecode delta only")>]
()

and matching AST:

...
Attributes
             ([{ Attributes =
                  [{ TypeName = SynLongIdent ([SuppressMessage], [], [None])
                     ArgExpr =
                      Paren
                        (Tuple
                           (false,
                            [...],
                            [tmp.fsx (1,56--1,57); tmp.fsx (2,66--2,67);
                             tmp.fsx (3,44--3,45); tmp.fsx (4,89--4,90)],
                            tmp.fsx (1,28--5,65)), tmp.fsx (1,27--1,28),
                         Some tmp.fsx (5,65--5,66), tmp.fsx (1,27--5,66))
                     Target = Some assembly
                     AppliesToGetterAndSetter = false
                     Range = tmp.fsx (1,12--1,27) }]
...

Notice how the range of SynAttribute is 1,12--1,27, while it has children that are well beyond 1,27.

Expected behaviour

I would assume the range spans until the end of the ArgExpr node.

Actual behaviour

It only included the TypeName.

Known workarounds

A more suitable range can be composed.

Related information

Latest main branch.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions