File tree Expand file tree Collapse file tree
go/ql/test/query-tests/RedundantCode/UnreachableStatement Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11consistencyOverview
2- | deadEnd | 11 |
2+ | deadEnd | 12 |
3+ | missingInNodeForPostOrInOrder | 1 |
34deadEnd
45| main.go:17:2:17:10 | select statement |
56| main.go:109:2:109:10 | select statement |
@@ -12,3 +13,6 @@ deadEnd
1213| main.go:157:2:157:10 | select statement |
1314| main.go:164:2:164:10 | select statement |
1415| main.go:168:2:168:10 | select statement |
16+ | main.go:200:5:200:11 | implicit-field:0 selection of value |
17+ missingInNodeForPostOrInOrder
18+ | main.go:200:5:200:11 | selection of value |
Original file line number Diff line number Diff line change 1111| main.go:153:2:153:22 | return statement | This statement is unreachable. |
1212| main.go:159:2:159:43 | return statement | This statement is unreachable. |
1313| main.go:171:2:171:14 | expression statement | This statement is unreachable. |
14+ | main.go:203:2:203:14 | return statement | This statement is unreachable. |
Original file line number Diff line number Diff line change @@ -186,4 +186,21 @@ func test23() {
186186 unreachable () // OK: deliberately unreachable
187187}
188188
189+ type (
190+ embedded struct {}
191+ recursive struct {
192+ * embedded
193+ value int
194+ * recursive
195+ }
196+ )
197+
198+ func test24 (x * recursive ) []int {
199+ values := []int {0 }
200+ if x .value != 0 {
201+ values = append (values , x .value )
202+ }
203+ return values // $ SPURIOUS: Alert // BUG: reachable because value is a direct field of recursive
204+ }
205+
189206func main () {}
You can’t perform that action at this time.
0 commit comments