modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/issue19028.dir/main.go (about) 1 // Copyright 2017 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package main 6 7 import ( 8 "reflect" 9 fake "./reflect" // 2nd package with name "reflect" 10 ) 11 12 type T struct { 13 _ fake.Type 14 } 15 16 func (T) f() {} 17 func (T) G() (_ int) { return } 18 func (T) H() (_, _ int) { return } 19 20 func main() { 21 var x T 22 typ := reflect.TypeOf(x) 23 for i := 0; i < typ.NumMethod(); i++ { 24 _ = typ.Method(i) // must not crash 25 } 26 }