Reporter | Daniel Hilgarth (DanielH) |
---|---|
Created | Nov 1, 2012 3:48:28 PM |
Updated | Apr 26, 2018 11:42:25 AM |
Resolved | Apr 26, 2018 11:42:25 AM |
Subsystem | Refactorings |
Assignee | Alisa Afonina (alisa.afonina) |
Priority | Normal |
State | Fixed |
Type | Bug |
Fix version | Unidentified prior version |
Affected versions | 8.0 |
Fixed In Version ReSharper | Undefined |
VsVersion | All Versions |
The following methods have been moved to a super class using the Resharper "Extract Superclass" feature:
The second method got moved correctly, but the first one resulted in the following:
Note the generic type parameter.
This doesn't compile as object isn't a CrudControllerBase<TModel, TEntity>. That's how I noticed the error.
However, in cases where there isn't a constraint it would compile but change the behavior of the code, as the type inference of the DLR doesn't kick in any more.
private Uri GetSelf(TEntity entity)
{
return GetSelf(entity, (dynamic)this);
}
private Uri GetSelf<TController>(TEntity entity, TController dummy) where TController : CrudControllerBase<TModel, TEntity>
{
return _routeLinker.GetUri<TController>(c => c.GetById(entity.Id));
}
The second method got moved correctly, but the first one resulted in the following:
private Uri GetSelf(TEntity entity)
{
return GetSelf<object>(entity, (dynamic)this);
}
Note the generic type parameter.
This doesn't compile as object isn't a CrudControllerBase<TModel, TEntity>. That's how I noticed the error.
However, in cases where there isn't a constraint it would compile but change the behavior of the code, as the type inference of the DLR doesn't kick in any more.