Introduce local variable type checker.

CheckLocalVariablesTableTests will now check the validity of
the locals table against types of locals computed based on the
bytecode.

These checks and the new destructuringInFor test act as a
regression test for the changes in
https://github.com/JetBrains/kotlin/pull/2613

These checks also caught a similar issue for destructuring
lambda parameters, where the local is introduced before the
value has been written to the local slot. This change also
fixes that.

Finally, this change fixes the asmLike tests to correctly
look up the name of parameters in the locals table.
This commit is contained in:
Mads Ager
2019-09-26 13:42:42 +02:00
committed by max-kammerer
parent 13b69b730a
commit 3b2843fe7a
22 changed files with 367 additions and 93 deletions
@@ -0,0 +1,14 @@
// WITH_RUNTIME
fun box() {
val map: Map<String, String> = mapOf()
for ((a, b) in map) {
a + b
}
}
// METHOD : DestructuringInForKt.box()V
// VARIABLE : NAME=b TYPE=Ljava/lang/String; INDEX=4
// VARIABLE : NAME=a TYPE=Ljava/lang/String; INDEX=3
// VARIABLE : NAME=map TYPE=Ljava/util/Map; INDEX=0