xref: /aosp_15_r20/external/ksp/test-utils/testData/api/getByName.kt (revision af87fb4bb8e3042070d2a054e912924f599b22b7)
1 /*
2  * Copyright 2021 Google LLC
3  * Copyright 2010-2021 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: GetByNameProcessor
19 // EXPECTED:
20 // all success
21 // END
22 // MODULE: lib1
23 // FILE: foo.kt
24 package lib1
25 
26 open class Foo {
lib1MemberFunnull27     fun lib1MemberFun() = 1
28     fun overload(a: Int) = "Overload"
29     fun overload() = "Overload"
30     val lib1MemberProp = 1.0
31 
32     class FooNested {}
33 }
34 
lib1TopFunnull35 fun lib1TopFun(): Int {
36     return 1
37 }
38 
39 val lib1TopProp = "1"
40 
41 // FILE: Bar.java
42 package lib1;
43 
<lambda>null44 class Bar {
45     public int lib1JavaMemberFun() {
46         return 1;
47     }
48 }
49 
50 // MODULE: lib2
51 // FILE: foo.kt
52 package lib2
53 
54 class Foo  {
lib2MemberFunnull55     fun lib2MemberFun() = 1
56     val lib2MemberProp = 1.0
57 }
58 
59 // MODULE: main(lib1, lib2)
60 // FILE: a.kt
61 package source
62 
63 class FooInSource {
64     fun sourceMemberFun() = 1
65     val sourceMemberProp = 1.0
66     class FooInSourceNested
67 }
68 
69 val propInSource = 1
70 // FILE: main.kt
71 package main
72 import lib1.Foo
73 
74 class KotlinMain : Foo {
lib1MemberFunnull75     fun lib1MemberFun(a: Int) = 1
76 }
77 
78