xref: /aosp_15_r20/external/ksp/kotlin-analysis-api/testData/innerTypes.kt (revision af87fb4bb8e3042070d2a054e912924f599b22b7)
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 // WITH_RUNTIME
19 // TEST PROCESSOR: InnerTypeProcessor
20 // EXPECTED:
21 // C1<*>: [C1<STAR null>]
22 // C1<Int>: [C1<INVARIANT Int>]
23 // C2<*, *>: [C1.C2<STAR null>, C1<STAR null>]
24 // C2<Short, Int>: [C1.C2<INVARIANT Short>, C1<INVARIANT Int>]
25 // C3<*, *, *>: [C1.C2.C3<STAR null>, C1.C2<STAR null>, C1<STAR null>]
26 // C3<Byte, Short, Int>: [C1.C2.C3<INVARIANT Byte>, C1.C2<INVARIANT Short>, C1<INVARIANT Int>]
27 // C4<*>: [C1.C4<STAR null>]
28 // C4<Double>: [C1.C4<INVARIANT Double>]
29 // C5<*, *>: [C1.C4.C5<STAR null>, C1.C4<STAR null>]
30 // C5<Float, Double>: [C1.C4.C5<INVARIANT Float>, C1.C4<INVARIANT Double>]
31 // END
32 
33 @file:Suppress("Byte", "Int", "Short", "Double", "Float", "Suppress", "Any")
34 
35 class C1<T1> {
36     inner class C2<T2> {
37         inner class C3<T3> {
38 
39         }
40     }
41 
42     class C4<T4> {
43         inner class C5<T5>
44     }
45 }
46 
47 val c1 = C1<Int>()
48 val c2 = c1.C2<Short>()
49 val c3 = c2.C3<Byte>()
50 val c4 = C1.C4<Double>()
51 val c5 = c4.C5<Float>()
52