File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
csharp/ql/src/Useless code Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ private predicate alwaysInvokesToString(ParameterRead pr) {
46
46
* method from `System.Object` or `System.ValueType`.
47
47
*/
48
48
predicate alwaysDefaultToString ( ValueOrRefType t ) {
49
+ not t instanceof TupleType and
49
50
exists ( ToStringMethod m | t .hasMethod ( m ) |
50
51
m .getDeclaringType ( ) instanceof SystemObjectClass or
51
52
m .getDeclaringType ( ) instanceof SystemValueTypeClass
@@ -55,6 +56,11 @@ predicate alwaysDefaultToString(ValueOrRefType t) {
55
56
overriding .getABaseType + ( ) = t
56
57
) and
57
58
( ( t .isAbstract ( ) or t instanceof Interface ) implies not t .isEffectivelyPublic ( ) )
59
+ or
60
+ exists ( ValueOrRefType elem |
61
+ elem = t .( TupleType ) .getElementType ( _) and
62
+ alwaysDefaultToString ( elem )
63
+ )
58
64
}
59
65
60
66
class DefaultToStringType extends ValueOrRefType {
You can’t perform that action at this time.
0 commit comments