kythe.io@v0.0.68-0.20240422202219-7225dbc01741/kythe/go/indexer/testdata/basic/typespec.go (about) 1 // Package tspec tests properties of type declarations. 2 package tspec 3 4 import "fmt" 5 6 // - @Int defines/binding Int 7 // - @"Int int" defines Int 8 // - Int.node/kind record 9 // - Int.subkind type 10 type Int int 11 12 // - @Ptr defines/binding Ptr 13 // - @"Ptr *bool" defines Ptr 14 // - Ptr.node/kind record 15 // - Ptr.subkind type 16 type Ptr *bool 17 18 type under struct{ z int } 19 20 // - @Over defines/binding Over 21 // - Over.node/kind record 22 // - Over.subkind struct 23 type Over under 24 25 // - @UPtr defines/binding UPtr 26 // - UPtr.node/kind record 27 // - UPtr.subkind type 28 type UPtr *under 29 30 // - @Struct defines/binding Struct 31 // - Struct.node/kind record 32 // - Struct.subkind struct 33 type Struct struct { 34 //- @Alpha defines/binding Alpha 35 //- Alpha.node/kind variable 36 //- Alpha.subkind field 37 //- Alpha childof Struct 38 Alpha string 39 40 //- @Bravo defines/binding Bravo 41 //- Bravo.node/kind variable 42 //- Bravo.subkind field 43 //- Bravo childof Struct 44 Bravo int 45 } 46 47 // - @Embed defines/binding Embed 48 // - Embed.node/kind record 49 // - Embed.subkind struct 50 type Embed struct { 51 // An embedded type from this package. 52 // 53 //- @"Struct" defines/binding EmbedStruct 54 //- EmbedStruct.node/kind variable 55 //- EmbedStruct.subkind field 56 //- @"Struct" ref Struct 57 Struct 58 59 // An embedded pointer type. 60 // 61 //- @"float64" defines/binding EmbedFloat 62 //- EmbedFloat.node/kind variable 63 //- EmbedFloat.subkind field 64 *float64 65 66 // A type from another package. 67 // 68 //- @"Stringer" defines/binding FmtStringer 69 //- FmtStringer.node/kind variable 70 //- FmtStringer.subkind field 71 fmt.Stringer 72 73 // A regular field mixed with the above. 74 // 75 //- @Velocipede defines/binding Velo 76 //- Velo.node/kind variable 77 //- Velo.subkind field 78 Velocipede struct{} 79 } 80 81 // - @Thinger defines/binding Thinger 82 // - Thinger.node/kind interface 83 type Thinger interface { 84 //- @Thing defines/binding Thing 85 //- Thing.node/kind function 86 //- Thing childof Thinger 87 //- @param defines/binding Param 88 //- Param childof Thing 89 Thing(param int) 90 } 91 92 // - @Extender defines/binding Extender 93 // - Extender.node/kind interface 94 // - Extender extends Thinger 95 type Extender interface { 96 Thinger 97 98 //- @Extend defines/binding Extend 99 //- Extend.node/kind function 100 //- Extend childof Extender 101 Extend() 102 }