Skip to content

SyntaxTreeExtensions.IsNameOfContext is missing some cases, which causes rename to introduce errors #1439

Description

@dpoeschl

As a concrete example, rename "local" to "field" in this C# code:

class Program
{
    int field;

    static void Main(string[] args)
    {
        // Rename "local" to "field"
        int local;

        var x = nameof(field); // Correctly expands to Program.field
        nameof(field).ToString(); // Should also expand to Program.field
    }
}

Expected:

class Program
{
    int field;

    static void Main(string[] args)
    {
        // Rename "local" to "field"
        int field;

        var x = nameof(Program.field); // Correctly expands to Program.field
        nameof(Program.field).ToString(); // Should also expand to Program.field
    }
}

Actual:

class Program
{
    int field;

    static void Main(string[] args)
    {
        // Rename "local" to "field"
        int field;

        var x = nameof(Program.field); // Correctly expands to Program.field
        nameof(this.field).ToString(); // Should also expand to Program.field
    }
}

Activity

  1. added this to the 1.0 (stable) milestone on Mar 20, 2015
  2. added a commit that references this issue on Apr 29, 2015
    c45e97a
  3. changed the title [-]SyntaxTreeExtensions.IsNameOfContext is missing some cases[/-] [+]SyntaxTreeExtensions.IsNameOfContext is missing some cases, which causes rename to introduce errors[/+] on Sep 1, 2015
  4. added a commit that references this issue on Oct 9, 2015
    b6efd26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions