Skip to content

Commit 0ed2ab6

Browse files
committed
Add tests showing bug
1 parent 88df73a commit 0ed2ab6

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

‎go/ql/test/query-tests/RedundantCode/UnreachableStatement/CONSISTENCY/CfgConsistency.expected‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
consistencyOverview
2-
| deadEnd | 10 |
2+
| deadEnd | 11 |
33
deadEnd
44
| main.go:17:2:17:10 | select statement |
55
| main.go:109:2:109:10 | select statement |
@@ -11,3 +11,4 @@ deadEnd
1111
| main.go:151:2:151:10 | select statement |
1212
| main.go:157:2:157:10 | select statement |
1313
| main.go:164:2:164:10 | select statement |
14+
| main.go:168:2:168:10 | select statement |

‎go/ql/test/query-tests/RedundantCode/UnreachableStatement/main.go‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,19 @@ func test20() {
164164
select {} // OK: reachable after starting the goroutine
165165
}
166166

167+
func test21() {
168+
select {}
169+
panic("unreachable") // OK: allowlisted statement
170+
// OK: empty statement
171+
unreachable() // $ MISSING: Alert
172+
}
173+
174+
func test23() {
175+
if true {
176+
return
177+
}
178+
unreachable() // OK: deliberately unreachable
179+
unreachable() // OK: deliberately unreachable
180+
}
181+
167182
func main() {}

0 commit comments

Comments
 (0)