mirror of
https://github.com/github/codeql.git
synced 2026-04-23 15:55:18 +02:00
C#: Add test case with recursive generics
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
import csharp
|
||||
import semmle.code.csharp.commons.Diagnostics
|
||||
|
||||
query predicate extractorMessages(ExtractorMessage msg, int severity, string elementText) {
|
||||
msg.getSeverity() = severity and msg.getElementText() = elementText
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import csharp
|
||||
|
||||
from Class c
|
||||
where c.fromSource()
|
||||
select c, c.getBaseClass().getQualifiedName()
|
||||
@@ -0,0 +1,23 @@
|
||||
public class GenA<U> { };
|
||||
public class GenB<T> : GenA<GenB<GenB<T>>> { };
|
||||
|
||||
class P<T> { }
|
||||
class C<U, V> : P<D<V, U>> { }
|
||||
class D<W, X> : P<C<W, X>> { }
|
||||
|
||||
class A<T> : System.IEquatable<A<T>>
|
||||
{
|
||||
public bool Equals(A<T> other) { return true; }
|
||||
}
|
||||
|
||||
public class Class
|
||||
{
|
||||
public static int Main()
|
||||
{
|
||||
GenB<string> a = new GenB<string>();
|
||||
P<D<string, int>> b = new C<int, string>();
|
||||
A<string> c = new A<string>();
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="DeleteBinObjFolders" BeforeTargets="Clean">
|
||||
<RemoveDir Directories=".\bin" />
|
||||
<RemoveDir Directories=".\obj" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -0,0 +1,3 @@
|
||||
from create_database_utils import *
|
||||
|
||||
run_codeql_database_create(['dotnet build'], lang="csharp", extra_args=["--extractor-option=cil=false"])
|
||||
Reference in New Issue
Block a user