C#: Convert cs/gethashcode-is-not-defined to inline expectations tests.

This commit is contained in:
Michael Nebel
2025-05-15 13:35:08 +02:00
parent e4b7b914b2
commit 2c5d85e186
3 changed files with 7 additions and 4 deletions

View File

@@ -6,9 +6,10 @@ public class Test
public void M()
{
var h = new Hashtable();
h.Add(this, null); // BAD
h.Add(this, null); // $ Alert
var d = new Dictionary<Test, bool>();
d.Add(this, false); // BAD
d.Add(this, false); // $ Alert
}
public override bool Equals(object other)

View File

@@ -1,2 +1,2 @@
| HashedButNoHash.cs:9:15:9:18 | this access | This expression is hashed, but type 'Test' only defines Equals(...) not GetHashCode(). |
| HashedButNoHash.cs:11:15:11:18 | this access | This expression is hashed, but type 'Test' only defines Equals(...) not GetHashCode(). |
| HashedButNoHash.cs:12:15:12:18 | this access | This expression is hashed, but type 'Test' only defines Equals(...) not GetHashCode(). |

View File

@@ -1 +1,3 @@
Likely Bugs/HashedButNoHash.ql
query: Likely Bugs/HashedButNoHash.ql
postprocess: utils/test/InlineExpectationsTestQuery.ql