Auto-close curly brace bug
I'm not sure if this is a ReSharper problem or a VisualStudio error but I'll try here first.
On line 3, I typed an opening curly brace just after the '(true)'. A closing curly brace was automatically placed at the end of the line which incorrectly includes the 'i++' as part of the if statement.
It appears the closing curly brace is always placed at the end of the line regardless of how many statements are on that line.
My apologies if this isn't a ReSharper issue.
-paul
Please sign in to leave a comment.
Here's a case where it works:
When I type a curly brace just after the conditional the closing brace is correctly placed prior to the 'else'.
-paul
This behavour is by design.
ReSharper thinks that in line
if (true) i = 1; i++;
both statements are going to be embraced
--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Paul Moore" <no_mail@jetbrains.com> wrote in message
news:1446346.1113854293733.JavaMail.itn@is.intellij.net...
I'll try here first.
>
>
closing curly brace was automatically placed at the end of the line which
incorrectly includes the 'i++' as part of the if statement.
>
regardless of how many statements are on that line.
>
>
This is actually an arguable issue what behavior is better. We should decide
what the user's intention likely is in this situation. How did you come to
such 2 statements on the same line?
Valentin Kipiatkov
Chief Scientist, Vice President of Product Development
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Legacy Code™
I've been cleaning up some old code and came across both of these situations yesterday. I would like to say there are tests that would have caught the problem but there aren't so I have to be more diligent than usual when cleaning up.
Since there aren't tests I would argue in favor of preserving compiled behavior, so that
would become
To do otherwise could introduce some subtle changes to the compiled app.
By placing the braces where they preserve behavior it becomes pretty obvious that something strange is going on with the code's layout.
-paul
Legacy code in C#? LOL! :)
--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Paul Moore" <no_mail@jetbrains.com> wrote in message
news:6688020.1113925679181.JavaMail.itn@is.intellij.net...
>
>
situations yesterday. I would like to say there are tests that would have
caught the problem but there aren't so I have to be more diligent than usual
when cleaning up.
>
behavior, so that
>
>
obvious that something strange is going on with the code's layout.
>
Eugene Pasynkov (JetBrains) wrote:
Yeah, all the crappy C# 1.0 code created by the old .NET veterans in
VS2002... They should have retired before the VS2005 CTP beta came out
but they're still trying to keep it up. Futile attempts ofcourse. ;)