File tree Expand file tree Collapse file tree
csharp/ql/test/query-tests/Nullness Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -264,11 +264,20 @@ public void Access()
264264 temp = sa . Length ; // BAD (always), but not first
265265 }
266266
267+ public void CompoundAssignment ( )
268+ {
269+ C c1 = null ;
270+ C c2 = new C ( true ) ;
271+ c1 += c2 ; // $ Alert[cs/dereferenced-value-is-always-null]
272+ }
273+
267274 bool m ;
268275 C ( bool m )
269276 {
270277 this . m = m ;
271278 }
272279
273280 bool Maybe ( ) => this . m ;
281+
282+ public void operator + = ( C other ) { }
274283}
Original file line number Diff line number Diff line change 2424| C.cs:249:9:249:9 | access to local variable a | Variable $@ is always null at this dereference. | C.cs:248:15:248:15 | a | a |
2525| C.cs:260:9:260:10 | access to local variable ia | Variable $@ is always null at this dereference. | C.cs:257:15:257:16 | ia | ia |
2626| C.cs:261:20:261:21 | access to local variable sa | Variable $@ is always null at this dereference. | C.cs:258:18:258:19 | sa | sa |
27+ | C.cs:271:9:271:10 | access to local variable c1 | Variable $@ is always null at this dereference. | C.cs:269:11:269:12 | c1 | c1 |
2728| D.cs:120:13:120:13 | access to local variable x | Variable $@ is always null at this dereference. | D.cs:117:13:117:13 | x | x |
2829| D.cs:197:13:197:13 | access to local variable o | Variable $@ is always null at this dereference. | D.cs:195:13:195:13 | o | o |
2930| D.cs:207:17:207:17 | access to local variable e | Variable $@ is always null at this dereference. | D.cs:204:26:204:26 | e | e |
You can’t perform that action at this time.
0 commit comments