mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
C#: Add some tests with expected output.
This commit is contained in:
@@ -481,4 +481,40 @@ public class CollectionFlow
|
||||
IntegerCollection ic1 = [.. ic0];
|
||||
Sink(ic1.Payload); // No flow
|
||||
}
|
||||
|
||||
public void SpanConstructorFlow()
|
||||
{
|
||||
var a = new A();
|
||||
Span<A> span = new Span<A>(ref a);
|
||||
Sink(span[0]); // flow
|
||||
}
|
||||
|
||||
public void SpanToArrayFlow()
|
||||
{
|
||||
var a = new A();
|
||||
Span<A> span = new Span<A>(ref a);
|
||||
var arr = span.ToArray();
|
||||
Sink(arr[0]); // flow
|
||||
}
|
||||
|
||||
public void SpanFillFlow(Span<A> target)
|
||||
{
|
||||
var a = new A();
|
||||
target.Fill(a);
|
||||
Sink(target[0]); // flow
|
||||
}
|
||||
|
||||
public void SpanCopyToFlow(Span<A> target)
|
||||
{
|
||||
var source = new Span<A>(new[] { new A() });
|
||||
source.CopyTo(target);
|
||||
Sink(target[0]); // flow
|
||||
}
|
||||
|
||||
public void ReadOnlySpanConstructorFlow()
|
||||
{
|
||||
var a = new A();
|
||||
ReadOnlySpan<A> span = new ReadOnlySpan<A>(new[] { a });
|
||||
Sink(span[0]); // flow
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,6 +246,33 @@ edges
|
||||
| CollectionFlow.cs:448:21:448:21 | access to local variable a : A | CollectionFlow.cs:448:20:448:22 | [...] : A[] [element] : A |
|
||||
| CollectionFlow.cs:449:22:449:28 | .. access to local variable temp : A[] [element] : A | CollectionFlow.cs:450:14:450:18 | access to local variable array : A[] [element] : A |
|
||||
| CollectionFlow.cs:450:14:450:18 | access to local variable array : A[] [element] : A | CollectionFlow.cs:450:14:450:21 | access to array element |
|
||||
| CollectionFlow.cs:487:17:487:23 | object creation of type A : A | CollectionFlow.cs:488:40:488:40 | access to local variable a : A |
|
||||
| CollectionFlow.cs:488:24:488:41 | object creation of type Span<A> : Span<T> [element] : A | CollectionFlow.cs:489:14:489:17 | access to local variable span : Span<T> [element] : A |
|
||||
| CollectionFlow.cs:488:40:488:40 | access to local variable a : A | CollectionFlow.cs:488:24:488:41 | object creation of type Span<A> : Span<T> [element] : A |
|
||||
| CollectionFlow.cs:489:14:489:17 | access to local variable span : Span<T> [element] : A | CollectionFlow.cs:489:14:489:20 | access to indexer |
|
||||
| CollectionFlow.cs:494:17:494:23 | object creation of type A : A | CollectionFlow.cs:495:40:495:40 | access to local variable a : A |
|
||||
| CollectionFlow.cs:495:24:495:41 | object creation of type Span<A> : Span<T> [element] : A | CollectionFlow.cs:496:19:496:22 | access to local variable span : Span<T> [element] : A |
|
||||
| CollectionFlow.cs:495:40:495:40 | access to local variable a : A | CollectionFlow.cs:495:24:495:41 | object creation of type Span<A> : Span<T> [element] : A |
|
||||
| CollectionFlow.cs:496:19:496:22 | access to local variable span : Span<T> [element] : A | CollectionFlow.cs:496:19:496:32 | call to method ToArray : T[] [element] : A |
|
||||
| CollectionFlow.cs:496:19:496:32 | call to method ToArray : T[] [element] : A | CollectionFlow.cs:497:14:497:16 | access to local variable arr : T[] [element] : A |
|
||||
| CollectionFlow.cs:497:14:497:16 | access to local variable arr : T[] [element] : A | CollectionFlow.cs:497:14:497:19 | access to array element |
|
||||
| CollectionFlow.cs:502:17:502:23 | object creation of type A : A | CollectionFlow.cs:503:21:503:21 | access to local variable a : A |
|
||||
| CollectionFlow.cs:503:9:503:14 | [post] access to parameter target : Span<T> [element] : A | CollectionFlow.cs:504:14:504:19 | access to parameter target : Span<T> [element] : A |
|
||||
| CollectionFlow.cs:503:21:503:21 | access to local variable a : A | CollectionFlow.cs:503:9:503:14 | [post] access to parameter target : Span<T> [element] : A |
|
||||
| CollectionFlow.cs:504:14:504:19 | access to parameter target : Span<T> [element] : A | CollectionFlow.cs:504:14:504:22 | access to indexer |
|
||||
| CollectionFlow.cs:509:22:509:51 | object creation of type Span<A> : Span<T> [element] : A | CollectionFlow.cs:510:9:510:14 | access to local variable source : Span<T> [element] : A |
|
||||
| CollectionFlow.cs:509:34:509:50 | array creation of type A[] : null [element] : A | CollectionFlow.cs:509:22:509:51 | object creation of type Span<A> : Span<T> [element] : A |
|
||||
| CollectionFlow.cs:509:40:509:50 | { ..., ... } : null [element] : A | CollectionFlow.cs:509:34:509:50 | array creation of type A[] : null [element] : A |
|
||||
| CollectionFlow.cs:509:42:509:48 | object creation of type A : A | CollectionFlow.cs:509:40:509:50 | { ..., ... } : null [element] : A |
|
||||
| CollectionFlow.cs:510:9:510:14 | access to local variable source : Span<T> [element] : A | CollectionFlow.cs:510:23:510:28 | [post] access to parameter target : Span<T> [element] : A |
|
||||
| CollectionFlow.cs:510:23:510:28 | [post] access to parameter target : Span<T> [element] : A | CollectionFlow.cs:511:14:511:19 | access to parameter target : Span<T> [element] : A |
|
||||
| CollectionFlow.cs:511:14:511:19 | access to parameter target : Span<T> [element] : A | CollectionFlow.cs:511:14:511:22 | access to indexer |
|
||||
| CollectionFlow.cs:516:17:516:23 | object creation of type A : A | CollectionFlow.cs:517:60:517:60 | access to local variable a : A |
|
||||
| CollectionFlow.cs:517:32:517:63 | object creation of type ReadOnlySpan<A> : ReadOnlySpan<T> [element] : A | CollectionFlow.cs:518:14:518:17 | access to local variable span : ReadOnlySpan<T> [element] : A |
|
||||
| CollectionFlow.cs:517:52:517:62 | array creation of type A[] : null [element] : A | CollectionFlow.cs:517:32:517:63 | object creation of type ReadOnlySpan<A> : ReadOnlySpan<T> [element] : A |
|
||||
| CollectionFlow.cs:517:58:517:62 | { ..., ... } : null [element] : A | CollectionFlow.cs:517:52:517:62 | array creation of type A[] : null [element] : A |
|
||||
| CollectionFlow.cs:517:60:517:60 | access to local variable a : A | CollectionFlow.cs:517:58:517:62 | { ..., ... } : null [element] : A |
|
||||
| CollectionFlow.cs:518:14:518:17 | access to local variable span : ReadOnlySpan<T> [element] : A | CollectionFlow.cs:518:14:518:20 | access to indexer |
|
||||
nodes
|
||||
| CollectionFlow.cs:14:40:14:41 | ts : A[] [element] : A | semmle.label | ts : A[] [element] : A |
|
||||
| CollectionFlow.cs:14:40:14:41 | ts : null [element] : A | semmle.label | ts : null [element] : A |
|
||||
@@ -497,6 +524,38 @@ nodes
|
||||
| CollectionFlow.cs:449:22:449:28 | .. access to local variable temp : A[] [element] : A | semmle.label | .. access to local variable temp : A[] [element] : A |
|
||||
| CollectionFlow.cs:450:14:450:18 | access to local variable array : A[] [element] : A | semmle.label | access to local variable array : A[] [element] : A |
|
||||
| CollectionFlow.cs:450:14:450:21 | access to array element | semmle.label | access to array element |
|
||||
| CollectionFlow.cs:487:17:487:23 | object creation of type A : A | semmle.label | object creation of type A : A |
|
||||
| CollectionFlow.cs:488:24:488:41 | object creation of type Span<A> : Span<T> [element] : A | semmle.label | object creation of type Span<A> : Span<T> [element] : A |
|
||||
| CollectionFlow.cs:488:40:488:40 | access to local variable a : A | semmle.label | access to local variable a : A |
|
||||
| CollectionFlow.cs:489:14:489:17 | access to local variable span : Span<T> [element] : A | semmle.label | access to local variable span : Span<T> [element] : A |
|
||||
| CollectionFlow.cs:489:14:489:20 | access to indexer | semmle.label | access to indexer |
|
||||
| CollectionFlow.cs:494:17:494:23 | object creation of type A : A | semmle.label | object creation of type A : A |
|
||||
| CollectionFlow.cs:495:24:495:41 | object creation of type Span<A> : Span<T> [element] : A | semmle.label | object creation of type Span<A> : Span<T> [element] : A |
|
||||
| CollectionFlow.cs:495:40:495:40 | access to local variable a : A | semmle.label | access to local variable a : A |
|
||||
| CollectionFlow.cs:496:19:496:22 | access to local variable span : Span<T> [element] : A | semmle.label | access to local variable span : Span<T> [element] : A |
|
||||
| CollectionFlow.cs:496:19:496:32 | call to method ToArray : T[] [element] : A | semmle.label | call to method ToArray : T[] [element] : A |
|
||||
| CollectionFlow.cs:497:14:497:16 | access to local variable arr : T[] [element] : A | semmle.label | access to local variable arr : T[] [element] : A |
|
||||
| CollectionFlow.cs:497:14:497:19 | access to array element | semmle.label | access to array element |
|
||||
| CollectionFlow.cs:502:17:502:23 | object creation of type A : A | semmle.label | object creation of type A : A |
|
||||
| CollectionFlow.cs:503:9:503:14 | [post] access to parameter target : Span<T> [element] : A | semmle.label | [post] access to parameter target : Span<T> [element] : A |
|
||||
| CollectionFlow.cs:503:21:503:21 | access to local variable a : A | semmle.label | access to local variable a : A |
|
||||
| CollectionFlow.cs:504:14:504:19 | access to parameter target : Span<T> [element] : A | semmle.label | access to parameter target : Span<T> [element] : A |
|
||||
| CollectionFlow.cs:504:14:504:22 | access to indexer | semmle.label | access to indexer |
|
||||
| CollectionFlow.cs:509:22:509:51 | object creation of type Span<A> : Span<T> [element] : A | semmle.label | object creation of type Span<A> : Span<T> [element] : A |
|
||||
| CollectionFlow.cs:509:34:509:50 | array creation of type A[] : null [element] : A | semmle.label | array creation of type A[] : null [element] : A |
|
||||
| CollectionFlow.cs:509:40:509:50 | { ..., ... } : null [element] : A | semmle.label | { ..., ... } : null [element] : A |
|
||||
| CollectionFlow.cs:509:42:509:48 | object creation of type A : A | semmle.label | object creation of type A : A |
|
||||
| CollectionFlow.cs:510:9:510:14 | access to local variable source : Span<T> [element] : A | semmle.label | access to local variable source : Span<T> [element] : A |
|
||||
| CollectionFlow.cs:510:23:510:28 | [post] access to parameter target : Span<T> [element] : A | semmle.label | [post] access to parameter target : Span<T> [element] : A |
|
||||
| CollectionFlow.cs:511:14:511:19 | access to parameter target : Span<T> [element] : A | semmle.label | access to parameter target : Span<T> [element] : A |
|
||||
| CollectionFlow.cs:511:14:511:22 | access to indexer | semmle.label | access to indexer |
|
||||
| CollectionFlow.cs:516:17:516:23 | object creation of type A : A | semmle.label | object creation of type A : A |
|
||||
| CollectionFlow.cs:517:32:517:63 | object creation of type ReadOnlySpan<A> : ReadOnlySpan<T> [element] : A | semmle.label | object creation of type ReadOnlySpan<A> : ReadOnlySpan<T> [element] : A |
|
||||
| CollectionFlow.cs:517:52:517:62 | array creation of type A[] : null [element] : A | semmle.label | array creation of type A[] : null [element] : A |
|
||||
| CollectionFlow.cs:517:58:517:62 | { ..., ... } : null [element] : A | semmle.label | { ..., ... } : null [element] : A |
|
||||
| CollectionFlow.cs:517:60:517:60 | access to local variable a : A | semmle.label | access to local variable a : A |
|
||||
| CollectionFlow.cs:518:14:518:17 | access to local variable span : ReadOnlySpan<T> [element] : A | semmle.label | access to local variable span : ReadOnlySpan<T> [element] : A |
|
||||
| CollectionFlow.cs:518:14:518:20 | access to indexer | semmle.label | access to indexer |
|
||||
subpaths
|
||||
| CollectionFlow.cs:44:20:44:22 | access to local variable as : null [element] : A | CollectionFlow.cs:22:34:22:35 | ts : null [element] : A | CollectionFlow.cs:22:41:22:45 | access to array element : A | CollectionFlow.cs:44:14:44:23 | call to method First<A> |
|
||||
| CollectionFlow.cs:62:20:62:23 | access to field As : A[] [element] : A | CollectionFlow.cs:22:34:22:35 | ts : A[] [element] : A | CollectionFlow.cs:22:41:22:45 | access to array element : A | CollectionFlow.cs:62:14:62:24 | call to method First<A> |
|
||||
@@ -581,3 +640,8 @@ subpaths
|
||||
| CollectionFlow.cs:427:17:427:23 | object creation of type A : A | CollectionFlow.cs:427:17:427:23 | object creation of type A : A | CollectionFlow.cs:429:14:429:21 | access to array element | $@ | CollectionFlow.cs:429:14:429:21 | access to array element | access to array element |
|
||||
| CollectionFlow.cs:434:17:434:23 | object creation of type A : A | CollectionFlow.cs:434:17:434:23 | object creation of type A : A | CollectionFlow.cs:436:14:436:17 | access to indexer | $@ | CollectionFlow.cs:436:14:436:17 | access to indexer | access to indexer |
|
||||
| CollectionFlow.cs:447:17:447:23 | object creation of type A : A | CollectionFlow.cs:447:17:447:23 | object creation of type A : A | CollectionFlow.cs:450:14:450:21 | access to array element | $@ | CollectionFlow.cs:450:14:450:21 | access to array element | access to array element |
|
||||
| CollectionFlow.cs:487:17:487:23 | object creation of type A : A | CollectionFlow.cs:487:17:487:23 | object creation of type A : A | CollectionFlow.cs:489:14:489:20 | access to indexer | $@ | CollectionFlow.cs:489:14:489:20 | access to indexer | access to indexer |
|
||||
| CollectionFlow.cs:494:17:494:23 | object creation of type A : A | CollectionFlow.cs:494:17:494:23 | object creation of type A : A | CollectionFlow.cs:497:14:497:19 | access to array element | $@ | CollectionFlow.cs:497:14:497:19 | access to array element | access to array element |
|
||||
| CollectionFlow.cs:502:17:502:23 | object creation of type A : A | CollectionFlow.cs:502:17:502:23 | object creation of type A : A | CollectionFlow.cs:504:14:504:22 | access to indexer | $@ | CollectionFlow.cs:504:14:504:22 | access to indexer | access to indexer |
|
||||
| CollectionFlow.cs:509:42:509:48 | object creation of type A : A | CollectionFlow.cs:509:42:509:48 | object creation of type A : A | CollectionFlow.cs:511:14:511:22 | access to indexer | $@ | CollectionFlow.cs:511:14:511:22 | access to indexer | access to indexer |
|
||||
| CollectionFlow.cs:516:17:516:23 | object creation of type A : A | CollectionFlow.cs:516:17:516:23 | object creation of type A : A | CollectionFlow.cs:518:14:518:20 | access to indexer | $@ | CollectionFlow.cs:518:14:518:20 | access to indexer | access to indexer |
|
||||
|
||||
Reference in New Issue
Block a user