1 /*
2 * Copyright 2022 Google LLC
3 * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 // TEST PROCESSOR: ParentProcessor
19 // EXPECTED:
20 // parent of File: a.kt: null
21 // parent of Any: Anno
22 // parent of Anno: File: a.kt
23 // parent of Anno: synthetic constructor for Anno
24 // parent of synthetic constructor for Anno: Anno
25 // parent of Int: Int
26 // parent of Int: INVARIANT Int
27 // parent of INVARIANT Int: Map
28 // parent of T: T
29 // parent of T: INVARIANT T
30 // parent of INVARIANT T: Map
31 // parent of Map: Map
32 // parent of Map: Alias
33 // parent of Any?: T
34 // parent of T: Alias
35 // parent of Alias: File: a.kt
36 // parent of Int: Int
37 // parent of Int: INVARIANT Int
38 // parent of INVARIANT Int: List
39 // parent of List: List
40 // parent of List: topProp
41 // parent of Int: Int
42 // parent of Int: INVARIANT Int
43 // parent of INVARIANT Int: List<Int>
44 // parent of List<Int>: List<Int>
45 // parent of List<Int>: topProp.getter()
46 // parent of topProp.getter(): topProp
47 // parent of Anno: Anno
48 // parent of Anno: @Anno
49 // parent of @Anno: topProp
50 // parent of topProp: File: a.kt
51 // parent of T: T
52 // parent of T: topFun
53 // parent of Any?: T
54 // parent of T: topFun
55 // parent of Anno: Anno
56 // parent of Anno: @Anno
57 // parent of @Anno: topFun
58 // parent of topFun: File: a.kt
59 // parent of Any: ITF
60 // parent of ITF: File: a.kt
61 // parent of ITF: ITF
62 // parent of ITF: topClass
63 // parent of Anno: Anno
64 // parent of Anno: @Anno
65 // parent of @Anno: topClass
66 // parent of topClass: File: a.kt
67 // parent of Int: Int
68 // parent of Int: i
69 // parent of i: memberFun
70 // parent of Int: memberFun
71 // parent of memberFun: topClass
72 // parent of Any: InnerClass
73 // parent of Any?: P
74 // parent of P: InnerClass
75 // parent of InnerClass: topClass
76 // parent of P: P
77 // parent of P: p
78 // parent of p: innerFun
79 // parent of Int: innerFun
80 // parent of innerFun: InnerClass
81 // parent of InnerClass<*>: synthetic constructor for InnerClass
82 // parent of synthetic constructor for InnerClass: InnerClass
83 // parent of Int: Int
84 // parent of Int: a
85 // parent of Int: Int
86 // parent of Int: a.getter()
87 // parent of a.getter(): a
88 // parent of a: topClass
89 // parent of String: String
90 // parent of String: b
91 // parent of b.getter(): b
92 // parent of String: String
93 // parent of String: <set-?>
94 // parent of <set-?>: b.setter()
95 // parent of b.setter(): b
96 // parent of b: topClass
97 // parent of topClass: synthetic constructor for topClass
98 // parent of synthetic constructor for topClass: topClass
99 // parent of Any: CMYK
100 // parent of CMYK: File: a.kt
101 // parent of Any: C
102 // parent of C: CMYK
103 // parent of C: synthetic constructor for C
104 // parent of synthetic constructor for C: C
105 // parent of Any: M
106 // parent of M: CMYK
107 // parent of M: synthetic constructor for M
108 // parent of synthetic constructor for M: M
109 // parent of Any: Y
110 // parent of Y: CMYK
111 // parent of Y: synthetic constructor for Y
112 // parent of synthetic constructor for Y: Y
113 // parent of Any: K
114 // parent of K: CMYK
115 // parent of K: synthetic constructor for K
116 // parent of synthetic constructor for K: K
117 // parent of CMYK: synthetic constructor for CMYK
118 // parent of synthetic constructor for CMYK: CMYK
119 // parent of File: Bnno.kt: null
120 // parent of Any: Bnno
121 // parent of Bnno: File: Bnno.kt
122 // parent of Bnno: synthetic constructor for Bnno
123 // parent of synthetic constructor for Bnno: Bnno
124 // parent of File: B.java: null
125 // parent of ITF: ITF
126 // parent of ITF: B
127 // parent of T: B
128 // parent of Anno: Anno
129 // parent of Anno: @Anno
130 // parent of @Anno: B
131 // parent of p: Bnno
132 // parent of p.Bnno: Bnno
133 // parent of Bnno: @Bnno
134 // parent of @Bnno: B
135 // parent of B: File: B.java
136 // parent of T: T
137 // parent of T: t
138 // parent of t: B
139 // parent of T: T
140 // parent of T: t
141 // parent of t: foo
142 // parent of Int: Int
143 // parent of Int: i
144 // parent of i: foo
145 // parent of Int: Int
146 // parent of Int: foo
147 // parent of foo: B
148 // parent of B<*>: synthetic constructor for B
149 // parent of synthetic constructor for B: B
150 // parent of RGB: RGB
151 // parent of RGB: INVARIANT RGB
152 // parent of INVARIANT RGB: Enum<RGB>
153 // parent of Enum<RGB>: Enum<RGB>
154 // parent of Enum<RGB>: RGB
155 // parent of RGB: File: B.java
156 // parent of R: RGB
157 // parent of G: RGB
158 // parent of B: RGB
159 // parent of RGB: RGB
160 // parent of RGB: INVARIANT RGB
161 // parent of INVARIANT RGB: Array<(RGB..RGB?)>
162 // parent of Array<(RGB..RGB?)>: Array<(RGB..RGB?)>
163 // parent of Array<(RGB..RGB?)>: values
164 // parent of values: RGB
165 // parent of java: String
166 // parent of lang: String
167 // parent of String: String
168 // parent of String: name
169 // parent of name: valueOf
170 // parent of RGB: RGB
171 // parent of RGB: valueOf
172 // parent of valueOf: RGB
173 // parent of RGB: synthetic constructor for RGB
174 // parent of synthetic constructor for RGB: RGB
175 // parent of YUV: YUV
176 // parent of YUV: INVARIANT YUV
177 // parent of INVARIANT YUV: Enum<YUV>
178 // parent of Enum<YUV>: Enum<YUV>
179 // parent of Enum<YUV>: YUV
180 // parent of YUV: null
181 // parent of YUV: YUV
182 // parent of YUV: Y
183 // parent of Y: YUV
184 // parent of YUV: YUV
185 // parent of YUV: U
186 // parent of U: YUV
187 // parent of YUV: YUV
188 // parent of YUV: V
189 // parent of V: YUV
190 // parent of String: String
191 // parent of String: value
192 // parent of value: valueOf
193 // parent of YUV: YUV
194 // parent of YUV: valueOf
195 // parent of valueOf: YUV
196 // parent of YUV: YUV
197 // parent of YUV: INVARIANT YUV
198 // parent of INVARIANT YUV: Array<YUV>
199 // parent of Array<YUV>: Array<YUV>
200 // parent of Array<YUV>: values
201 // parent of values: YUV
202 // parent of YUV: YUV
203 // parent of YUV: <init>
204 // parent of <init>: YUV
205 // parent of HSV: HSV
206 // parent of HSV: INVARIANT HSV
207 // parent of INVARIANT HSV: Enum<(HSV..HSV?)>
208 // parent of Enum<(HSV..HSV?)>: Enum<(HSV..HSV?)>
209 // parent of Enum<(HSV..HSV?)>: HSV
210 // parent of HSV: null
211 // parent of HSV: HSV
212 // parent of HSV: H
213 // parent of H: HSV
214 // parent of HSV: HSV
215 // parent of HSV: S
216 // parent of S: HSV
217 // parent of HSV: HSV
218 // parent of HSV: V
219 // parent of V: HSV
220 // parent of String: String
221 // parent of String: value
222 // parent of value: valueOf
223 // parent of HSV: HSV
224 // parent of HSV: valueOf
225 // parent of valueOf: HSV
226 // parent of HSV: HSV
227 // parent of HSV: INVARIANT HSV
228 // parent of INVARIANT HSV: Array<HSV>
229 // parent of Array<HSV>: Array<HSV>
230 // parent of Array<HSV>: values
231 // parent of values: HSV
232 // parent of HSV: HSV
233 // parent of HSV: <init>
234 // parent of <init>: HSV
235 // END
236
237 // MODULE: lib
238 // FILE: YUV.kt
239 enum class YUV {
240 Y, U, V
241 }
242
243 // FILE: HSV.java
244 enum HSV {
245 H, S, V
246 }
247
248 // MODULE: main(lib)
249
250 // FILE: a.kt
251 annotation class Anno
252
253 typealias Alias<T> = Map<Int, T>
254
255 @Anno
256 val topProp : List<Int>? = null
257
258 @Anno
topFunnull259 fun <T> topFun() : T? {
260 return null
261 }
262
263 interface ITF
264
265 @Anno
266 class topClass: ITF {
memberFunnull267 fun memberFun(i: Int) = 1
268 class InnerClass<P> {
269 fun innerFun(p: P) = 1
270 }
271
272 val a: Int = 1
273 var b: String
274 get() = "1"
275 }
276
277 enum class CMYK {
278 C, M, Y, K
279 }
280
281 // FILE: Bnno.kt
282 package p
283
284 annotation class Bnno
285
286 // FILE: B.java
287 @Anno
288 @p.Bnno
289 public class B<T> implements ITF {
290 private T t;
291 public int foo(T t, int i) {
292 return 1;
293 }
294 }
295
296 enum RGB {
297 R, G, B
298 }
299