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

RSRP-469319: Specify type explicitly: produces uncompilable code for deconstructed type in foreach.

$
0
0
Reporter Lilia Shamsutdinova (Lilia.Shamsutdinova) Lilia Shamsutdinova (Lilia.Shamsutdinova)
Created Apr 18, 2018 6:24:48 PM
Updated Apr 19, 2018 8:59:28 PM
Subsystem Context Actions
Assignee Andrey Dyatlov (Andrey.Dyatlov)
Priority Critical
State Fixed In Branch
Type Bug
Fix version 2018.1.1
Affected versions 2018.1
Fixed In Version ReSharper Undefined
VsVersion VS 2017 RTM

JetBrains ReSharper Ultimate 2018.1 12.0.20180418.033450-eap10d.

PersonBase.cs

    public class PersonBase
    {
        public string Name;
        public int Phone;

        public void Deconstruct(out string name, out int phone)
        {
            name = Name;
            phone = Phone;
        }
    }

Class1.cs

    public class Class1
    {
        private void Test(int i)
        {
            foreach (var (s2, i1) in new List<PersonBase>())
            {
                
            }
        }
    }
  1. Invoke CA "Specify type explicitly" on var.

Actual result:
Uncompilable code:

            foreach (PersonBase (s2, i1) in new List<PersonBase>())
            {
                
            }

Expected result:
Compilable code:

            foreach ((string s2, int i1) in new List<PersonBase>())
            {
                
            }

Viewing all articles
Browse latest Browse all 106942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>