Debian Codegraph @

test/fixedbugs/issue23734.go

raw
1 // run
2
3 // Copyright 2018 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 main() {
10 m := map[interface{}]int{}
11 k := []int{}
12
13 mustPanic(func() {
14 _ = m[k]
15 })
16 mustPanic(func() {
17 _, _ = m[k]
18 })
19 mustPanic(func() {
20 delete(m, k)
21 })
22 }
23
24 func mustPanic(f func()) {
25 defer func() {
26 r := recover()
27 if r == nil {
28 panic("didn't panic")
29 }
30 }()
31 f()
32 }