Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SA1119 claims mandatory parentheses are unnecessary #2058

Closed
AArnott opened this issue Jan 25, 2016 · 7 comments
Closed

SA1119 claims mandatory parentheses are unnecessary #2058

AArnott opened this issue Jan 25, 2016 · 7 comments

Comments

@AArnott
Copy link
Contributor

AArnott commented Jan 25, 2016

In the following statement, SA1119 claims the parentheses are unnecessary:

var s = $"{(3 > 5 ? true : false)}";

Yet after removing them, C# produces a compiler error. So evidently they are indeed necessary.

@sharwell
Copy link
Member

This appears to be a duplicate of #1284. I'll try to reproduce it tomorrow to make sure. 😄

@AArnott
Copy link
Contributor Author

AArnott commented Jan 25, 2016

It sure looks like a dupe. But it still repros with 1.0.0-rc3

@pdelvo
Copy link
Member

pdelvo commented Jan 25, 2016

I tried your example and it does not repro for me.

@AArnott
Copy link
Contributor Author

AArnott commented Jan 25, 2016

I'm seeing a lot of inconsistently reported issues (e.g. #2055) where VS and the command line produce different outputs, different machines produce different build logs, etc. So I can't say I'm too surprised that you're not seeing it, @pdelvo.
Another possibility perhaps is the assembly version issue (since last I checked all StyleCop.Analyzer versions have the same 1.0.0 assembly version, #1391) where although my project says to use 1.0.0-rc3, VS is using a different version of stylecop that was loaded for a different project.

@sharwell
Copy link
Member

I'm seeing a lot of inconsistently reported issues where VS and the command line produce different outputs

This is a bug in Roslyn 1.1 (dotnet/roslyn#7446). A workaround is available (enable SA0000 - #1979), but is disabled by default in the 1.0 release due to its performance overhead. We implemented a better balance of performance/behavior for our upcoming 1.1 beta 1 release (#2033).

Another possibility perhaps is the assembly version issue (since last I checked all StyleCop.Analyzer versions have the same 1.0.0 assembly version, #1391)

This changed many releases ago. Each release has a new strong name now.

@AArnott
Copy link
Contributor Author

AArnott commented Jan 25, 2016

Oh, good to know on both. Thanks. I guess I don't know why it doesn't repro for @pdelvo then.

@sharwell
Copy link
Member

I'm not seeing this reported in the IDE or at compile time with Roslyn 1.1. Considering that there are also 3 tests for #1284 in SA1119UnitTests that pass under Roslyn 1.0, I'm going to mark this as a duplicate of #1284.

If you find a more specific example which reproduces this issue, please reopen it. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants