aboutsummaryrefslogtreecommitdiff
path: root/test/playground.kt
blob: 5206e10e37d4a51f2ff3d38c7a162995605d73c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// this file is not included in sources or tests, you can play with it for debug purposes
// Console run configuration will analyse it and provide lots of debug output
package dokka.playground

fun topLevelFunction() {
}

val topLevelConstantValue = "Hello"

val topLevelValue: String
    get() = "Bye bye"

var topLevelVariable: String
    get() = "Modify me!"
    set(value) {
    }

/**
 * This is a class
 */
class Class {
    fun memberFunction() {
    }

    val memberValue = "Member"
}

/**
 * This is a class with constructor and space after doc
 */

class ClassWithConstructor(
        /** Doc at parameter */ val name: Class)

/**
 * This is data class with constructor and two properties
 * Also look at [Employee]
 *
 * $name Person's name
 * $age Person's age
 *
 */
data class Person(val name: ClassWithConstructor, val age: Int) {}

data class Employee(val name: ClassWithConstructor, val age: Int) {}

object Object {
    throws(javaClass<IllegalArgumentException>())
    fun objectFunction() {
    }

    val objectValue: String
            /** one line getter doc */
        get() = "Member"

    public val String.valueWithReceiver: Int
        get() = 1

}

enum class Color(r: Int, g: Int, b: Int) {
    Red : Color(100,0,0)
    Green : Color(0,100,0)
    Blue : Color(0,0,100)
}

class OuterClass {

    /**
     * $T type of the item
     */
    class NestedClass<T> {
        fun nestedClassFunction(item: T) {
        }

        fun String.functionWithReceiver(): Int = 1

    }

    inner class InnerClass {
        open fun innerClassFunction<
                /** doc for R1 type param */
                R1,
                /** doc for R2 type param */
                R2
                >() {
        }
    }

    object NestedObject {
        protected open fun nestedObjectFunction() {
        }
    }
}

trait Interface {
    fun worker()
    val extra: String
}