Debian Codegraph @

test/fixedbugs/issue73916b.go

raw
1 // run
2
3 // Copyright 2025 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
6
7 package main
8
9 func callRecover() {
10 func() {
11 if recover() != nil {
12 println("recovered")
13 }
14 }()
15 }
16
17 func F() int { callRecover(); return 0 }
18
19 func main() {
20 mustPanic(func() {
21 defer F()
22 panic("XXX")
23 })
24 }
25
26 func mustPanic(f func()) {
27 defer func() {
28 r := recover()
29 if r == nil {
30 panic("didn't panic")
31 }
32 }()
33 f()
34 }