[RC]False positive error in VB

i have following if statement in my code:

If mParameter.Datenherkunft = ListenDatenherkunft.Basisoptimierung = True Then
     ...
End If

R# release candiate flag this as an error with the message "Cannot apply operator '=' to operands of type 'TD70.ListenDatenherkunft' and 'Boolean'".

This error wasn't shown in former builds. If i add parantheses around the first comparison the error disappears. But it's normal practice of VB programmers to omit parantheses in If statements (which i can't understand:)).

Regards
Klaus

2 comments

Hello Klaus,

I couldn't reproduce this behavior. Could you please attach a small demo
solution? Thank you!

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

If mParameter.Datenherkunft = ListenDatenherkunft.Basisoptimierung =
True Then
...
End If



0

unfortunately i aslo can't reproduce the behavior in a small solution. But it's definitely there:

2011-06-24 18h01_19.png

Maybe it's because of the complexity of the source code. The file where the error occurs is a large file (> 10.000 lines). The variable mParameter is defined as protected member variable in a base class.

As the code is redundant (comparison with true is not needed, the programmer who wrote the code was a beginner) i will remove the second comparison.

Regards
Klaus

0

Please sign in to leave a comment.