mirror of
https://github.com/github/codeql.git
synced 2026-05-05 13:45:19 +02:00
C#: Add ImplicitToString example in nullness tests.
This commit is contained in:
@@ -1451,6 +1451,8 @@
|
||||
| GuardedString.cs:35:31:35:31 | access to local variable s | null | GuardedString.cs:7:20:7:32 | ... ? ... : ... | null |
|
||||
| GuardedString.cs:37:31:37:31 | access to local variable s | non-null | GuardedString.cs:7:20:7:32 | ... ? ... : ... | non-null |
|
||||
| GuardedString.cs:37:31:37:31 | access to local variable s | null | GuardedString.cs:7:20:7:32 | ... ? ... : ... | null |
|
||||
| ImplicitToString.cs:8:23:8:23 | access to local variable o | non-null | ImplicitToString.cs:7:20:7:23 | null | non-null |
|
||||
| ImplicitToString.cs:8:23:8:23 | access to local variable o | null | ImplicitToString.cs:7:20:7:23 | null | null |
|
||||
| NullAlwaysBad.cs:9:17:9:25 | ... != ... | false | NullAlwaysBad.cs:9:17:9:17 | access to parameter s | null |
|
||||
| NullAlwaysBad.cs:9:17:9:25 | ... != ... | true | NullAlwaysBad.cs:9:17:9:17 | access to parameter s | non-null |
|
||||
| NullAlwaysBad.cs:9:17:9:41 | ... \|\| ... | false | NullAlwaysBad.cs:9:17:9:25 | ... != ... | false |
|
||||
|
||||
10
csharp/ql/test/query-tests/Nullness/ImplicitToString.cs
Normal file
10
csharp/ql/test/query-tests/Nullness/ImplicitToString.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
class ImplicitToStringTest
|
||||
{
|
||||
void InterpolatedStringImplicitToString()
|
||||
{
|
||||
object o = null;
|
||||
string s = $"{o}"; // GOOD
|
||||
}
|
||||
}
|
||||
@@ -40,4 +40,5 @@
|
||||
| E.cs:439:13:439:13 | access to parameter s | Variable $@ is always null at this dereference. | E.cs:435:29:435:29 | s | s |
|
||||
| Forwarding.cs:36:31:36:31 | access to local variable s | Variable $@ is always null at this dereference. | Forwarding.cs:7:16:7:16 | s | s |
|
||||
| Forwarding.cs:40:27:40:27 | access to local variable s | Variable $@ is always null at this dereference. | Forwarding.cs:7:16:7:16 | s | s |
|
||||
| ImplicitToString.cs:8:23:8:23 | access to local variable o | Variable $@ is always null at this dereference. | ImplicitToString.cs:7:16:7:16 | o | o |
|
||||
| NullAlwaysBad.cs:9:30:9:30 | access to parameter s | Variable $@ is always null at this dereference. | NullAlwaysBad.cs:7:29:7:29 | s | s |
|
||||
|
||||
@@ -443,6 +443,8 @@ nodes
|
||||
| GuardedString.cs:34:9:37:40 | if (...) ... |
|
||||
| GuardedString.cs:34:26:34:26 | 0 |
|
||||
| GuardedString.cs:35:31:35:31 | access to local variable s |
|
||||
| ImplicitToString.cs:7:16:7:23 | SSA def(o) |
|
||||
| ImplicitToString.cs:8:23:8:23 | access to local variable o |
|
||||
| NullAlwaysBad.cs:7:29:7:29 | SSA param(s) |
|
||||
| NullAlwaysBad.cs:9:30:9:30 | access to parameter s |
|
||||
| NullMaybeBad.cs:7:27:7:27 | access to parameter o |
|
||||
@@ -837,6 +839,7 @@ edges
|
||||
| GuardedString.cs:31:26:31:27 | 10 | GuardedString.cs:34:9:37:40 | if (...) ... |
|
||||
| GuardedString.cs:34:9:37:40 | if (...) ... | GuardedString.cs:34:26:34:26 | 0 |
|
||||
| GuardedString.cs:34:26:34:26 | 0 | GuardedString.cs:35:31:35:31 | access to local variable s |
|
||||
| ImplicitToString.cs:7:16:7:23 | SSA def(o) | ImplicitToString.cs:8:23:8:23 | access to local variable o |
|
||||
| NullAlwaysBad.cs:7:29:7:29 | SSA param(s) | NullAlwaysBad.cs:9:30:9:30 | access to parameter s |
|
||||
| NullMaybeBad.cs:13:17:13:20 | null | NullMaybeBad.cs:7:27:7:27 | access to parameter o |
|
||||
| Params.cs:20:12:20:15 | null | Params.cs:14:17:14:20 | access to parameter args |
|
||||
|
||||
Reference in New Issue
Block a user