xref: /aosp_15_r20/external/ksp/test-utils/testData/api/sealedClass.kt (revision af87fb4bb8e3042070d2a054e912924f599b22b7)
1*af87fb4bSXin Li /*
2*af87fb4bSXin Li  * Copyright 2021 Google LLC
3*af87fb4bSXin Li  * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
4*af87fb4bSXin Li  *
5*af87fb4bSXin Li  * Licensed under the Apache License, Version 2.0 (the "License");
6*af87fb4bSXin Li  * you may not use this file except in compliance with the License.
7*af87fb4bSXin Li  * You may obtain a copy of the License at
8*af87fb4bSXin Li  *
9*af87fb4bSXin Li  * http://www.apache.org/licenses/LICENSE-2.0
10*af87fb4bSXin Li  *
11*af87fb4bSXin Li  * Unless required by applicable law or agreed to in writing, software
12*af87fb4bSXin Li  * distributed under the License is distributed on an "AS IS" BASIS,
13*af87fb4bSXin Li  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14*af87fb4bSXin Li  * See the License for the specific language governing permissions and
15*af87fb4bSXin Li  * limitations under the License.
16*af87fb4bSXin Li  */
17*af87fb4bSXin Li 
18*af87fb4bSXin Li // TEST PROCESSOR: SealedClassProcessor
19*af87fb4bSXin Li // EXPECTED:
20*af87fb4bSXin Li // from lib
21*af87fb4bSXin Li // [Const: KOTLIN_LIB, NotANumber: KOTLIN_LIB, Sum: KOTLIN_LIB]
22*af87fb4bSXin Li // from source
23*af87fb4bSXin Li // Expr : [Const: KOTLIN, NotANumber: KOTLIN, Sum: KOTLIN]
24*af87fb4bSXin Li // Const : []
25*af87fb4bSXin Li // Sum : []
26*af87fb4bSXin Li // NotANumber : []
27*af87fb4bSXin Li // END
28*af87fb4bSXin Li 
29*af87fb4bSXin Li // MODULE: lib
30*af87fb4bSXin Li // FILE: lib.kt
31*af87fb4bSXin Li package lib
32*af87fb4bSXin Li sealed class Expr
33*af87fb4bSXin Li data class Const(val number: Double) : Expr()
34*af87fb4bSXin Li data class Sum(val e1: Expr, val e2: Expr) : Expr()
35*af87fb4bSXin Li object NotANumber : Expr()
36*af87fb4bSXin Li 
37*af87fb4bSXin Li // MODULE: main(lib)
38*af87fb4bSXin Li // FILE: sealed.kt
39*af87fb4bSXin Li sealed class Expr
40*af87fb4bSXin Li data class Const(val number: Double) : Expr()
41*af87fb4bSXin Li data class Sum(val e1: Expr, val e2: Expr) : Expr()
42*af87fb4bSXin Li object NotANumber : Expr()
43