File tree Expand file tree Collapse file tree 2 files changed +82
-84
lines changed
csharp/ql/test/library-tests/dataflow/fields Expand file tree Collapse file tree 2 files changed +82
-84
lines changed Original file line number Diff line number Diff line change 1
- public class C_no_ctor
1
+ public class Constructors
2
2
{
3
- private Elem s1 = Util . Source < Elem > ( 1 ) ;
4
-
5
- void M1 ( )
3
+ public class C_no_ctor
6
4
{
7
- C_no_ctor c = new C_no_ctor ( ) ;
8
- c . M2 ( ) ;
5
+ private object s1 = Source < object > ( 1 ) ;
6
+
7
+ void M1 ( )
8
+ {
9
+ C_no_ctor c = new C_no_ctor ( ) ;
10
+ c . M2 ( ) ;
11
+ }
12
+
13
+ public void M2 ( )
14
+ {
15
+ Sink ( s1 ) ; // $ hasValueFlow=1
16
+ }
9
17
}
10
18
11
- public void M2 ( )
19
+ public class C_with_ctor
12
20
{
13
- Util . Sink ( s1 ) ; // $ hasValueFlow=1
14
- }
15
- }
21
+ private object s1 = Source < object > ( 1 ) ;
16
22
17
- public class C_with_ctor
18
- {
19
- private Elem s1 = Util . Source < Elem > ( 1 ) ;
23
+ void M1 ( )
24
+ {
25
+ C_with_ctor c = new C_with_ctor ( ) ;
26
+ c . M2 ( ) ;
27
+ }
20
28
21
- void M1 ( )
22
- {
23
- C_with_ctor c = new C_with_ctor ( ) ;
24
- c . M2 ( ) ;
25
- }
29
+ public C_with_ctor ( ) { }
26
30
27
- public C_with_ctor ( ) { }
28
-
29
- public void M2 ( )
30
- {
31
- Util . Sink ( s1 ) ; // $ hasValueFlow=1
31
+ public void M2 ( )
32
+ {
33
+ Sink ( s1 ) ; // $ hasValueFlow=1
34
+ }
32
35
}
33
- }
34
36
35
- class Util
36
- {
37
37
public static void Sink ( object o ) { }
38
38
39
39
public static T Source < T > ( object source ) => throw null ;
40
40
}
41
-
42
- public class Elem { }
You can’t perform that action at this time.
0 commit comments