Skip to content

Commit df29538

Browse files
committed
C#: Add test that exhibits bug in CSV overrides logic
1 parent 26881ec commit df29538

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

csharp/ql/test/library-tests/dataflow/external-models/Steps.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ void Foo()
4040
var gen = new Generic<int>();
4141
gen.StepGeneric(0);
4242
gen.StepGeneric2(false);
43+
44+
new Sub().StepOverride("string");
4345
}
4446

4547
object StepArgRes(object x) { return null; }
@@ -74,5 +76,15 @@ class Generic<T>
7476

7577
public T StepGeneric2<S>(S s) => throw null;
7678
}
79+
80+
class Base<T>
81+
{
82+
public virtual T StepOverride(T t) => throw null;
83+
}
84+
85+
class Sub : Base<string>
86+
{
87+
public override string StepOverride(string i) => throw null;
88+
}
7789
}
7890
}

csharp/ql/test/library-tests/dataflow/external-models/steps.expected

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ summaryThroughStep
1111
| Steps.cs:41:29:41:29 | 0 | Steps.cs:41:13:41:30 | call to method StepGeneric | true |
1212
| Steps.cs:42:30:42:34 | false | Steps.cs:42:13:42:35 | call to method StepGeneric2 | true |
1313
summaryGetterStep
14-
| Steps.cs:28:13:28:16 | this access | Steps.cs:28:13:28:34 | call to method StepFieldGetter | Steps.cs:55:13:55:17 | field Field |
15-
| Steps.cs:32:13:32:16 | this access | Steps.cs:32:13:32:37 | call to method StepPropertyGetter | Steps.cs:61:13:61:20 | property Property |
14+
| Steps.cs:28:13:28:16 | this access | Steps.cs:28:13:28:34 | call to method StepFieldGetter | Steps.cs:57:13:57:17 | field Field |
15+
| Steps.cs:32:13:32:16 | this access | Steps.cs:32:13:32:37 | call to method StepPropertyGetter | Steps.cs:63:13:63:20 | property Property |
1616
| Steps.cs:36:13:36:16 | this access | Steps.cs:36:13:36:36 | call to method StepElementGetter | file://:0:0:0:0 | element |
1717
summarySetterStep
18-
| Steps.cs:30:34:30:34 | 0 | Steps.cs:30:13:30:16 | [post] this access | Steps.cs:55:13:55:17 | field Field |
19-
| Steps.cs:34:37:34:37 | 0 | Steps.cs:34:13:34:16 | [post] this access | Steps.cs:61:13:61:20 | property Property |
18+
| Steps.cs:30:34:30:34 | 0 | Steps.cs:30:13:30:16 | [post] this access | Steps.cs:57:13:57:17 | field Field |
19+
| Steps.cs:34:37:34:37 | 0 | Steps.cs:34:13:34:16 | [post] this access | Steps.cs:63:13:63:20 | property Property |
2020
| Steps.cs:38:36:38:36 | 0 | Steps.cs:38:13:38:16 | [post] this access | file://:0:0:0:0 | element |

csharp/ql/test/library-tests/dataflow/external-models/steps.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ class SummaryModelTest extends SummaryModelCsv {
2121
"My.Qltest;C;false;StepElementGetter;();;Element of Argument[-1];ReturnValue;value",
2222
"My.Qltest;C;false;StepElementSetter;(System.Int32);;Argument[0];Element of Argument[-1];value",
2323
"My.Qltest;C+Generic<>;false;StepGeneric;(T);;Argument[0];ReturnValue;value",
24-
"My.Qltest;C+Generic<>;false;StepGeneric2;(S);;Argument[0];ReturnValue;value"
24+
"My.Qltest;C+Generic<>;false;StepGeneric2;(S);;Argument[0];ReturnValue;value",
25+
"My.Qltest;C+Base<>;true;StepOverride;(T);;Argument[0];ReturnValue;value"
2526
]
2627
}
2728
}

0 commit comments

Comments
 (0)