1 | // +build ignore |
---|---|
2 | |
3 | package main |
4 | |
5 | // Test of runtime types (types for which descriptors are needed). |
6 | |
7 | func use(interface{}) |
8 | |
9 | type A byte // neither A nor byte are runtime types |
10 | |
11 | type B struct{ x uint } // B and uint are runtime types, but not the struct |
12 | |
13 | func main() { |
14 | var x int // not a runtime type |
15 | print(x) |
16 | |
17 | var y string // runtime type due to interface conversion |
18 | use(y) |
19 | |
20 | use(struct{ uint64 }{}) // struct is a runtime type |
21 | |
22 | use(new(B)) // *B is a runtime type |
23 | } |
24 | |
25 | // WANT: |
26 | // Dynamic calls |
27 | // Reachable functions |
28 | // use |
29 | // Reflect types |
30 | // *B |
31 | // B |
32 | // string |
33 | // struct{uint64} |
34 | // uint |
35 | // uint64 |
36 |