File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed
csharp/ql/lib/semmle/code/csharp Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,8 @@ private class ParamsConstructedCollectionTypes extends ParamsCollectionTypeImpl
97
97
unboundbase instanceof SystemCollectionsGenericIReadOnlyListTInterface or
98
98
unboundbase instanceof SystemSpanStruct or
99
99
unboundbase instanceof SystemReadOnlySpanStruct
100
- )
100
+ ) and
101
+ not this instanceof SystemStringClass
101
102
}
102
103
103
104
override Type getElementType ( ) { result = base .getTypeArgument ( 0 ) }
Original file line number Diff line number Diff line change @@ -250,19 +250,31 @@ class FormatCall extends MethodCall {
250
250
/** Holds if this call has one or more insertions. */
251
251
predicate hasInsertions ( ) { exists ( this .getArgument ( this .getFirstArgument ( ) ) ) }
252
252
253
- /** Holds if the arguments are supplied in an array, not individually. */
254
- predicate hasArrayExpr ( ) {
253
+ /**
254
+ * DEPRECATED: use `hasCollectionExpr` instead.
255
+ *
256
+ * Holds if the arguments are supplied in an array, not individually.
257
+ */
258
+ deprecated predicate hasArrayExpr ( ) {
255
259
this .getNumberOfArguments ( ) = this .getFirstArgument ( ) + 1 and
256
260
this .getArgument ( this .getFirstArgument ( ) ) .getType ( ) instanceof ArrayType
257
261
}
258
262
263
+ /**
264
+ * Holds if the arguments are supplied in a collection, not individually.
265
+ */
266
+ predicate hasCollectionExpr ( ) {
267
+ this .getNumberOfArguments ( ) = this .getFirstArgument ( ) + 1 and
268
+ this .getArgument ( this .getFirstArgument ( ) ) .getType ( ) instanceof ParamsCollectionType
269
+ }
270
+
259
271
/**
260
272
* Gets the number of supplied arguments (excluding the format string and format
261
273
* provider). Does not return a value if the arguments are supplied in an array,
262
274
* in which case we generally can't assess the size of the array.
263
275
*/
264
276
int getSuppliedArguments ( ) {
265
- not this .hasArrayExpr ( ) and
277
+ not this .hasCollectionExpr ( ) and
266
278
result = this .getNumberOfArguments ( ) - this .getFirstArgument ( )
267
279
}
268
280
You can’t perform that action at this time.
0 commit comments