xref: /aosp_15_r20/external/ksp/test-utils/testData/api/platformDeclaration.kt (revision af87fb4bb8e3042070d2a054e912924f599b22b7)
1 /*
2  * Copyright 2020 Google LLC
3  * Copyright 2010-2020 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: PlatformDeclarationProcessor
20 // EXPECTED:
21 // Actual.kt : Clazz : true : false : [] : [Expect.kt]
22 // Actual.kt : Clazz.foo : true : false : [] : [Expect.kt]
23 // Actual.kt : ExpectNotFoundClass : true : false : [] : []
24 // Actual.kt : ExpectNotFoundFun : true : false : [] : []
25 // Actual.kt : ExpectNotFoundVal : true : false : [] : []
26 // Actual.kt : Klass : true : false : [] : [Expect.kt]
27 // Actual.kt : RGB : true : false : [] : [Expect.kt]
28 // Actual.kt : RGB.B : true : false : [] : [Expect.kt]
29 // Actual.kt : RGB.G : true : false : [] : [Expect.kt]
30 // Actual.kt : RGB.R : true : false : [] : [Expect.kt]
31 // Actual.kt : RGB.v : false : false : [] : []
32 // Actual.kt : bar : true : false : [] : [Expect.kt]
33 // Actual.kt : baz : true : false : [] : [Expect.kt]
34 // Coffee.java : Coffee : false : false : [] : []
35 // Coffee.java : Coffee.baz : false : false : [] : []
36 // Coffee.java : Coffee.foo : false : false : [] : []
37 // Expect.kt : ActualNotFoundClass : false : true : [] : []
38 // Expect.kt : ActualNotFoundFun : false : true : [] : []
39 // Expect.kt : ActualNotFoundVal : false : true : [] : []
40 // Expect.kt : Clazz : false : true : [Actual.kt] : []
41 // Expect.kt : Clazz.foo : false : true : [Actual.kt] : []
42 // Expect.kt : Klass : false : true : [Actual.kt] : []
43 // Expect.kt : NormalClass : false : false : [] : []
44 // Expect.kt : NormalFun : false : false : [] : []
45 // Expect.kt : NormalVal : false : false : [] : []
46 // Expect.kt : RGB : false : true : [Actual.kt] : []
47 // Expect.kt : RGB.B : false : true : [Actual.kt] : []
48 // Expect.kt : RGB.G : false : true : [Actual.kt] : []
49 // Expect.kt : RGB.R : false : true : [Actual.kt] : []
50 // Expect.kt : bar : false : true : [Actual.kt] : []
51 // Expect.kt : baz : false : true : [Actual.kt] : []
52 // END
53 
54 // FILE: Expect.kt
55 expect class Clazz {
foonull56     fun foo(): String
57 }
58 
59 expect fun bar(): String
60 expect val baz: String
61 expect class Klass
62 
63 class NormalClass
64 fun NormalFun(): String = ""
65 val NormalVal: String = ""
66 
67 expect class ActualNotFoundClass
68 expect fun ActualNotFoundFun(): String
69 expect val ActualNotFoundVal: String
70 
71 expect enum class RGB {
72     R,
73     expect G,
74     B
75 }
76 
77 // FILE: Actual.kt
78 actual class Clazz {
foonull79     actual fun foo(): String = "foo"
80 }
81 
82 actual fun bar(): String = "bar"
83 actual val baz: String = "baz"
84 actual typealias Klass = String
85 
86 actual class ExpectNotFoundClass
87 actual fun ExpectNotFoundFun(): String
88 actual val ExpectNotFoundVal: String
89 
90 actual enum class RGB(val v: Int) {
91     actual R(0xFF0000),
92     actual G(0x00FF00),
93     actual B(0x0000FF)
94 }
95 
96 // FILE: Coffee.java
97 class Coffee {
98     String foo() {
99         return null
100     }
101 
102     String baz = null
103 }
104