[447] Use Existing Variable generates invalid code

See the attached example code.

<![CDATA[
        void Bar(bool flag)
        {
            if (flag)
            {
                bool setOption = true;
            }

            if (setOption)
            {}
        }
]]>


Place the cursor on the SetOption token of the if (setOption) line. Press Alt+Enter to get the light bulb options and select "Use Existing Variable setOption". The refactored code is invalid:

<![CDATA[
        void Bar(bool flag)
        {
            if (flag)
            {
                setOption = true;
            }

            bool setOption;
            if (setOption)
            {}
        }
]]>



Attachment(s):
447.UseExistingVariable.zip
1 comment
Comment actions Permalink

Hello,

We appreciate your feedback.

The corresponding JIRA request has been created, and you are welcome to monitor
its status at http://www.jetbrains.net/jira/browse/RSRP-42685.

Best regards,
- Development Team.


0

Please sign in to leave a comment.