Reporter | Marcelo Volmaro (Marcelo.Volmaro) |
---|---|
Created | Feb 4, 2011 12:20:32 AM |
Updated | Jan 13, 2012 11:14:04 PM |
Resolved | Jan 13, 2012 6:25:43 PM |
Priority | Normal |
Type | Bug |
Fix versions | 6.1 |
State | Fixed |
Assignee | Evgeny Pasynkov (pasynkov) |
Subsystem | Code Analysis |
Affected versions | No Affected versions |
Fixed in build | 6.5.1.2269 |
I have the following class:
internal static class ConstantExpressionCompiler {
private static readonly Dictionary<Type, Func<Expression, object>> _compilers = new Dictionary<Type, Func<Expression, object>> {
{typeof (DateTime), getValue <DateTime>},//Error
{typeof (DateTime?), getValue<DateTime?>},
{typeof (TimeSpan), getValue <TimeSpan>},//Error
{typeof (TimeSpan?), getValue<TimeSpan?>},
{typeof (Guid), getValue <Guid>},//Error
{typeof (Guid?), getValue<Guid?>}
};
private static object getValue<T>(Expression pExpression) {
.Compile()();
}
}
ReSharper is showing errors (Struct name is not valid at this point) on the 3 lines marked with comments. But the code is valid and compiles ok.
Tested on ReShaper 5.1.1766.4
internal static class ConstantExpressionCompiler {
private static readonly Dictionary<Type, Func<Expression, object>> _compilers = new Dictionary<Type, Func<Expression, object>> {
{typeof (DateTime), getValue <DateTime>},//Error
{typeof (DateTime?), getValue<DateTime?>},
{typeof (TimeSpan), getValue <TimeSpan>},//Error
{typeof (TimeSpan?), getValue<TimeSpan?>},
{typeof (Guid), getValue <Guid>},//Error
{typeof (Guid?), getValue<Guid?>}
};
private static object getValue<T>(Expression pExpression) {
return Expression.Lambda<Func<T>>(pExpression)
}
}
ReSharper is showing errors (Struct name is not valid at this point) on the 3 lines marked with comments. But the code is valid and compiles ok.
Tested on ReShaper 5.1.1766.4