Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-469335: Deconstruction: Introduce variable is available for deconstructed class.

$
0
0
Reporter Lilia Shamsutdinova (Lilia.Shamsutdinova) Lilia Shamsutdinova (Lilia.Shamsutdinova)
Created Apr 19, 2018 5:04:56 PM
Updated Apr 19, 2018 5:07:13 PM
Subsystem Refactorings
Assignee Andrew Karpov (andrew.karpov)
Priority Normal
State Submitted
Type Bug
Fix version Backlog
Affected versions 2018.1
Fixed In Version ReSharper Undefined
VsVersion VS 2017 RTM

JetBrains ReSharper Ultimate 2018.1 12.0.20180418.033450-eap10d.

Class1

    public class Class1
    {
        private readonly Person person = new Person("John Smith", 1234567890, "10/10/1900");

        private void Test()
        {
            var (name, phone) = person;

            var test = person;
        }
    }

Person

    public class Person
    {
        public string Name;
        public int Phone;
        public string BirthDate;

        public Person(string name, int phone, string birthDate)
        {
            Name = name;
            Phone = phone;
            BirthDate = birthDate;
        }
        public void Deconstruct(out string name, out int phone)
        {
            name = Name;
            phone = Phone;
        }
    }
  1. Invoke Refactor This menu on var (name, phone) = person;

Actual result:
"Introduce variable" option is available.

Expected result:
"Introduce variable" option is not available.

NOTE:
If "Introduce variable" refactoring is invoked then uncompilable code is generated:

            var foo = var (name, phone) = person;

If Refactor This menu is invoked on var test = person; then "Introduce variable" option is not available.


Viewing all articles
Browse latest Browse all 106942

Trending Articles