Generate debug information for 'when' subject variable

NB debugger tests currently don't support language version or individual
language feature settings.
This commit is contained in:
Dmitry Petrov
2018-06-19 15:57:22 +03:00
parent a7492e91c9
commit a4b5d74ae3
7 changed files with 98 additions and 7 deletions
@@ -0,0 +1,10 @@
// !LANGUAGE: +VariableDeclarationInWhenSubject
fun test(a: Any) =
when (val subject = a) {
is Int -> "Int $subject"
is String -> "String ${subject.length}"
else -> "other"
}
// 1 LOCALVARIABLE subject Ljava/lang/Object;
@@ -0,0 +1,12 @@
// !LANGUAGE: +VariableDeclarationInWhenSubject
enum class X { A, B, C }
fun test(a: X) =
when (val subject = a) {
X.A -> 0
X.B -> 1
X.C -> 2
}
// 1 LOCALVARIABLE subject
@@ -0,0 +1,11 @@
// !LANGUAGE: +VariableDeclarationInWhenSubject
fun test(a: Int) =
when (val subject = a) {
1 -> 0
2 -> 1
3 -> 2
else -> -1
}
// 1 LOCALVARIABLE subject
@@ -0,0 +1,10 @@
// !LANGUAGE: +VariableDeclarationInWhenSubject
fun test(a: String) =
when (val subject = a) {
"" -> 0
"a" -> 1
else -> -1
}
// 1 LOCALVARIABLE subject