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 }
1313
1414func FEmbedded () {
1515
16- x := source ()
17- pkg1Struct := EmbedsPkg1IntStruct {pkg1.IntStruct {x }}
16+ x := source ()
17+ pkg1Struct := EmbedsPkg1IntStruct {pkg1.IntStruct {x }}
1818
19- GEmbedded (& pkg1Struct )
19+ GEmbedded (& pkg1Struct )
2020
2121}
2222
2323func GEmbedded (pkg2Struct * EmbedsPkg2IntStruct ) {
2424
25- sink (pkg2Struct .Field ) // $ hasValueFlow="selection of Field"
25+ sink (pkg2Struct .Field ) // $ hasValueFlow="selection of Field"
2626
2727}
Original file line number Diff line number Diff line change 11package test
22
3- func source () int { return 0 }
4- func sink (value int ) { }
3+ func source () int { return 0 }
4+ func sink (value int ) {}
55
66type IntAlias = int
77type IntStruct = struct { field int }
88type IntAliasStruct = struct { field IntAlias }
99
1010func F () {
1111
12- x := source ()
13- intStruct := IntStruct {x }
12+ x := source ()
13+ intStruct := IntStruct {x }
1414
15- G (& intStruct )
15+ G (& intStruct )
1616
1717}
1818
1919func G (intAliasStruct * IntAliasStruct ) {
2020
21- sink (intAliasStruct .field ) // $ hasValueFlow="selection of field"
21+ sink (intAliasStruct .field ) // $ hasValueFlow="selection of field"
2222
2323}
Original file line number Diff line number Diff line change 11callTargets
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 |
99| test.go:52:2:52:29 | call to ImplementMe | test.go:15:1:15:85 | function declaration | ImplementMe |
1010| test.go:52:2:52:29 | call to ImplementMe | test.go:20:1:20:80 | function declaration | ImplementMe |
1111| 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 {
66 ImplementMe (callable func (struct { x IntAlias }))
77}
88
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 })) {}
1111
1212// Simple direct implementation
1313type Impl1 struct {}
You can’t perform that action at this time.
0 commit comments