Incorrect "Value of Integral Type Expected" error

I have encountered a bug in the latest build of version 3.1 of ReSharper.
It seems ReSharper incorrectly thinks it is an error to use a nullable enum
type in a switch statement.

The following code compiles just fine but ReSharper highlights the line with
the switch statement with an error (Value of Integral Type Expected):

StringComparison? sc = StringComparison.CurrentCulture; switch(sc) { case StringComparison.Ordinal: return 1; break; default: return 0; break; } ]]>

Obviously, this code is for demonstration only.....not actual code that I
am using :) Can anyone else reproduce this?

~Andy


2 comments
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-58840.

You may want to check our request tracking policy here: http://www.jetbrains.net/confluence/display/ReSharper/ReSharperIssueTracker

Best regards,
- Development Team.


0
Comment actions Permalink

Using nullable types in switch statement is DIRECTLY PROHIBITED in C# 2.0
language specification (though c# compiler allows it).
In C# 3.0 language specs, nullable type usage is allowed.

Thus, ReSharper 3.1 doesn't support this, and ReSharper 4.0 does

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Andy Alm" <andyalm@hotmail.com> wrote in message
news:e91e0d4d0a578ca41bf9c65713c@news.jetbrains.com...
>I have encountered a bug in the latest build of version 3.1 of ReSharper.
>It seems ReSharper incorrectly thinks it is an error to use a nullable enum
>type in a switch statement.

The following code compiles just fine but ReSharper highlights the line
with the switch statement with an error (Value of Integral Type Expected):

>

<pre>
StringComparison? sc = StringComparison.CurrentCulture;

>

switch(sc)
{
case StringComparison.Ordinal:
return 1;
break;
default:
return 0;
break;
}
</pre>

>

Obviously, this code is for demonstration only.....not actual code that I
am using :) Can anyone else reproduce this?

>

~Andy

>



0

Please sign in to leave a comment.