mirror of
https://github.com/github/codeql.git
synced 2026-03-30 20:28:15 +02:00
C#: Add dataflow test for partial constructors.
This commit is contained in:
@@ -274,6 +274,7 @@ subpaths
|
||||
| Constructors.cs:143:25:143:26 | access to local variable o1 : Object | Constructors.cs:137:29:137:32 | Obj1 : Object | Constructors.cs:137:19:137:20 | this [Return] : R1 [property Obj1] : Object | Constructors.cs:143:18:143:31 | object creation of type R1 : R1 [property Obj1] : Object |
|
||||
| Constructors.cs:143:29:143:30 | access to local variable o2 : Object | Constructors.cs:137:42:137:45 | Obj2 : Object | Constructors.cs:137:19:137:20 | this [Return] : R1 [property Obj2] : Object | Constructors.cs:143:18:143:31 | object creation of type R1 : R1 [property Obj2] : Object |
|
||||
testFailures
|
||||
| Constructors.cs:164:29:164:48 | // ... | Missing result: hasValueFlow=11 |
|
||||
#select
|
||||
| Constructors.cs:15:18:15:19 | access to field s1 | Constructors.cs:5:29:5:45 | call to method Source<Object> : Object | Constructors.cs:15:18:15:19 | access to field s1 | $@ | Constructors.cs:5:29:5:45 | call to method Source<Object> : Object | call to method Source<Object> : Object |
|
||||
| Constructors.cs:33:18:33:19 | access to field s1 | Constructors.cs:21:29:21:45 | call to method Source<Object> : Object | Constructors.cs:33:18:33:19 | access to field s1 | $@ | Constructors.cs:21:29:21:45 | call to method Source<Object> : Object | call to method Source<Object> : Object |
|
||||
|
||||
@@ -145,6 +145,25 @@ public class Constructors
|
||||
Sink(r1.Obj2); // $ hasValueFlow=10
|
||||
}
|
||||
|
||||
public partial class CPartial
|
||||
{
|
||||
public object Obj { get; }
|
||||
|
||||
public partial CPartial(object o);
|
||||
}
|
||||
|
||||
public partial class CPartial
|
||||
{
|
||||
public partial CPartial(object o) => Obj = o;
|
||||
}
|
||||
|
||||
public void M8()
|
||||
{
|
||||
var o = Source<object>(11);
|
||||
var cPartial = new CPartial(o);
|
||||
Sink(cPartial.Obj); // $ hasValueFlow=11
|
||||
}
|
||||
|
||||
public static void Sink(object o) { }
|
||||
|
||||
public static T Source<T>(object source) => throw null;
|
||||
|
||||
Reference in New Issue
Block a user