Reporter | Marcelo Volmaro (Marcelo.Volmaro) |
---|---|
Created | Dec 29, 2011 3:11:34 AM |
Updated | Jan 4, 2012 12:09:50 AM |
Resolved | Jan 3, 2012 4:27:11 PM |
Priority | Critical |
Type | Bug |
Fix versions | Next |
State | Fixed |
Assignee | Evgeny Pasynkov (pasynkov) |
Subsystem | Code Analysis |
Affected versions | No Affected versions |
Fixed in build | 6.5.1.1703 |
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.
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.