File tree Expand file tree Collapse file tree 4 files changed +19
-19
lines changed
go/ql/test/library-tests/semmle/go/aliases Expand file tree Collapse file tree 4 files changed +19
-19
lines changed Original file line number Diff line number Diff line change @@ -13,15 +13,15 @@ type EmbedsPkg2IntStruct = struct{ pkg2.IntStruct }
13
13
14
14
func FEmbedded () {
15
15
16
- x := source ()
17
- pkg1Struct := EmbedsPkg1IntStruct {pkg1.IntStruct {x }}
16
+ x := source ()
17
+ pkg1Struct := EmbedsPkg1IntStruct {pkg1.IntStruct {x }}
18
18
19
- GEmbedded (& pkg1Struct )
19
+ GEmbedded (& pkg1Struct )
20
20
21
21
}
22
22
23
23
func GEmbedded (pkg2Struct * EmbedsPkg2IntStruct ) {
24
24
25
- sink (pkg2Struct .Field ) // $ hasValueFlow="selection of Field"
25
+ sink (pkg2Struct .Field ) // $ hasValueFlow="selection of Field"
26
26
27
27
}
Original file line number Diff line number Diff line change 1
1
package test
2
2
3
- func source () int { return 0 }
4
- func sink (value int ) { }
3
+ func source () int { return 0 }
4
+ func sink (value int ) {}
5
5
6
6
type IntAlias = int
7
7
type IntStruct = struct { field int }
8
8
type IntAliasStruct = struct { field IntAlias }
9
9
10
10
func F () {
11
11
12
- x := source ()
13
- intStruct := IntStruct {x }
12
+ x := source ()
13
+ intStruct := IntStruct {x }
14
14
15
- G (& intStruct )
15
+ G (& intStruct )
16
16
17
17
}
18
18
19
19
func G (intAliasStruct * IntAliasStruct ) {
20
20
21
- sink (intAliasStruct .field ) // $ hasValueFlow="selection of field"
21
+ sink (intAliasStruct .field ) // $ hasValueFlow="selection of field"
22
22
23
23
}
Original file line number Diff line number Diff line change 1
1
callTargets
2
- | test.go:15:70:15:83 | call to sink | test.go:10:1:10:46 | function declaration | sink |
3
- | test.go:20:65:20:78 | call to sink | test.go:10:1:10:46 | function declaration | sink |
4
- | test.go:27:54:27:67 | call to sink | test.go:10:1:10:46 | function declaration | sink |
5
- | test.go:34:60:34:73 | call to sink | test.go:10:1:10:46 | function declaration | sink |
6
- | test.go:41:72:41:85 | call to sink | test.go:10:1:10:46 | function declaration | sink |
7
- | test.go:48:70:48:83 | call to sink | test.go:10:1:10:46 | function declaration | sink |
8
- | test.go:51:14:51:21 | call to source | test.go:9:1:9:55 | function declaration | source |
2
+ | test.go:15:70:15:83 | call to sink | test.go:10:1:10:45 | function declaration | sink |
3
+ | test.go:20:65:20:78 | call to sink | test.go:10:1:10:45 | function declaration | sink |
4
+ | test.go:27:54:27:67 | call to sink | test.go:10:1:10:45 | function declaration | sink |
5
+ | test.go:34:60:34:73 | call to sink | test.go:10:1:10:45 | function declaration | sink |
6
+ | test.go:41:72:41:85 | call to sink | test.go:10:1:10:45 | function declaration | sink |
7
+ | test.go:48:70:48:83 | call to sink | test.go:10:1:10:45 | function declaration | sink |
8
+ | test.go:51:14:51:21 | call to source | test.go:9:1:9:57 | function declaration | source |
9
9
| test.go:52:2:52:29 | call to ImplementMe | test.go:15:1:15:85 | function declaration | ImplementMe |
10
10
| test.go:52:2:52:29 | call to ImplementMe | test.go:20:1:20:80 | function declaration | ImplementMe |
11
11
| test.go:52:2:52:29 | call to ImplementMe | test.go:27:1:27:69 | function declaration | ImplementMe |
Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ type Target = interface {
6
6
ImplementMe (callable func (struct { x IntAlias }))
7
7
}
8
8
9
- func source () func (struct { x IntAlias }) { return nil }
10
- func sink (fptr func (struct { x IntAlias })) { }
9
+ func source () func (struct { x IntAlias }) { return nil }
10
+ func sink (fptr func (struct { x IntAlias })) {}
11
11
12
12
// Simple direct implementation
13
13
type Impl1 struct {}
You can’t perform that action at this time.
0 commit comments