mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Merge pull request #20442 from aschackmull/csharp/default-tostring-enum
C#: Exclude enum types as they don't inherit the default toString.
This commit is contained in:
@@ -47,6 +47,7 @@ private predicate alwaysInvokesToString(ParameterRead pr) {
|
||||
*/
|
||||
predicate alwaysDefaultToString(ValueOrRefType t) {
|
||||
not t instanceof TupleType and
|
||||
not t instanceof Enum and
|
||||
exists(ToStringMethod m | t.hasMethod(m) |
|
||||
m.getDeclaringType() instanceof SystemObjectClass or
|
||||
m.getDeclaringType() instanceof SystemValueTypeClass
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
category: minorAnalysis
|
||||
---
|
||||
* The query `cs/call-to-object-tostring` has been improved to remove false positives for enum types.
|
||||
Reference in New Issue
Block a user