Seems that R# sometimes doesn't resolve type parameters of generic classes
It seems that R# doesn't resolve type parameters of generic classes if a method of generic class contains a local variable of the same generic type but with different type parameters. R# highlights some expressions in my code as errors (see attachments with screenshots and code samples) but VS compiles them successfully. It's a bug, isn't it?
Attachment(s):
overload.GIF
map.gif
overload.cs
map.cs
Please sign in to leave a comment.
OS Name: Microsoft Windows XP Professional
OS Version: 5.1.2600 Service Pack 2 Build 2600
VS 2005 version 8.0.50727.51
ReSharper build 251
Hello Vladimir,
it would be useful if you include a code sample illustrating the problem.
Thanks.
Regards,
Dmitry Shaporenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
// I attached screenshots with error highlights and full code that caused the problem to my first message.
Hmmm... It seems there is a small bug in the forum engine.
I copy-pasted code here but now I see extra closing angle bracket after KeyValuePair in my previous message. It shouldn't be there. You can see right code in the attachments.
/
I attached screenshots with error highlights and full code that caused the problem to my first message. */
using System;
using System.Collections;
using System.Collections.Generic;
public class Map : IEnumerable> /* bug in the forum engine - wrong extra closing angle bracket after 'KeyValuePair' is shown; see attachments for the right code */ { public static Map Compose( Map lhs, Map rhs) { Map map = new Map(); foreach (KeyValuePair pair in rhs) { TValue value = pair.Value; // lhs is Map, so lhs[value] is TSecond TSecond leftValue = lhs[value]; // Argument type 'TValue' is not assignable to parameter type 'TSecond' map.Add(pair.Key, leftValue); } return map; } void Add(TKey key, TValue value) { throw new NotImplementedException(); } public TValue this[TKey key] { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } public IEnumerator>]]> GetEnumerator() /* bug in the forum engine - wrong extra closing angle bracket after 'KeyValuePair' is shown; see attachments for the right code */
{
throw new NotImplementedException();
}
IEnumerator IEnumerable.GetEnumerator()
{
throw new NotImplementedException();
}
}
Message was edited by:
Vladimir Reshetnikov
Thank you for the report'
The problem reproduced, will be fixed shortly
--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Vladimir Reshetnikov" <no_reply@jetbrains.com> wrote in message
news:26938205.1150718354771.JavaMail.itn@is.intellij.net...
>
>
>
>
>
I've checked.
The problem is that type parameter name of method clashes with type
parameter name of the class.
Currently, ReSharper has problems in detecting such cases
--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Vladimir Reshetnikov" <no_reply@jetbrains.com> wrote in message
news:26938205.1150718354771.JavaMail.itn@is.intellij.net...
>
>
>
>
>
Eugene, it's great!
Thanks a lot.