]> Cypherpunks.ru repositories - gostls13.git/blob - test/fixedbugs/gcc65755.go
all: make copyright headers consistent with one space after period
[gostls13.git] / test / fixedbugs / gcc65755.go
1 // run
2
3 // Copyright 2015 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 // PR65755: Incorrect type descriptor for type defined within method.
8
9 package main
10
11 import "reflect"
12
13 type S1 struct{}
14
15 func (S1) Fix() string {
16         type s struct {
17                 f int
18         }
19         return reflect.TypeOf(s{}).Field(0).Name
20 }
21
22 type S2 struct{}
23
24 func (S2) Fix() string {
25         type s struct {
26                 g bool
27         }
28         return reflect.TypeOf(s{}).Field(0).Name
29 }
30
31 func main() {
32         f1 := S1{}.Fix()
33         f2 := S2{}.Fix()
34         if f1 != "f" || f2 != "g" {
35                 panic(f1 + f2)
36         }
37 }