Skip to content

Commit

Permalink
Close #615
Browse files Browse the repository at this point in the history
  • Loading branch information
Hosch250 committed Feb 11, 2017
1 parent 2831407 commit 2a45aea
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -310,5 +310,45 @@ class MyCollectionItem {}

VerifyDiagnostic(original);
}

[TestMethod]
public void ElementaryMethodsOfTypeInCollectionNotOverridden_GenericTypeFromClass()
{
var original = @"
using System.Collections.Generic;
namespace ConsoleApplication1
{
internal class MyClass<T>
{
public static List<T> Method()
{
var newList = new List<T>();
return newList;
}
}
}";

VerifyDiagnostic(original);
}

[TestMethod]
public void ElementaryMethodsOfTypeInCollectionNotOverridden_GenericTypeFromMethod()
{
var original = @"
using System.Collections.Generic;
namespace ConsoleApplication1
{
internal class MyClass
{
public static List<T1> Method<T1>()
{
var newList = new List<T1>();
return newList;
}
}
}";

VerifyDiagnostic(original);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ private void AnalyzeSymbol(SyntaxNodeAnalysisContext context)
}

var genericTypeInfo = context.SemanticModel.GetTypeInfo(genericType).Type;
if (genericTypeInfo == null || genericTypeInfo.TypeKind == TypeKind.Interface)
if (genericTypeInfo == null ||
genericTypeInfo.TypeKind == TypeKind.Interface ||
genericTypeInfo.TypeKind == TypeKind.TypeParameter)
{
return;
}
Expand Down

0 comments on commit 2a45aea

Please sign in to comment.