Skip to content

Commit 4711feb

Browse files
committed
Add test for DefinedType.getBaseType
1 parent 4000084 commit 4711feb

File tree

2 files changed

+117
-0
lines changed

2 files changed

+117
-0
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
| aliases.go:19:6:19:7 | S3 | struct { x int } |
2+
| aliases.go:29:6:29:11 | MyType | struct { x MyTypeT } |
3+
| cyclic.go:3:6:3:6 | s | struct { * s } |
4+
| cyclic.go:7:6:7:6 | t | struct { * u; f int } |
5+
| cyclic.go:12:6:12:6 | u | struct { t } |
6+
| cyclic.go:16:6:16:6 | v | struct { s } |
7+
| depth.go:5:6:5:6 | a | struct { b; c } |
8+
| depth.go:10:6:10:6 | b | struct { f int } |
9+
| depth.go:14:6:14:6 | c | struct { d } |
10+
| depth.go:18:6:18:6 | d | struct { f string } |
11+
| embedded.go:3:6:3:8 | Baz | struct { A string } |
12+
| embedded.go:7:6:7:8 | Qux | struct { * Baz } |
13+
| embedded.go:11:6:11:14 | EmbedsBaz | struct { Qux; Baz string } |
14+
| generic.go:3:6:3:19 | GenericStruct1 | struct { valueField T; pointerField * T; arrayField [10]T; sliceField []T; mapField [string]T } |
15+
| generic.go:11:6:11:27 | CircularGenericStruct1 | struct { pointerField * CircularGenericStruct1 } |
16+
| generic.go:15:6:15:31 | UsesCircularGenericStruct1 | struct { root CircularGenericStruct1 } |
17+
| generic.go:19:6:19:19 | GenericStruct2 | struct { structField GenericStruct1; mapField [S]T } |
18+
| generic.go:24:6:24:20 | GenericStruct2b | struct { structField GenericStruct2 } |
19+
| generic.go:28:6:28:27 | CircularGenericStruct2 | struct { pointerField * CircularGenericStruct2 } |
20+
| generic.go:32:6:32:21 | GenericInterface | interface { GetT func() T } |
21+
| generic.go:36:6:36:17 | GenericArray | [10]T |
22+
| generic.go:37:6:37:19 | GenericPointer | * T |
23+
| generic.go:38:6:38:17 | GenericSlice | []T |
24+
| generic.go:39:6:39:16 | GenericMap1 | [string]V |
25+
| generic.go:40:6:40:16 | GenericMap2 | [K]V |
26+
| generic.go:41:6:41:19 | GenericChannel | chan<- T |
27+
| generic.go:42:6:42:14 | MyMapType | [string]int |
28+
| generic.go:43:6:43:19 | GenericDefined | MyMapType |
29+
| generic.go:44:6:44:16 | MyFuncType1 | func(T) |
30+
| generic.go:45:6:45:16 | MyFuncType2 | func(T1) T2 |
31+
| generic.go:47:6:47:16 | MyInterface | interface { clone func() MyInterface; dummy1 func() [10]U; dummy11 func() GenericArray; dummy12 func() GenericPointer; dummy13 func() GenericSlice; dummy14 func() GenericMap1; dummy15 func() GenericMap2; dummy17 func() GenericChannel; dummy18 func() GenericDefined; dummy19 func() MyFuncType1; dummy2 func() * U; dummy20 func() MyFuncType2; dummy3 func() []U; dummy4 func() [U]U; dummy5 func() chan<- U; dummy6 func() MyMapType; dummy7 func() MyFuncType2 } |
32+
| generic.go:67:6:67:22 | HasBlankTypeParam | struct { } |
33+
| generic.go:68:6:68:23 | HasBlankTypeParams | struct { } |
34+
| generic.go:84:6:84:21 | GenericSignature | func(T) T |
35+
| interface.go:3:6:3:7 | i0 | comparable |
36+
| interface.go:5:6:5:7 | i1 | interface { int } |
37+
| interface.go:9:6:9:7 | i2 | interface { ~string } |
38+
| interface.go:13:6:13:7 | i3 | interface { [5]int \| ~string } |
39+
| interface.go:18:6:18:7 | i4 | interface { i1 \| i2 \| float32 } |
40+
| interface.go:23:6:23:7 | i5 | interface { []uint8; int \| ~[]uint8 } |
41+
| interface.go:28:6:28:7 | i6 | interface { ~[]int \| ~string; String func() string } |
42+
| interface.go:34:6:34:7 | i7 | interface { [5]int \| ~string; ~string; String func() string } |
43+
| interface.go:41:6:41:7 | i8 | interface { ~[]int \| ~string; String func() string; StringA func() string } |
44+
| interface.go:47:6:47:7 | i9 | interface { ~[]int \| ~string; String func() string; StringB func() string } |
45+
| interface.go:52:6:52:8 | i10 | interface { } |
46+
| interface.go:57:6:57:8 | i11 | interface { [5]uint8 \| string; int } |
47+
| interface.go:63:6:63:8 | i12 | interface { []uint8 \| string } |
48+
| interface.go:69:6:69:8 | i13 | interface { []uint8 \| string } |
49+
| interface.go:75:6:75:8 | i14 | interface { []uint8 \| string; ~[]int \| ~string; String func() string; StringA func() string } |
50+
| interface.go:81:6:81:8 | i15 | interface { []uint8 \| string; ~[]int \| ~string; String func() string; StringB func() string } |
51+
| interface.go:87:6:87:8 | i16 | interface { } |
52+
| interface.go:91:6:91:8 | i17 | interface { StringA func() string } |
53+
| interface.go:95:6:95:8 | i18 | interface { StringA func() string } |
54+
| interface.go:101:6:101:8 | i19 | interface { StringB func() string } |
55+
| interface.go:105:6:105:8 | i20 | interface { StringB func() string } |
56+
| interface.go:114:6:114:19 | testComparable | struct { } |
57+
| interface.go:115:6:115:20 | testComparable0 | struct { } |
58+
| interface.go:116:6:116:20 | testComparable1 | struct { } |
59+
| interface.go:117:6:117:20 | testComparable2 | struct { } |
60+
| interface.go:118:6:118:20 | testComparable3 | struct { } |
61+
| interface.go:119:6:119:20 | testComparable4 | struct { } |
62+
| interface.go:120:6:120:20 | testComparable5 | struct { } |
63+
| interface.go:121:6:121:20 | testComparable6 | struct { } |
64+
| interface.go:122:6:122:20 | testComparable7 | struct { } |
65+
| interface.go:123:6:123:20 | testComparable8 | struct { } |
66+
| interface.go:124:6:124:20 | testComparable9 | struct { } |
67+
| interface.go:125:6:125:21 | testComparable10 | struct { } |
68+
| interface.go:126:6:126:21 | testComparable11 | struct { } |
69+
| interface.go:127:6:127:21 | testComparable12 | struct { } |
70+
| interface.go:128:6:128:21 | testComparable13 | struct { } |
71+
| interface.go:129:6:129:21 | testComparable14 | struct { } |
72+
| interface.go:130:6:130:21 | testComparable15 | struct { } |
73+
| interface.go:131:6:131:21 | testComparable16 | struct { } |
74+
| interface.go:132:6:132:21 | testComparable17 | struct { } |
75+
| interface.go:133:6:133:21 | testComparable18 | struct { } |
76+
| interface.go:134:6:134:21 | testComparable19 | struct { } |
77+
| interface.go:135:6:135:21 | testComparable20 | struct { } |
78+
| interface.go:136:6:136:21 | testComparable21 | struct { } |
79+
| interface.go:137:6:137:21 | testComparable22 | struct { } |
80+
| interface.go:138:6:138:21 | testComparable23 | struct { } |
81+
| main.go:17:6:17:20 | EmbedsNameClash | struct { NameClash } |
82+
| pkg1/embedding.go:8:6:8:9 | base | struct { } |
83+
| pkg1/embedding.go:19:6:19:13 | embedder | struct { base } |
84+
| pkg1/embedding.go:22:6:22:16 | ptrembedder | struct { * base } |
85+
| pkg1/embedding.go:25:6:25:14 | embedder2 | struct { embedder } |
86+
| pkg1/embedding.go:28:6:28:14 | embedder3 | struct { embedder } |
87+
| pkg1/embedding.go:35:6:35:14 | embedder4 | struct { base; f int } |
88+
| pkg1/interfaces.go:3:6:3:6 | A | interface { m func() } |
89+
| pkg1/interfaces.go:7:6:7:6 | B | interface { m func() ; n func() } |
90+
| pkg1/interfaces.go:12:6:12:6 | C | interface { n func() ; o func() } |
91+
| pkg1/interfaces.go:17:6:17:14 | AEmbedded | interface { m func() } |
92+
| pkg1/interfaces.go:21:6:21:7 | AC | interface { m func() ; n func() ; o func() } |
93+
| pkg1/interfaces.go:26:6:26:14 | AExtended | interface { m func() ; n func() } |
94+
| pkg1/interfaces.go:31:6:31:7 | A2 | interface { m func() } |
95+
| pkg1/interfaces.go:35:6:35:24 | MixedExportedAndNot | interface { Exported func() ; notExported func() } |
96+
| pkg1/promotedStructs.go:4:6:4:6 | S | struct { SField string } |
97+
| pkg1/promotedStructs.go:13:6:13:6 | P | struct { PField string } |
98+
| pkg1/promotedStructs.go:22:6:22:12 | SEmbedS | struct { S } |
99+
| pkg1/promotedStructs.go:25:6:25:12 | SEmbedP | struct { P } |
100+
| pkg1/tst.go:5:6:5:6 | T | struct { f int; Foo; Bar } |
101+
| pkg1/tst.go:11:6:11:7 | T2 | struct { Foo Foo; Bar } |
102+
| pkg1/tst.go:16:6:16:7 | T3 | struct { * Foo; * Bar } |
103+
| pkg1/tst.go:21:6:21:7 | T4 | struct { * Foo; Bar Bar } |
104+
| pkg1/tst.go:26:6:26:8 | Foo | struct { val int; flag bool } |
105+
| pkg1/tst.go:31:6:31:8 | Bar | struct { flag bool } |
106+
| pkg1/tst.go:61:6:61:14 | NameClash | struct { NameClash } |
107+
| pkg2/tst.go:3:6:3:6 | T | struct { g int } |
108+
| pkg2/tst.go:7:6:7:6 | G | struct { g int } |
109+
| pkg2/tst.go:11:6:11:24 | MixedExportedAndNot | interface { Exported func() ; notExported func() } |
110+
| pkg2/tst.go:16:6:16:14 | NameClash | struct { NCField string } |
111+
| struct_tags.go:3:6:3:7 | S1 | struct { field1 int `tag1a`; field2 int `tag2a` } |
112+
| struct_tags.go:8:6:8:7 | S2 | struct { field1 int `tag1b`; field2 int `tag2b` } |
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import go
2+
3+
from DefinedType dt, Type tp
4+
where tp = dt.getBaseType()
5+
select dt, tp.pp()

0 commit comments

Comments
 (0)