Skip to content

Commit d61a674

Browse files
committed
C#: Handle non-unique type arguments when computing generics strings
1 parent 30ab9b7 commit d61a674

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

csharp/ql/lib/semmle/code/csharp/Generics.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,10 @@ private string getTypeArgumentsToString(ConstructedGeneric cg) {
110110
strictconcat(Type t, int i | t = cg.getTypeArgument(i) | t.toStringWithTypes(), ", " order by i)
111111
}
112112

113+
language[monotonicAggregates]
113114
pragma[nomagic]
114115
private string getTypeArgumentName(ConstructedGeneric cg, int i) {
115-
result = cg.getTypeArgument(i).getName()
116+
result = strictconcat(Type t | t = cg.getTypeArgument(i) | t.getName(), "/")
116117
}
117118

118119
/** Gets the concatenation of the `getName()` of type arguments. */

csharp/ql/lib/semmle/code/csharp/commons/QualifiedName.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ module QualifiedName<QualifiedNameInputSig Input> {
4848
)
4949
}
5050

51+
language[monotonicAggregates]
5152
pragma[nomagic]
5253
private string getTypeArgumentsQualifiedName(ConstructedGeneric cg, int i) {
53-
result = getFullName(cg.getTypeArgument(i))
54+
result = strictconcat(Type t | t = cg.getTypeArgument(i) | getFullName(t), "/")
5455
}
5556

5657
/** Gets the concatenation of the `getFullName` of type arguments. */

0 commit comments

Comments
 (0)