39 lines
1.8 KiB
Plaintext
39 lines
1.8 KiB
Plaintext
=== relates to: S2219
|
|
|
|
=== on 25 Apr 2016, 10:24:59 Tamas Vajk wrote:
|
|
\[~ann.campbell.2], could you review this RSPEC? Thanks.
|
|
|
|
=== on 26 Apr 2016, 17:40:16 Ann Campbell wrote:
|
|
\[~tamas.vajk] this rule is a subset of what would be covered by an implementation of RSPEC-2583. When reading it my first thought was that you wrote it stand-alone to cover a R# rule, but there are no references...?
|
|
|
|
|
|
Also, if we retain this RSpec, IMO you should add a compliant solution. From the description and code sample, I'm _guessing_ compliance is a straightforward code change...?
|
|
|
|
=== on 27 Apr 2016, 08:41:57 Tamas Vajk wrote:
|
|
\[~ann.campbell.2] yes, it's a special case of RSPEC-2583.
|
|
|
|
No, it's not a R# rule. It's the outcome of a bug in one of our rules (RSPEC-2219, added an exception there).
|
|
|
|
|
|
The compliant solution is not straightforward. We can't simply replace the comparison with ``++true++`` or ``++false++`` because that was definitely not what was meant. We could change the ``++typeof(Nullable<int>)++`` to ``++typeof(int)++``, but I don't think that covers the user intent. Most probably the user wanted to check if ``++nullable++`` is a ``++Nullable<T>++`` or not, but that's not possible with ``++GetType++``. And there's no straightforward way to do it, unless you have the type of ``++nullable++`` at compile time.
|
|
|
|
=== on 27 Apr 2016, 17:44:22 Ann Campbell wrote:
|
|
\[~tamas.vajk] I had assumed you'd want to use ``++is++`` (or something similar) instead. Glad I didn't fill in a compliant solution! :-)
|
|
|
|
|
|
For me, the description moves very quickly from
|
|
|
|
____
|
|
Calling GetType() on a nullable object returns the underlying value type.
|
|
|
|
____
|
|
to
|
|
|
|
____
|
|
Thus, comparing the returned Type object to typeof(Nullable<SomeType>) doesn't make sense.
|
|
|
|
____
|
|
|
|
But if C#ers will understand, I'm good with it.
|
|
|