Unnamed repository; edit this file 'description' to name the repository.
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
package example

class Example(private val value: Int) {
    fun compute(a: Int, b: Int): Int {
        val numbers = listOf(
            1,
            2,
            3,
        )
        for (n in numbers) {
            println(n)
        }
        val result = when (b) {
            1 -> a
            2 -> b
            else -> 0
        }
        // Known limitation (documented, not checked): else / catch / finally
        // bodies over-indent by one level because the block begins on a different
        // line than the enclosing if / try, so the two indents do not collapse.
        // The brace-less if-body additionally has no public grammar node to indent
        // against, so this needs a grammar change rather than a query fix. The
        // cases are left here, commented out, to document the edge.
        // if (a > b) {
        //     println("gt")
        // } else {
        //     println("le")
        // }
        // try {
        //     return result
        // } catch (e: Exception) {
        //     return 0
        // } finally {
        //     println("done")
        // }
        return result
    }
}

val multi = """
unindented
    indented
"""