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
9797 unboundbase instanceof SystemCollectionsGenericIReadOnlyListTInterface or
9898 unboundbase instanceof SystemSpanStruct or
9999 unboundbase instanceof SystemReadOnlySpanStruct
100- )
100+ ) and
101+ not this instanceof SystemStringClass
101102 }
102103
103104 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 {
250250 /** Holds if this call has one or more insertions. */
251251 predicate hasInsertions ( ) { exists ( this .getArgument ( this .getFirstArgument ( ) ) ) }
252252
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 ( ) {
255259 this .getNumberOfArguments ( ) = this .getFirstArgument ( ) + 1 and
256260 this .getArgument ( this .getFirstArgument ( ) ) .getType ( ) instanceof ArrayType
257261 }
258262
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+
259271 /**
260272 * Gets the number of supplied arguments (excluding the format string and format
261273 * provider). Does not return a value if the arguments are supplied in an array,
262274 * in which case we generally can't assess the size of the array.
263275 */
264276 int getSuppliedArguments ( ) {
265- not this .hasArrayExpr ( ) and
277+ not this .hasCollectionExpr ( ) and
266278 result = this .getNumberOfArguments ( ) - this .getFirstArgument ( )
267279 }
268280
You can’t perform that action at this time.
0 commit comments