Skip to content

Simplifier removes trivia when eliminating 'this.' uses.  #50

@jaredpar

Description

@jaredpar

Consider the following code:

class C1
{
    int _field;

    void M()
    {
        this. /* comment1 */ _field /* comment 2 */ = 0;
    }
}

If the MemerAccessExpressionSyntax for the field access is tagged with Simplifier.Annotation and the result run through the Simplifier the code will be transformed into.

class C1
{
    int _field;

    void M()
    {
        _field /* comment 2 */ = 0;
    }
}

Notice that /* comment 1 */ has been removed. That seems like a bug. Removing non-comment trivia seems acceptable here but removing comments is potentially removing valuable documentation during the act of simplification. At the least it seems like there should be an option to prevent this from happening.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions