diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/FunctionWithJsFuncAnnotationInliner.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/FunctionWithJsFuncAnnotationInliner.kt index 082995ae927..57a3dedb053 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/FunctionWithJsFuncAnnotationInliner.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/FunctionWithJsFuncAnnotationInliner.kt @@ -6,18 +6,24 @@ package org.jetbrains.kotlin.ir.backend.js.transformers.irToJs import org.jetbrains.kotlin.backend.common.compilationException -import org.jetbrains.kotlin.ir.expressions.IrCall import org.jetbrains.kotlin.ir.backend.js.utils.JsGenerationContext +import org.jetbrains.kotlin.ir.declarations.IrValueParameter +import org.jetbrains.kotlin.ir.expressions.IrCall +import org.jetbrains.kotlin.ir.util.file import org.jetbrains.kotlin.js.backend.ast.* +private typealias Replacement = Pair + class FunctionWithJsFuncAnnotationInliner(private val jsFuncCall: IrCall, private val context: JsGenerationContext) { private val function = getJsFunctionImplementation() private val replacements = collectReplacementsForCall() fun generateResultStatement(): List { + val irFunction = jsFuncCall.symbol.owner + val newContext = context.newFile(irFunction.file, irFunction, context.localNames) return function.body.statements .run { - SimpleJsCodeInliner(replacements) + SimpleJsCodeInliner(replacements, newContext) .apply { acceptList(this@run) } .withTemporaryVariablesForExpressions(this) } @@ -27,9 +33,10 @@ class FunctionWithJsFuncAnnotationInliner(private val jsFuncCall: IrCall, privat context.staticContext.backendContext.getJsCodeForFunction(jsFuncCall.symbol)?.deepCopy() ?: compilationException("JS function not found", jsFuncCall) - private fun collectReplacementsForCall(): Map { + private fun collectReplacementsForCall(): Map { val translatedArguments = Array(jsFuncCall.valueArgumentsCount) { - jsFuncCall.getValueArgument(it)!!.accept(IrElementToJsExpressionTransformer(), context) + jsFuncCall.getValueArgument(it)!! + .accept(IrElementToJsExpressionTransformer(), context) to jsFuncCall.symbol.owner.valueParameters[it] } return function.parameters .mapIndexed { i, param -> param.name to translatedArguments[i] } @@ -37,15 +44,19 @@ class FunctionWithJsFuncAnnotationInliner(private val jsFuncCall: IrCall, privat } } -private class SimpleJsCodeInliner(private val replacements: Map): RecursiveJsVisitor() { - private val temporaryNamesForExpressions = mutableMapOf() +private class SimpleJsCodeInliner(private val replacements: Map, val context: JsGenerationContext) : + RecursiveJsVisitor() +{ + private val temporaryNamesForExpressions = mutableMapOf() fun withTemporaryVariablesForExpressions(statements: List): List { if (temporaryNamesForExpressions.isEmpty()) { return statements } - val variableDeclarations = temporaryNamesForExpressions.map { JsVars(JsVars.JsVar(it.key, it.value)) } + val variableDeclarations = temporaryNamesForExpressions.map { + JsVars(JsVars.JsVar(it.key, it.value.first).withSource(it.value.second, context, useNameOf = it.value.second)) + } return variableDeclarations + statements } @@ -55,16 +66,16 @@ private class SimpleJsCodeInliner(private val replacements: Map expression.name!! - else -> declareNewTemporaryFor(expression) + else -> declareNewTemporaryFor(expression, irValueParameter) } } } diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrElementToJsStatementTransformer.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrElementToJsStatementTransformer.kt index 21715e2bf8c..6aa5f5b22d1 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrElementToJsStatementTransformer.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/IrElementToJsStatementTransformer.kt @@ -148,7 +148,8 @@ class IrElementToJsStatementTransformer : BaseIrElementToJsNodeTransformer IrWhen.toJsNode( tr: BaseIrElementToJsNodeTransformer, context: JsGenerationContext, @@ -113,7 +110,7 @@ fun translateFunction(declaration: IrFunction, name: JsName?, context: JsGenerat val functionContext = context.newDeclaration(declaration, localNameGenerator) - val functionParams = declaration.valueParameters.map { functionContext.getNameForValueDeclaration(it) } + val functionParams = declaration.valueParameters.map { it to functionContext.getNameForValueDeclaration(it) } val body = declaration.body?.accept(IrElementToJsStatementTransformer(), functionContext) as? JsBlock ?: JsBlock() val function = JsFunction(emptyScope, body, "member function ${name ?: "annon"}") @@ -121,12 +118,12 @@ fun translateFunction(declaration: IrFunction, name: JsName?, context: JsGenerat function.name = name - fun JsFunction.addParameter(parameter: JsName) { - parameters.add(JsParameter(parameter)) + fun JsFunction.addParameter(parameter: JsName, irValueParameter: IrValueParameter) { + parameters.add(JsParameter(parameter).withSource(irValueParameter, functionContext, useNameOf = irValueParameter)) } - declaration.extensionReceiverParameter?.let { function.addParameter(functionContext.getNameForValueDeclaration(it)) } - functionParams.forEach { function.addParameter(it) } + declaration.extensionReceiverParameter?.let { function.addParameter(functionContext.getNameForValueDeclaration(it), it) } + functionParams.forEach { (irValueParameter, name) -> function.addParameter(name, irValueParameter) } check(!declaration.isSuspend) { "All Suspend functions should be lowered" } return function @@ -621,6 +618,19 @@ private fun IrDeclarationWithName.originalNameForUseInSourceMap(policy: SourceMa return it.asString() } } + + is IrValueDeclaration -> if (origin !in nameMappingOriginAllowList) { + return null + } } return name.asString() } + +private val nameMappingOriginAllowList = setOf( + IrDeclarationOrigin.DEFINED, + IrDeclarationOrigin.FOR_LOOP_VARIABLE, + IrDeclarationOrigin.CATCH_PARAMETER, + IrDeclarationOrigin.CONTINUATION, + BOUND_VALUE_PARAMETER, + JsLoweredDeclarationOrigin.JS_SHADOWED_DEFAULT_PARAMETER, +) diff --git a/compiler/testData/debug/jsTestHelpers/jsCommonTestHelpers.kt b/compiler/testData/debug/jsTestHelpers/jsCommonTestHelpers.kt new file mode 100644 index 00000000000..945798bde4d --- /dev/null +++ b/compiler/testData/debug/jsTestHelpers/jsCommonTestHelpers.kt @@ -0,0 +1,66 @@ +// This file is compiled into each stepping test. + +package testUtils + +import kotlin.coroutines.Continuation +import kotlin.coroutines.CoroutineContext +import kotlin.coroutines.EmptyCoroutineContext + +external interface ValueDescriptionForSteppingTests { + var isNull: Boolean? + var isReferenceType: Boolean? + var valueDescription: String? + var typeName: String? +} + +external object JSON { + fun stringify(o: Any?): String +} + +/** + * This function is only called from the debugger + */ +@JsExport +fun makeValueDescriptionForSteppingTests(value: Any?): ValueDescriptionForSteppingTests? { + val jsTypeName = jsTypeOf(value) + val displayedTypeName = when (jsTypeName) { + "undefined" -> return null + "string", "object", "function" -> if (value == null) jsTypeName else { + val klass = value::class + // Fully qualified names are not yet supported in Kotlin/JS reflection + knownFqNames[klass] ?: klass.simpleName ?: "" + } + else -> jsTypeName + } + return js("{}").unsafeCast().apply { + isNull = value == null + isReferenceType = jsTypeName == "object" || jsTypeName == "function" + valueDescription = when (jsTypeName) { + "string" -> JSON.stringify(value) + else -> value.toString() + } + typeName = displayedTypeName + } +} + +private val minimalFqNames = mapOf( + Long::class to "kotlin.Long", + String::class to "kotlin.String", + Array::class to "kotlin.Array", + RuntimeException::class to "kotlin.RuntimeException", + ArithmeticException::class to "kotlin.ArithmeticException", +) + +private val knownFqNames = minimalFqNames + stdlibFqNames + +private object EmptyContinuation: Continuation { + override val context: CoroutineContext + get() = EmptyCoroutineContext + + override fun resumeWith(result: Result) { + result.getOrThrow() + } +} + +@JsExport +fun makeEmptyContinuation(): dynamic = EmptyContinuation diff --git a/compiler/testData/debug/jsTestHelpers/jsMinimalTestHelpers.kt b/compiler/testData/debug/jsTestHelpers/jsMinimalTestHelpers.kt new file mode 100644 index 00000000000..fc3cf7392b0 --- /dev/null +++ b/compiler/testData/debug/jsTestHelpers/jsMinimalTestHelpers.kt @@ -0,0 +1,94 @@ +// This file is compiled into each stepping test only if the WITH_STDLIB directive is NOT specified. + +package testUtils + +import kotlin.reflect.KClass + +inline fun Array.map(noinline transform: (T) -> S): Array = asDynamic().map(transform).unsafeCast>() + +inline fun Array.some(noinline predicate: (T) -> Boolean): Boolean = asDynamic().some(predicate).unsafeCast() + +internal data class Pair(val first: A, val second: B) + +internal infix fun A.to(that: B) = Pair(this, that) + +/** + * A simple polyfill. We don't need fancy hashsets, since we don't deal with many values in the helpers. + */ +private class ArraySet(private val array: Array) : Set { + override val size: Int + get() = array.size + + override fun contains(element: T) = array.some { it == element } + + override fun containsAll(elements: Collection): Boolean { + for (element in elements) { + if (!contains(element)) return false + } + return true + } + + override fun isEmpty() = size == 0 + + override fun iterator(): Iterator = array.iterator() +} + +/** + * A simple polyfill. We don't need fancy hashmaps, since we don't deal with many values in the helpers. + */ +private class ArrayMap(private val array: Array>): Map { + + private class Entry(override val key: Key, override val value: Value) : Map.Entry + + override val entries: Set> + get() = ArraySet(array.map { Entry(it.first, it.second) }) + + override val keys: Set + get() = ArraySet(array.map { it.first }) + + override val values: Collection + get() = ArraySet(array.map { it.second }) + + override val size: Int + get() = array.size + + override fun containsKey(key: Key) = array.some { it.first == key } + + override fun containsValue(value: Value) = array.some { it.second == value } + + override fun get(key: Key): Value? { + for ((first, second) in array) { + if (first == key) return second + } + return null + } + + override fun isEmpty() = size == 0 + + fun put(key: Key, value: Value): Value? { + for (i in 0 until size) { + val entry = array[i] + if (entry.first == key) { + array[i] = key to value + return entry.second + } + } + array.asDynamic().push(key to value) + return null + } +} + +internal fun mapOf(vararg pairs: Pair): Map = ArrayMap(arrayOf(*pairs)) + +internal operator fun Map.plus(map: Map): Map { + val newMap = ArrayMap(arrayOf()) + for (entry in this.entries) { + newMap.put(entry.key, entry.value) + } + for (entry in map.entries) { + newMap.put(entry.key, entry.value) + } + return newMap +} + +internal val stdlibFqNames = mapOf, String>() diff --git a/compiler/testData/debug/jsTestHelpers/jsWithStdlibTestHelpers.kt b/compiler/testData/debug/jsTestHelpers/jsWithStdlibTestHelpers.kt new file mode 100644 index 00000000000..1971eeebc04 --- /dev/null +++ b/compiler/testData/debug/jsTestHelpers/jsWithStdlibTestHelpers.kt @@ -0,0 +1,13 @@ +// This file is compiled into each stepping test only if the WITH_STDLIB directive IS specified. + +package testUtils + +import kotlin.collections.AbstractMutableMap + +@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +internal val stdlibFqNames = mapOf( + Pair::class to "kotlin.Pair", + Triple::class to "kotlin.Triple", + HashMap::class to "kotlin.collections.HashMap", + AbstractMutableMap.SimpleEntry::class to "kotlin.collections.AbstractMutableMap.SimpleEntry" +) diff --git a/compiler/testData/debug/localVariables/assignment.kt b/compiler/testData/debug/localVariables/assignment.kt index 1c6e91f4789..933a4ea5c34 100644 --- a/compiler/testData/debug/localVariables/assignment.kt +++ b/compiler/testData/debug/localVariables/assignment.kt @@ -13,9 +13,13 @@ fun box(): String { return o + k } -// EXPECTATIONS - +// EXPECTATIONS JVM JVM_IR // test.kt:8 box: // test.kt:6 box: // test.kt:11 box: o:java.lang.String="O":java.lang.String -// test.kt:13 box: o:java.lang.String="O":java.lang.String, k:java.lang.String="K":java.lang.String \ No newline at end of file +// test.kt:13 box: o:java.lang.String="O":java.lang.String, k:java.lang.String="K":java.lang.String + +// EXPECTATIONS JS_IR +// test.kt:8 box: +// test.kt:11 box: o="O":kotlin.String +// test.kt:13 box: o="O":kotlin.String, k="K":kotlin.String diff --git a/compiler/testData/debug/localVariables/catchClause.kt b/compiler/testData/debug/localVariables/catchClause.kt index 7cc48c75d4e..4e91ae77141 100644 --- a/compiler/testData/debug/localVariables/catchClause.kt +++ b/compiler/testData/debug/localVariables/catchClause.kt @@ -4,16 +4,27 @@ fun box() { var a = 1 a -- a /= a + throw ArithmeticException() // Division by 0 doesn't throw in JS, so throw explicitly } catch(e : Throwable) { e.printStackTrace() } } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:3 box: // test.kt:4 box: // test.kt:5 box: a:int=1:int // test.kt:6 box: a:int=0:int -// test.kt:7 box: -// test.kt:8 box: e:java.lang.Throwable=java.lang.ArithmeticException -// test.kt:10 box: +// test.kt:8 box: +// test.kt:9 box: e:java.lang.Throwable=java.lang.ArithmeticException +// test.kt:11 box: + +// EXPECTATIONS JS_IR +// test.kt:4 box: +// test.kt:5 box: a=1:number +// test.kt:5 box: a=1:number +// test.kt:6 box: a=0:number +// test.kt:7 box: a=0:number +// test.kt:8 box: a=0:number +// test.kt:8 box: a=0:number +// test.kt:9 box: a=0:number, e=kotlin.ArithmeticException diff --git a/compiler/testData/debug/localVariables/constructors/multipleConstructors.kt b/compiler/testData/debug/localVariables/constructors/multipleConstructors.kt index b98a5313b0d..5d06ba75956 100644 --- a/compiler/testData/debug/localVariables/constructors/multipleConstructors.kt +++ b/compiler/testData/debug/localVariables/constructors/multipleConstructors.kt @@ -16,7 +16,7 @@ fun box() { Derived(4, 5) } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:15 box: // test.kt:7 : p:int=3:int // test.kt:6 : @@ -25,9 +25,8 @@ fun box() { // test.kt:8 : p:int=3:int // EXPECTATIONS JVM_IR // test.kt:9 : p:int=3:int, a:int=2:int -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:15 box: - // test.kt:16 box: // test.kt:11 : p1:int=4:int, p2:int=5:int // test.kt:6 : @@ -35,4 +34,18 @@ fun box() { // test.kt:6 : // test.kt:11 : p1:int=4:int, p2:int=5:int // test.kt:16 box: -// test.kt:17 box: \ No newline at end of file +// test.kt:17 box: + +// EXPECTATIONS JS_IR +// test.kt:15 box: +// test.kt:7 Derived_init_$Init$: p=3:number +// test.kt:6 : +// test.kt:4 : i=1:number +// test.kt:6 : +// test.kt:8 Derived_init_$Init$: p=3:number +// test.kt:16 box: +// test.kt:11 Derived_init_$Init$: p1=4:number, p2=5:number +// test.kt:6 : +// test.kt:4 : i=1:number +// test.kt:6 : +// test.kt:17 box: diff --git a/compiler/testData/debug/localVariables/constructors/property.kt b/compiler/testData/debug/localVariables/constructors/property.kt index 7351789b045..369c72a51dd 100644 --- a/compiler/testData/debug/localVariables/constructors/property.kt +++ b/compiler/testData/debug/localVariables/constructors/property.kt @@ -7,8 +7,14 @@ fun box() { F("foo") } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:7 box: // test.kt:4 : a:java.lang.String="foo":java.lang.String // test.kt:7 box: -// test.kt:8 box: \ No newline at end of file +// test.kt:8 box: + +// EXPECTATIONS JS_IR +// test.kt:7 box: +// test.kt:4 : a="foo":kotlin.String +// test.kt:4 : a="foo":kotlin.String +// test.kt:8 box: diff --git a/compiler/testData/debug/localVariables/copyFunction.kt b/compiler/testData/debug/localVariables/copyFunction.kt index 5c1a9e473c4..a86e40c515e 100644 --- a/compiler/testData/debug/localVariables/copyFunction.kt +++ b/compiler/testData/debug/localVariables/copyFunction.kt @@ -7,7 +7,7 @@ fun box() { val b = a.copy(b = 3.0) } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:6 box: // test.kt:3 : a:double=1.0:double, b:double=2.0:double // test.kt:6 box: @@ -15,4 +15,18 @@ fun box() { // test.kt:3 : a:double=1.0:double, b:double=3.0:double // test.kt:-1 copy: a:double=1.0:double, b:double=3.0:double // test.kt:7 box: a:someClass=someClass -// test.kt:8 box: a:someClass=someClass, b:someClass=someClass \ No newline at end of file +// test.kt:8 box: a:someClass=someClass, b:someClass=someClass + +// EXPECTATIONS JS_IR +// test.kt:6 box: +// test.kt:3 : a=1:number, b=2:number +// test.kt:3 : a=1:number, b=2:number +// test.kt:3 : a=1:number, b=2:number +// test.kt:7 box: a=someClass +// test.kt:1 copy$default: b=3:number +// test.kt:1 copy$default: a=1:number, b=3:number +// test.kt:1 copy: a=1:number, b=3:number +// test.kt:3 : a=1:number, b=3:number +// test.kt:3 : a=1:number, b=3:number +// test.kt:3 : a=1:number, b=3:number +// test.kt:8 box: a=someClass, b=someClass diff --git a/compiler/testData/debug/localVariables/destructuring/assignment.kt b/compiler/testData/debug/localVariables/destructuring/assignment.kt index 0c653846245..fc93d48edbe 100644 --- a/compiler/testData/debug/localVariables/destructuring/assignment.kt +++ b/compiler/testData/debug/localVariables/destructuring/assignment.kt @@ -9,10 +9,14 @@ fun box(): String { return o + k } -// EXPECTATIONS - +// EXPECTATIONS JVM JVM_IR // test.kt:5 box: // test.kt:7 box: p:kotlin.Pair=kotlin.Pair // test.kt:9 box: p:kotlin.Pair=kotlin.Pair, o:java.lang.String="O":java.lang.String, k:java.lang.String="K":java.lang.String - +// EXPECTATIONS JS_IR +// test.kt:5 box: +// test.kt:7 box: p=kotlin.Pair +// test.kt:7 box: p=kotlin.Pair +// test.kt:7 box: p=kotlin.Pair, o="O":kotlin.String +// test.kt:9 box: p=kotlin.Pair, o="O":kotlin.String, k="K":kotlin.String diff --git a/compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNs.kt b/compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNs.kt index 638248aae83..ebb0ccb9e98 100644 --- a/compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNs.kt +++ b/compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNs.kt @@ -17,20 +17,29 @@ fun box(): String { return o + k } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:15 box: // test.kt:4 : x:java.lang.String="X":java.lang.String, y:java.lang.String="Y":java.lang.String // test.kt:15 box: - // test.kt:16 box: p:MyPair=MyPair // test.kt:6 component1: // test.kt:16 box: p:MyPair=MyPair // test.kt:10 component2: - // EXPECTATIONS JVM // test.kt:16 box: p:MyPair=MyPair -// test.kt:17 box: p:MyPair=MyPair, o:java.lang.String="O":java.lang.String, k:java.lang.String="K":java.lang.String - // EXPECTATIONS JVM_IR // test.kt:16 box: p:MyPair=MyPair, o:java.lang.String="O":java.lang.String -// test.kt:17 box: p:MyPair=MyPair, o:java.lang.String="O":java.lang.String, k:java.lang.String="K":java.lang.String \ No newline at end of file +// EXPECTATIONS JVM JVM_IR +// test.kt:17 box: p:MyPair=MyPair, o:java.lang.String="O":java.lang.String, k:java.lang.String="K":java.lang.String + +// EXPECTATIONS JS_IR +// test.kt:15 box: +// test.kt:4 : x="X":kotlin.String, y="Y":kotlin.String +// test.kt:4 : x="X":kotlin.String, y="Y":kotlin.String +// test.kt:4 : x="X":kotlin.String, y="Y":kotlin.String +// test.kt:16 box: p=MyPair +// test.kt:16 box: p=MyPair +// test.kt:6 component1: +// test.kt:16 box: p=MyPair, o="O":kotlin.String +// test.kt:10 component2: +// test.kt:17 box: p=MyPair, o="O":kotlin.String, k="K":kotlin.String diff --git a/compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNsMultiline.kt b/compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNsMultiline.kt index 03028a4704d..0ad25420609 100644 --- a/compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNsMultiline.kt +++ b/compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNsMultiline.kt @@ -24,23 +24,29 @@ fun box(): String { return o + k } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:15 box: // test.kt:4 : x:java.lang.String="X":java.lang.String, y:java.lang.String="Y":java.lang.String // test.kt:15 box: - +// test.kt:23 box: p:MyPair=MyPair +// test.kt:6 component1: +// test.kt:18 box: p:MyPair=MyPair +// test.kt:10 component2: // EXPECTATIONS JVM -// test.kt:23 box: p:MyPair=MyPair -// test.kt:6 component1: -// test.kt:18 box: p:MyPair=MyPair -// test.kt:10 component2: // test.kt:20 box: p:MyPair=MyPair +// EXPECTATIONS JVM_IR +// test.kt:20 box: p:MyPair=MyPair, o:java.lang.String="O":java.lang.String +// EXPECTATIONS JVM JVM_IR // test.kt:24 box: p:MyPair=MyPair, o:java.lang.String="O":java.lang.String, k:java.lang.String="K":java.lang.String -// EXPECTATIONS JVM_IR -// test.kt:23 box: p:MyPair=MyPair +// EXPECTATIONS JS_IR +// test.kt:15 box: +// test.kt:4 : x="X":kotlin.String, y="Y":kotlin.String +// test.kt:4 : x="X":kotlin.String, y="Y":kotlin.String +// test.kt:4 : x="X":kotlin.String, y="Y":kotlin.String +// test.kt:23 box: p=MyPair +// test.kt:18 box: p=MyPair // test.kt:6 component1: -// test.kt:18 box: p:MyPair=MyPair +// test.kt:20 box: p=MyPair, o="O":kotlin.String // test.kt:10 component2: -// test.kt:20 box: p:MyPair=MyPair, o:java.lang.String="O":java.lang.String -// test.kt:24 box: p:MyPair=MyPair, o:java.lang.String="O":java.lang.String, k:java.lang.String="K":java.lang.String +// test.kt:24 box: p=MyPair, o="O":kotlin.String, k="K":kotlin.String diff --git a/compiler/testData/debug/localVariables/destructuring/assignmentMultiline.kt b/compiler/testData/debug/localVariables/destructuring/assignmentMultiline.kt index 2b33be2bf4d..9856af060e1 100644 --- a/compiler/testData/debug/localVariables/destructuring/assignmentMultiline.kt +++ b/compiler/testData/debug/localVariables/destructuring/assignmentMultiline.kt @@ -17,17 +17,20 @@ fun box(): String { return o + k } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:6 box: - +// test.kt:15 box: p:kotlin.Pair=kotlin.Pair +// test.kt:10 box: p:kotlin.Pair=kotlin.Pair // EXPECTATIONS JVM -// test.kt:15 box: p:kotlin.Pair=kotlin.Pair -// test.kt:10 box: p:kotlin.Pair=kotlin.Pair // test.kt:12 box: p:kotlin.Pair=kotlin.Pair +// EXPECTATIONS JVM_IR +// test.kt:12 box: p:kotlin.Pair=kotlin.Pair, o:java.lang.String="O":java.lang.String +// EXPECTATIONS JVM JVM_IR // test.kt:17 box: p:kotlin.Pair=kotlin.Pair, o:java.lang.String="O":java.lang.String, k:java.lang.String="K":java.lang.String -// EXPECTATIONS JVM_IR -// test.kt:15 box: p:kotlin.Pair=kotlin.Pair -// test.kt:10 box: p:kotlin.Pair=kotlin.Pair -// test.kt:12 box: p:kotlin.Pair=kotlin.Pair, o:java.lang.String="O":java.lang.String -// test.kt:17 box: p:kotlin.Pair=kotlin.Pair, o:java.lang.String="O":java.lang.String, k:java.lang.String="K":java.lang.String +// EXPECTATIONS JS_IR +// test.kt:6 box: +// test.kt:15 box: p=kotlin.Pair +// test.kt:10 box: p=kotlin.Pair +// test.kt:12 box: p=kotlin.Pair, o="O":kotlin.String +// test.kt:17 box: p=kotlin.Pair, o="O":kotlin.String, k="K":kotlin.String diff --git a/compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNames.kt b/compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNames.kt index 8fc35792821..3c9fe80c9da 100644 --- a/compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNames.kt +++ b/compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNames.kt @@ -9,7 +9,14 @@ fun box(): String { return o + k } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:5 box: // test.kt:7 box: p:kotlin.Triple=kotlin.Triple // test.kt:9 box: p:kotlin.Triple=kotlin.Triple, o:java.lang.String="O":java.lang.String, k:java.lang.String="K":java.lang.String + +// EXPECTATIONS JS_IR +// test.kt:5 box: +// test.kt:7 box: p=kotlin.Triple +// test.kt:7 box: p=kotlin.Triple +// test.kt:7 box: p=kotlin.Triple, o="O":kotlin.String +// test.kt:9 box: p=kotlin.Triple, o="O":kotlin.String, k="K":kotlin.String diff --git a/compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNamesMultiline.kt b/compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNamesMultiline.kt index 794c767bdd7..3386420c56e 100644 --- a/compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNamesMultiline.kt +++ b/compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNamesMultiline.kt @@ -19,22 +19,20 @@ fun box(): String { return o + k } -// EXPECTATIONS - -// EXPECTATIONS JVM +// EXPECTATIONS JVM JVM_IR // test.kt:6 box: - // test.kt:17 box: p:kotlin.Triple=kotlin.Triple // test.kt:12 box: p:kotlin.Triple=kotlin.Triple +// EXPECTATIONS JVM // test.kt:14 box: p:kotlin.Triple=kotlin.Triple - +// EXPECTATIONS JVM_IR +// test.kt:14 box: p:kotlin.Triple=kotlin.Triple, o:java.lang.String="O":java.lang.String +// EXPECTATIONS JVM JVM_IR // test.kt:19 box: p:kotlin.Triple=kotlin.Triple, o:java.lang.String="O":java.lang.String, k:java.lang.String="K":java.lang.String -// EXPECTATIONS JVM_IR +// EXPECTATIONS JS_IR // test.kt:6 box: - -// test.kt:17 box: p:kotlin.Triple=kotlin.Triple -// test.kt:12 box: p:kotlin.Triple=kotlin.Triple -// test.kt:14 box: p:kotlin.Triple=kotlin.Triple, o:java.lang.String="O":java.lang.String - -// test.kt:19 box: p:kotlin.Triple=kotlin.Triple, o:java.lang.String="O":java.lang.String, k:java.lang.String="K":java.lang.String \ No newline at end of file +// test.kt:17 box: p=kotlin.Triple +// test.kt:12 box: p=kotlin.Triple +// test.kt:14 box: p=kotlin.Triple, o="O":kotlin.String +// test.kt:19 box: p=kotlin.Triple, o="O":kotlin.String, k="K":kotlin.String diff --git a/compiler/testData/debug/localVariables/destructuring/forLoop.kt b/compiler/testData/debug/localVariables/destructuring/forLoop.kt index 1611eeea974..c35c012a753 100644 --- a/compiler/testData/debug/localVariables/destructuring/forLoop.kt +++ b/compiler/testData/debug/localVariables/destructuring/forLoop.kt @@ -8,9 +8,21 @@ fun box() { } } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:5 box: // test.kt:6 box: map:java.util.Map=java.util.Collections$SingletonMap // test.kt:7 box: map:java.util.Map=java.util.Collections$SingletonMap, a:java.lang.String="1":java.lang.String, b:java.lang.String="23":java.lang.String // test.kt:6 box: map:java.util.Map=java.util.Collections$SingletonMap // test.kt:9 box: map:java.util.Map=java.util.Collections$SingletonMap + +// EXPECTATIONS JS_IR +// test.kt:5 box: +// test.kt:5 box: +// test.kt:6 box: map=kotlin.collections.HashMap +// test.kt:6 box: map=kotlin.collections.HashMap +// test.kt:6 box: map=kotlin.collections.HashMap +// test.kt:6 box: map=kotlin.collections.HashMap +// test.kt:6 box: map=kotlin.collections.HashMap, a="1":kotlin.String +// test.kt:7 box: map=kotlin.collections.HashMap, a="1":kotlin.String, b="23":kotlin.String +// test.kt:6 box: map=kotlin.collections.HashMap, a="1":kotlin.String, b="23":kotlin.String +// test.kt:9 box: map=kotlin.collections.HashMap, a="1":kotlin.String, b="23":kotlin.String diff --git a/compiler/testData/debug/localVariables/destructuring/forLoopMultiline.kt b/compiler/testData/debug/localVariables/destructuring/forLoopMultiline.kt index 1f9e06cf154..107783ae5f9 100644 --- a/compiler/testData/debug/localVariables/destructuring/forLoopMultiline.kt +++ b/compiler/testData/debug/localVariables/destructuring/forLoopMultiline.kt @@ -20,29 +20,33 @@ fun box() { } } -// EXPECTATIONS - // EXPECTATIONS JVM // test.kt:6 box: // test.kt:16 box: map:java.util.Map=java.util.Collections$SingletonMap - // test.kt:8 box: map:java.util.Map=java.util.Collections$SingletonMap // test.kt:11 box: map:java.util.Map=java.util.Collections$SingletonMap // test.kt:13 box: map:java.util.Map=java.util.Collections$SingletonMap // test.kt:19 box: map:java.util.Map=java.util.Collections$SingletonMap, a:java.lang.String="1":java.lang.String, b:java.lang.String="23":java.lang.String - // test.kt:8 box: map:java.util.Map=java.util.Collections$SingletonMap - // test.kt:21 box: map:java.util.Map=java.util.Collections$SingletonMap // EXPECTATIONS JVM_IR // test.kt:6 box: // test.kt:16 box: map:java.util.Map=java.util.Collections$SingletonMap - // test.kt:11 box: map:java.util.Map=java.util.Collections$SingletonMap // test.kt:13 box: map:java.util.Map=java.util.Collections$SingletonMap, a:java.lang.String="1":java.lang.String - // test.kt:19 box: map:java.util.Map=java.util.Collections$SingletonMap, a:java.lang.String="1":java.lang.String, b:java.lang.String="23":java.lang.String - // test.kt:8 box: map:java.util.Map=java.util.Collections$SingletonMap // test.kt:21 box: map:java.util.Map=java.util.Collections$SingletonMap + +// EXPECTATIONS JS_IR +// test.kt:6 box: +// test.kt:6 box: +// test.kt:16 box: map=kotlin.collections.HashMap +// test.kt:16 box: map=kotlin.collections.HashMap +// test.kt:16 box: map=kotlin.collections.HashMap +// test.kt:11 box: map=kotlin.collections.HashMap +// test.kt:13 box: map=kotlin.collections.HashMap, a="1":kotlin.String +// test.kt:19 box: map=kotlin.collections.HashMap, a="1":kotlin.String, b="23":kotlin.String +// test.kt:16 box: map=kotlin.collections.HashMap, a="1":kotlin.String, b="23":kotlin.String +// test.kt:21 box: map=kotlin.collections.HashMap, a="1":kotlin.String, b="23":kotlin.String diff --git a/compiler/testData/debug/localVariables/destructuring/lambda.kt b/compiler/testData/debug/localVariables/destructuring/lambda.kt index 07366c66eb0..1fb7c53a255 100644 --- a/compiler/testData/debug/localVariables/destructuring/lambda.kt +++ b/compiler/testData/debug/localVariables/destructuring/lambda.kt @@ -9,7 +9,6 @@ fun box() { foo(A("O", 123)) { (x, y) -> x + y } } -// EXPECTATIONS // EXPECTATIONS JVM // test.kt:9 box: // test.kt:4 : x:java.lang.String="O":java.lang.String, y:int=123:int @@ -28,4 +27,18 @@ fun box() { // test.kt:9 invoke: x:java.lang.String="O":java.lang.String, y:int=123:int // test.kt:6 foo: a:A=A, block:kotlin.jvm.functions.Function1=TestKt$box$1 // test.kt:9 box: -// test.kt:10 box: \ No newline at end of file +// test.kt:10 box: + +// EXPECTATIONS JS_IR +// test.kt:9 box: +// test.kt:4 : x="O":kotlin.String, y=123:number +// test.kt:4 : x="O":kotlin.String, y=123:number +// test.kt:4 : x="O":kotlin.String, y=123:number +// test.kt:9 box: +// test.kt:6 foo: a=A, block=Function1 +// test.kt:9 box$lambda: +// test.kt:1 component1: +// test.kt:9 box$lambda: x="O":kotlin.String +// test.kt:1 component2: +// test.kt:9 box$lambda: x="O":kotlin.String, y=123:number +// test.kt:10 box: diff --git a/compiler/testData/debug/localVariables/destructuring/lambdaCustomComponentNs.kt b/compiler/testData/debug/localVariables/destructuring/lambdaCustomComponentNs.kt index 7063737e3e5..2a25af61902 100644 --- a/compiler/testData/debug/localVariables/destructuring/lambdaCustomComponentNs.kt +++ b/compiler/testData/debug/localVariables/destructuring/lambdaCustomComponentNs.kt @@ -17,8 +17,6 @@ fun box() { foo(MyPair("X", "Y")) { (x, y) -> x + y } } -// EXPECTATIONS - // EXPECTATIONS JVM // test.kt:17 box: // test.kt:4 : x:java.lang.String="X":java.lang.String, y:java.lang.String="Y":java.lang.String @@ -45,4 +43,18 @@ fun box() { // test.kt:17 invoke: x:java.lang.String="O":java.lang.String, y:java.lang.String="K":java.lang.String // test.kt:14 foo: a:MyPair=MyPair, block:kotlin.jvm.functions.Function1=TestKt$box$1 // test.kt:17 box: -// test.kt:18 box: \ No newline at end of file +// test.kt:18 box: + +// EXPECTATIONS JS_IR +// test.kt:17 box: +// test.kt:4 : x="X":kotlin.String, y="Y":kotlin.String +// test.kt:4 : x="X":kotlin.String, y="Y":kotlin.String +// test.kt:4 : x="X":kotlin.String, y="Y":kotlin.String +// test.kt:17 box: +// test.kt:14 foo: a=MyPair, block=Function1 +// test.kt:17 box$lambda: +// test.kt:6 component1: +// test.kt:17 box$lambda: x="O":kotlin.String +// test.kt:10 component2: +// test.kt:17 box$lambda: x="O":kotlin.String, y="K":kotlin.String +// test.kt:18 box: diff --git a/compiler/testData/debug/localVariables/destructuring/lambdaCustomComponentNsMultiline.kt b/compiler/testData/debug/localVariables/destructuring/lambdaCustomComponentNsMultiline.kt index 560b8d1ee1c..5f1fe59aae2 100644 --- a/compiler/testData/debug/localVariables/destructuring/lambdaCustomComponentNsMultiline.kt +++ b/compiler/testData/debug/localVariables/destructuring/lambdaCustomComponentNsMultiline.kt @@ -26,8 +26,6 @@ fun box() { } } -// EXPECTATIONS - // EXPECTATIONS JVM // test.kt:17 box: // test.kt:4 : x:java.lang.String="X":java.lang.String, y:java.lang.String="Y":java.lang.String @@ -57,4 +55,18 @@ fun box() { // test.kt:25 invoke: x:java.lang.String="O":java.lang.String, y:java.lang.String="K":java.lang.String // test.kt:14 foo: a:MyPair=MyPair, block:kotlin.jvm.functions.Function1=TestKt$box$1 // test.kt:17 box: -// test.kt:27 box: \ No newline at end of file +// test.kt:27 box: + +// EXPECTATIONS JS_IR +// test.kt:17 box: +// test.kt:4 : x="X":kotlin.String, y="Y":kotlin.String +// test.kt:4 : x="X":kotlin.String, y="Y":kotlin.String +// test.kt:4 : x="X":kotlin.String, y="Y":kotlin.String +// test.kt:17 box: +// test.kt:14 foo: a=MyPair, block=Function1 +// test.kt:20 box$lambda: +// test.kt:6 component1: +// test.kt:22 box$lambda: x="O":kotlin.String +// test.kt:10 component2: +// test.kt:25 box$lambda: x="O":kotlin.String, y="K":kotlin.String +// test.kt:27 box: diff --git a/compiler/testData/debug/localVariables/destructuring/lambdaMultiline.kt b/compiler/testData/debug/localVariables/destructuring/lambdaMultiline.kt index 38936f13218..f28ef82a347 100644 --- a/compiler/testData/debug/localVariables/destructuring/lambdaMultiline.kt +++ b/compiler/testData/debug/localVariables/destructuring/lambdaMultiline.kt @@ -20,8 +20,6 @@ fun box() { return } -// EXPECTATIONS - // EXPECTATIONS JVM // test.kt:9 box: // test.kt:4 : x:java.lang.String="O":java.lang.String, y:int=123:int @@ -45,4 +43,18 @@ fun box() { // test.kt:17 invoke: x:java.lang.String="O":java.lang.String, y:int=123:int // test.kt:6 foo: a:A=A, block:kotlin.jvm.functions.Function1=TestKt$box$1 // test.kt:9 box: -// test.kt:20 box: \ No newline at end of file +// test.kt:20 box: + +// EXPECTATIONS JS_IR +// test.kt:9 box: +// test.kt:4 : x="O":kotlin.String, y=123:number +// test.kt:4 : x="O":kotlin.String, y=123:number +// test.kt:4 : x="O":kotlin.String, y=123:number +// test.kt:9 box: +// test.kt:6 foo: a=A, block=Function1 +// test.kt:12 box$lambda: +// test.kt:1 component1: +// test.kt:14 box$lambda: x="O":kotlin.String +// test.kt:1 component2: +// test.kt:17 box$lambda: x="O":kotlin.String, y=123:number +// test.kt:20 box: diff --git a/compiler/testData/debug/localVariables/destructuring/lambdaMultipleDestructs.kt b/compiler/testData/debug/localVariables/destructuring/lambdaMultipleDestructs.kt index 81ae36f0ccf..71beec84313 100644 --- a/compiler/testData/debug/localVariables/destructuring/lambdaMultipleDestructs.kt +++ b/compiler/testData/debug/localVariables/destructuring/lambdaMultipleDestructs.kt @@ -9,8 +9,6 @@ fun box() { foo(A("O", 123), A("K", 877)) { (x, y), (z, w) -> (x + z) + (y + w) } } -// EXPECTATIONS - // EXPECTATIONS JVM // test.kt:9 box: // test.kt:4 : x:java.lang.String="O":java.lang.String, y:int=123:int @@ -33,4 +31,26 @@ fun box() { // test.kt:9 invoke: x:java.lang.String="O":java.lang.String, y:int=123:int, z:java.lang.String="K":java.lang.String, w:int=877:int // test.kt:6 foo: a:A=A, b:A=A, block:kotlin.jvm.functions.Function2=TestKt$box$1 // test.kt:9 box: -// test.kt:10 box: \ No newline at end of file +// test.kt:10 box: + +// EXPECTATIONS JS_IR +// test.kt:9 box: +// test.kt:4 : x="O":kotlin.String, y=123:number +// test.kt:4 : x="O":kotlin.String, y=123:number +// test.kt:4 : x="O":kotlin.String, y=123:number +// test.kt:9 box: +// test.kt:4 : x="K":kotlin.String, y=877:number +// test.kt:4 : x="K":kotlin.String, y=877:number +// test.kt:4 : x="K":kotlin.String, y=877:number +// test.kt:9 box: +// test.kt:6 foo: a=A, b=A, block=Function2 +// test.kt:9 box$lambda: +// test.kt:1 component1: +// test.kt:9 box$lambda: x="O":kotlin.String +// test.kt:1 component2: +// test.kt:9 box$lambda: x="O":kotlin.String, y=123:number +// test.kt:1 component1: +// test.kt:9 box$lambda: x="O":kotlin.String, y=123:number, z="K":kotlin.String +// test.kt:1 component2: +// test.kt:9 box$lambda: x="O":kotlin.String, y=123:number, z="K":kotlin.String, w=877:number +// test.kt:10 box: diff --git a/compiler/testData/debug/localVariables/directInvoke.kt b/compiler/testData/debug/localVariables/directInvoke.kt index ff5e5cd24fd..c097e35b41b 100644 --- a/compiler/testData/debug/localVariables/directInvoke.kt +++ b/compiler/testData/debug/localVariables/directInvoke.kt @@ -5,7 +5,7 @@ fun box() { }("O", "K") } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // EXPECTATIONS JVM_IR // test.kt:5 box: // test.kt:4 box: a:java.lang.String="O":java.lang.String, b:java.lang.String="K":java.lang.String @@ -14,5 +14,10 @@ fun box() { // test.kt:5 box: // test.kt:4 invoke: a:java.lang.String="O":java.lang.String, b:java.lang.String="K":java.lang.String // test.kt:5 box: -// EXPECTATIONS -// test.kt:6 box: \ No newline at end of file +// EXPECTATIONS JVM JVM_IR +// test.kt:6 box: + +// EXPECTATIONS JS_IR +// test.kt:3 box: +// test.kt:4 box$lambda: a="O":kotlin.String, b="K":kotlin.String +// test.kt:6 box: diff --git a/compiler/testData/debug/localVariables/doWhile.kt b/compiler/testData/debug/localVariables/doWhile.kt index c08cee1b36d..8d6afc9a9ef 100644 --- a/compiler/testData/debug/localVariables/doWhile.kt +++ b/compiler/testData/debug/localVariables/doWhile.kt @@ -16,7 +16,7 @@ fun box() { } while (x < z) } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:6 box: // test.kt:8 box: x:int=0:int // test.kt:9 box: x:int=0:int, z:int=2:int @@ -30,4 +30,22 @@ fun box() { // test.kt:9 box: x:int=2:int, z:int=2:int // test.kt:15 box: x:int=2:int, z:int=2:int // test.kt:16 box: x:int=2:int, z:int=2:int -// test.kt:17 box: x:int=2:int \ No newline at end of file +// test.kt:17 box: x:int=2:int + +// EXPECTATIONS JS_IR +// test.kt:6 box: +// test.kt:8 box: x=0:number +// test.kt:9 box: x=0:number, z=2:number +// test.kt:9 box: x=0:number, z=2:number +// test.kt:9 box: x=1:number, z=2:number +// test.kt:3 shouldContinue: i=0:number +// test.kt:10 box: x=1:number, z=2:number +// test.kt:16 box: x=1:number, z=2:number +// test.kt:8 box: x=1:number, z=2:number +// test.kt:9 box: x=1:number, z=2:number +// test.kt:9 box: x=1:number, z=2:number +// test.kt:9 box: x=2:number, z=2:number +// test.kt:3 shouldContinue: i=1:number +// test.kt:15 box: x=2:number, z=2:number +// test.kt:16 box: x=2:number, z=2:number, y=12:number +// test.kt:17 box: x=2:number, z=2:number, y=12:number diff --git a/compiler/testData/debug/localVariables/emptyFun.kt b/compiler/testData/debug/localVariables/emptyFun.kt index 4598ff15b82..59529de975d 100644 --- a/compiler/testData/debug/localVariables/emptyFun.kt +++ b/compiler/testData/debug/localVariables/emptyFun.kt @@ -10,4 +10,4 @@ fun box() { // EXPECTATIONS // test.kt:7 box: // test.kt:4 foo: -// test.kt:8 box: \ No newline at end of file +// test.kt:8 box: diff --git a/compiler/testData/debug/localVariables/forLoopMultiline.kt b/compiler/testData/debug/localVariables/forLoopMultiline.kt index 56480266b61..7b9e006a033 100644 --- a/compiler/testData/debug/localVariables/forLoopMultiline.kt +++ b/compiler/testData/debug/localVariables/forLoopMultiline.kt @@ -16,8 +16,6 @@ fun box() { } } -// EXPECTATIONS - // EXPECTATIONS JVM // test.kt:6 box: // test.kt:12 box: map:java.util.Map=java.util.Collections$SingletonMap @@ -33,3 +31,14 @@ fun box() { // test.kt:15 box: map:java.util.Map=java.util.Collections$SingletonMap, e:java.util.Map$Entry=java.util.AbstractMap$SimpleImmutableEntry // test.kt:8 box: map:java.util.Map=java.util.Collections$SingletonMap // test.kt:17 box: map:java.util.Map=java.util.Collections$SingletonMap + +// EXPECTATIONS JS_IR +// test.kt:6 box: +// test.kt:6 box: +// test.kt:12 box: map=kotlin.collections.HashMap +// test.kt:12 box: map=kotlin.collections.HashMap +// test.kt:12 box: map=kotlin.collections.HashMap +// test.kt:15 box: map=kotlin.collections.HashMap, e=kotlin.collections.AbstractMutableMap.SimpleEntry +// test.kt:15 box: map=kotlin.collections.HashMap, e=kotlin.collections.AbstractMutableMap.SimpleEntry +// test.kt:12 box: map=kotlin.collections.HashMap, e=kotlin.collections.AbstractMutableMap.SimpleEntry +// test.kt:17 box: map=kotlin.collections.HashMap, e=kotlin.collections.AbstractMutableMap.SimpleEntry diff --git a/compiler/testData/debug/localVariables/inlineProperty.kt b/compiler/testData/debug/localVariables/inlineProperty.kt index 79754832a83..a4b7d03c317 100644 --- a/compiler/testData/debug/localVariables/inlineProperty.kt +++ b/compiler/testData/debug/localVariables/inlineProperty.kt @@ -10,7 +10,7 @@ fun box() { y++ } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:8 box: // test.kt:2 : // test.kt:8 box: @@ -18,4 +18,13 @@ fun box() { // test.kt:4 box: a:A=A, this_$iv:A=A, $i$f$getS:int=0:int // test.kt:9 box: a:A=A // test.kt:10 box: a:A=A, y:int=1:int -// test.kt:11 box: a:A=A, y:int=2:int \ No newline at end of file +// test.kt:11 box: a:A=A, y:int=2:int + +// EXPECTATIONS JS_IR +// test.kt:8 box: +// test.kt:2 : +// test.kt:4 box: a=A +// test.kt:9 box: a=A +// test.kt:10 box: a=A, y=1:number +// test.kt:10 box: a=A, y=1:number +// test.kt:11 box: a=A, y=2:number diff --git a/compiler/testData/debug/localVariables/jsCode.kt b/compiler/testData/debug/localVariables/jsCode.kt new file mode 100644 index 00000000000..52f91ac7f4a --- /dev/null +++ b/compiler/testData/debug/localVariables/jsCode.kt @@ -0,0 +1,90 @@ +// TARGET_BACKEND: JS_IR + +// FILE: a.kt +@JsExport +fun exclamate(s: String) = + "$s!" + +@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@JsFun(""" + function (a, b) { + return _.exclamate(a) + + _.exclamate(b); + } +""") +external fun exclamateAndConcat(`a!`: String, `b!`: String): String + +@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@JsPolyfill(""" +if (typeof String.prototype.myAwesomePolyfill === "undefined") { + Object.defineProperty(String.prototype, "myAwesomePolyfill", { + value: function () { + return this + "!"; + } + }); +} +""") +internal inline fun String.myAwesomePolyfill(): Boolean = + asDynamic() + .myAwesomePolyfill() + +val walter1VarDecl = "var walter1 = _.exclamate('Walter');" +val jesse1VarDecl = "var jesse1 = _.exclamate(jesse);" + +// FILE: test.kt + + + +fun box() { + + exclamateAndConcat( + "hello", + "world") + val jesse = "Jesse" + js( + "_.exclamate(jesse);") // Local variable is captured + js( + "_.exclamate('Walter');") // No local variables captured + js( + walter1VarDecl + + "_.exclamate(walter1);") + js( + jesse1VarDecl + + "_.exclamate(jesse1);") + + "foo".myAwesomePolyfill() + + js(""" + function localFun(hello, world) { + return '' + hello + ', ' + world + '!'; + } + """) + + js("localFun('hello', 'world')") +} + +// EXPECTATIONS +// test.kt:41 box: +// test.kt:42 box: a!="hello":kotlin.String +// a.kt:11 box: a!="hello":kotlin.String, b!="world":kotlin.String +// a.kt:6 exclamate: s="hello":kotlin.String +// a.kt:12 box: a!="hello":kotlin.String, b!="world":kotlin.String +// a.kt:6 exclamate: s="world":kotlin.String +// test.kt:43 box: a!="hello":kotlin.String, b!="world":kotlin.String +// test.kt:45 box: a!="hello":kotlin.String, b!="world":kotlin.String, jesse="Jesse":kotlin.String +// a.kt:6 exclamate: s="Jesse":kotlin.String +// test.kt:47 box: a!="hello":kotlin.String, b!="world":kotlin.String, jesse="Jesse":kotlin.String +// a.kt:6 exclamate: s="Walter":kotlin.String +// test.kt:49 box: a!="hello":kotlin.String, b!="world":kotlin.String, jesse="Jesse":kotlin.String +// a.kt:6 exclamate: s="Walter":kotlin.String +// test.kt:49 box: a!="hello":kotlin.String, b!="world":kotlin.String, jesse="Jesse":kotlin.String, walter1="Walter!":kotlin.String +// a.kt:6 exclamate: s="Walter!":kotlin.String +// test.kt:52 box: a!="hello":kotlin.String, b!="world":kotlin.String, jesse="Jesse":kotlin.String, walter1="Walter!":kotlin.String +// a.kt:6 exclamate: s="Jesse":kotlin.String +// test.kt:52 box: a!="hello":kotlin.String, b!="world":kotlin.String, jesse="Jesse":kotlin.String, walter1="Walter!":kotlin.String, jesse1="Jesse!":kotlin.String +// a.kt:6 exclamate: s="Jesse!":kotlin.String +// a.kt:29 box: a!="hello":kotlin.String, b!="world":kotlin.String, jesse="Jesse":kotlin.String, walter1="Walter!":kotlin.String, jesse1="Jesse!":kotlin.String +// a.kt:22 value: +// test.kt:63 box: a!="hello":kotlin.String, b!="world":kotlin.String, jesse="Jesse":kotlin.String, walter1="Walter!":kotlin.String, jesse1="Jesse!":kotlin.String +// test.kt:59 localFun: hello="hello":kotlin.String, world="world":kotlin.String +// test.kt:64 box: a!="hello":kotlin.String, b!="world":kotlin.String, jesse="Jesse":kotlin.String, walter1="Walter!":kotlin.String, jesse1="Jesse!":kotlin.String diff --git a/compiler/testData/debug/localVariables/jvmOverloads.kt b/compiler/testData/debug/localVariables/jvmOverloads.kt index 4f5eff8fe29..cfe0dc53ea8 100644 --- a/compiler/testData/debug/localVariables/jvmOverloads.kt +++ b/compiler/testData/debug/localVariables/jvmOverloads.kt @@ -1,3 +1,4 @@ +// TARGET_BACKEND: JVM // WITH_STDLIB // FILE: test.kt class C { @@ -9,9 +10,9 @@ fun box() { C().foo(4) } -// EXPECTATIONS -// test.kt:9 box: -// test.kt:3 : -// test.kt:9 box: -// test.kt:5 foo: firstParam:int=4:int, secondParam:java.lang.String="":java.lang.String +// EXPECTATIONS JVM JVM_IR // test.kt:10 box: +// test.kt:4 : +// test.kt:10 box: +// test.kt:6 foo: firstParam:int=4:int, secondParam:java.lang.String="":java.lang.String +// test.kt:11 box: diff --git a/compiler/testData/debug/localVariables/localFun.kt b/compiler/testData/debug/localVariables/localFun.kt index 4309c736694..120156a7021 100644 --- a/compiler/testData/debug/localVariables/localFun.kt +++ b/compiler/testData/debug/localVariables/localFun.kt @@ -27,27 +27,32 @@ fun box() { // variables local to the function, and hence need no name mangling to // properly figure in the debugger. -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:13 box: // test.kt:5 foo: - // EXPECTATIONS JVM // test.kt:6 foo: x:int=1:int // test.kt:9 foo: x:int=1:int, $fun$bar$1:TestKt$foo$1=TestKt$foo$1 - // EXPECTATIONS JVM_IR // test.kt:9 foo: x:int=1:int - // EXPECTATIONS JVM // test.kt:7 invoke: // test.kt:8 invoke: y:int=1:int // EXPECTATIONS JVM_IR // test.kt:7 foo$bar: x:int=1:int // test.kt:8 foo$bar: x:int=1:int, y:int=1:int - // EXPECTATIONS JVM // test.kt:10 foo: x:int=1:int, $fun$bar$1:TestKt$foo$1=TestKt$foo$1 // test.kt:14 box: // EXPECTATIONS JVM_IR // test.kt:10 foo: x:int=1:int // test.kt:14 box: + +// EXPECTATIONS JS_IR +// test.kt:13 box: +// test.kt:5 foo: +// test.kt:9 foo: x=1:number +// test.kt:7 foo$bar: x=1:number +// test.kt:8 foo$bar: x=1:number, y=1:number +// test.kt:10 foo: x=1:number +// test.kt:14 box: diff --git a/compiler/testData/debug/localVariables/localFunUnused.kt b/compiler/testData/debug/localVariables/localFunUnused.kt index 7a9ecc4e852..60e7dcd2ee8 100644 --- a/compiler/testData/debug/localVariables/localFunUnused.kt +++ b/compiler/testData/debug/localVariables/localFunUnused.kt @@ -18,14 +18,13 @@ fun box() { // - the _declaration_ of the local function does not figure in the byte code // of the outer function and hence, has no line number -// EXPECTATIONS // EXPECTATIONS JVM // test.kt:10 box: // test.kt:5 foo: // test.kt:7 foo: $fun$bar$1:TestKt$foo$1=TestKt$foo$1 // test.kt:11 box: -// EXPECTATIONS JVM_IR +// EXPECTATIONS JVM_IR JS_IR // test.kt:10 box: // test.kt:7 foo: -// test.kt:11 box: \ No newline at end of file +// test.kt:11 box: diff --git a/compiler/testData/debug/localVariables/receiverMangling/capturedThisField.kt b/compiler/testData/debug/localVariables/receiverMangling/capturedThisField.kt index a518eb2ce27..58c0786c4e3 100644 --- a/compiler/testData/debug/localVariables/receiverMangling/capturedThisField.kt +++ b/compiler/testData/debug/localVariables/receiverMangling/capturedThisField.kt @@ -11,11 +11,19 @@ fun box() { x.Bar() } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:10 box: // test.kt:4 : // test.kt:10 box: // test.kt:11 box: x:Foo=Foo // test.kt:5 : // test.kt:11 box: x:Foo=Foo -// test.kt:12 box: x:Foo=Foo \ No newline at end of file +// test.kt:12 box: x:Foo=Foo + +// EXPECTATIONS JS_IR +// test.kt:10 box: +// test.kt:4 : +// test.kt:11 box: x=Foo +// test.kt:5 : +// test.kt:5 : +// test.kt:12 box: x=Foo diff --git a/compiler/testData/debug/localVariables/receiverMangling/labeledThisParameterLabel.kt b/compiler/testData/debug/localVariables/receiverMangling/labeledThisParameterLabel.kt index 9faf915225d..2959aa158d4 100644 --- a/compiler/testData/debug/localVariables/receiverMangling/labeledThisParameterLabel.kt +++ b/compiler/testData/debug/localVariables/receiverMangling/labeledThisParameterLabel.kt @@ -10,10 +10,16 @@ fun box() { } } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:8 box: // test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1 // test.kt:9 invoke: $this$blockFun:java.lang.String="OK":java.lang.String // test.kt:10 invoke: $this$blockFun:java.lang.String="OK":java.lang.String // test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1 // test.kt:11 box: + +// EXPECTATIONS JS_IR +// test.kt:8 box: +// test.kt:5 blockFun: blockArg=Function1 +// test.kt:10 box$lambda: $this$blockFun="OK":kotlin.String +// test.kt:11 box: diff --git a/compiler/testData/debug/localVariables/receiverMangling/lambdaWithExtensionReceiver.kt b/compiler/testData/debug/localVariables/receiverMangling/lambdaWithExtensionReceiver.kt index 08b89b73409..937f7163457 100644 --- a/compiler/testData/debug/localVariables/receiverMangling/lambdaWithExtensionReceiver.kt +++ b/compiler/testData/debug/localVariables/receiverMangling/lambdaWithExtensionReceiver.kt @@ -10,10 +10,17 @@ fun box() { } } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:8 box: // test.kt:4 foo: block:kotlin.jvm.functions.Function1=TestKt$box$1 // test.kt:9 invoke: $this$foo:long=1:long // test.kt:4 foo: block:kotlin.jvm.functions.Function1=TestKt$box$1 // test.kt:8 box: -// test.kt:11 box: \ No newline at end of file +// test.kt:11 box: + +// EXPECTATIONS JS_IR +// test.kt:8 box: +// test.kt:4 foo: block=Function1 +// test.kt:4 foo: block=Function1 +// test.kt:9 box$lambda: $this$foo=kotlin.Long +// test.kt:11 box: diff --git a/compiler/testData/debug/localVariables/receiverMangling/receiverParameter.kt b/compiler/testData/debug/localVariables/receiverMangling/receiverParameter.kt index 4def4eeec36..cbcd5aa6c9a 100644 --- a/compiler/testData/debug/localVariables/receiverMangling/receiverParameter.kt +++ b/compiler/testData/debug/localVariables/receiverMangling/receiverParameter.kt @@ -7,7 +7,12 @@ fun box() { "OK".test() } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:7 box: // test.kt:4 test: $this$test:java.lang.String="OK":java.lang.String -// test.kt:8 box: \ No newline at end of file +// test.kt:8 box: + +// EXPECTATIONS JS_IR +// test.kt:7 box: +// test.kt:4 test: ="OK":kotlin.String +// test.kt:8 box: diff --git a/compiler/testData/debug/localVariables/receiverMangling/simple.kt b/compiler/testData/debug/localVariables/receiverMangling/simple.kt index 72bf99e79e8..e79bbccf150 100644 --- a/compiler/testData/debug/localVariables/receiverMangling/simple.kt +++ b/compiler/testData/debug/localVariables/receiverMangling/simple.kt @@ -7,7 +7,12 @@ fun box() { "OK".foo(42) } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:7 box: // test.kt:4 foo: $this$foo:java.lang.String="OK":java.lang.String, a:int=42:int -// test.kt:8 box: \ No newline at end of file +// test.kt:8 box: + +// EXPECTATIONS JS_IR +// test.kt:7 box: +// test.kt:4 foo: ="OK":kotlin.String, a=42:number +// test.kt:8 box: diff --git a/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiver.kt b/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiver.kt index 9faf915225d..2959aa158d4 100644 --- a/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiver.kt +++ b/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiver.kt @@ -10,10 +10,16 @@ fun box() { } } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:8 box: // test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1 // test.kt:9 invoke: $this$blockFun:java.lang.String="OK":java.lang.String // test.kt:10 invoke: $this$blockFun:java.lang.String="OK":java.lang.String // test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1 // test.kt:11 box: + +// EXPECTATIONS JS_IR +// test.kt:8 box: +// test.kt:5 blockFun: blockArg=Function1 +// test.kt:10 box$lambda: $this$blockFun="OK":kotlin.String +// test.kt:11 box: diff --git a/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithLabel.kt b/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithLabel.kt index 8ebe70b39bb..feb6d28072e 100644 --- a/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithLabel.kt +++ b/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithLabel.kt @@ -10,10 +10,16 @@ fun box() { } } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:8 box: // test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1 // test.kt:9 invoke: $this$label:java.lang.String="OK":java.lang.String // test.kt:10 invoke: $this$label:java.lang.String="OK":java.lang.String // test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1 // test.kt:11 box: + +// EXPECTATIONS JS_IR +// test.kt:8 box: +// test.kt:5 blockFun: blockArg=Function1 +// test.kt:10 box$lambda: $this$label="OK":kotlin.String +// test.kt:11 box: diff --git a/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithParenthesis.kt b/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithParenthesis.kt index 1c82b191191..78b6db52518 100644 --- a/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithParenthesis.kt +++ b/compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithParenthesis.kt @@ -10,10 +10,16 @@ fun box() { }) } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:8 box: // test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1 // test.kt:9 invoke: $this$blockFun:java.lang.String="OK":java.lang.String // test.kt:10 invoke: $this$blockFun:java.lang.String="OK":java.lang.String // test.kt:5 blockFun: blockArg:kotlin.jvm.functions.Function1=TestKt$box$1 // test.kt:11 box: + +// EXPECTATIONS JS_IR +// test.kt:8 box: +// test.kt:5 blockFun: blockArg=Function1 +// test.kt:10 box$lambda: $this$blockFun="OK":kotlin.String +// test.kt:11 box: diff --git a/compiler/testData/debug/localVariables/suspend/completion/nonStaticSimple.kt b/compiler/testData/debug/localVariables/suspend/completion/nonStaticSimple.kt index f444b63e8e7..e11ddb0cc5f 100644 --- a/compiler/testData/debug/localVariables/suspend/completion/nonStaticSimple.kt +++ b/compiler/testData/debug/localVariables/suspend/completion/nonStaticSimple.kt @@ -9,10 +9,16 @@ suspend fun box() { A().foo() } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:9 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:4 : // test.kt:9 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:5 foo: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:9 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:10 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 + +// EXPECTATIONS JS_IR +// test.kt:9 box: $completion=EmptyContinuation +// test.kt:4 : +// test.kt:9 box: $completion=EmptyContinuation +// test.kt:5 foo: $completion=EmptyContinuation diff --git a/compiler/testData/debug/localVariables/suspend/completion/nonStaticStateMachine.kt b/compiler/testData/debug/localVariables/suspend/completion/nonStaticStateMachine.kt index 7f4d629b661..dad0c88650d 100644 --- a/compiler/testData/debug/localVariables/suspend/completion/nonStaticStateMachine.kt +++ b/compiler/testData/debug/localVariables/suspend/completion/nonStaticStateMachine.kt @@ -14,7 +14,7 @@ suspend fun box() { A().foo1(42) } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:14 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:4 : // test.kt:14 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 @@ -29,3 +29,15 @@ suspend fun box() { // test.kt:10 foo1: $continuation:kotlin.coroutines.Continuation=A$foo1$1, $result:java.lang.Object=null, l:long=42:long // test.kt:14 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:15 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 + +// EXPECTATIONS JS_IR +// test.kt:14 box: $completion=EmptyContinuation +// test.kt:4 : +// test.kt:14 box: $completion=EmptyContinuation +// test.kt:14 box: $completion=EmptyContinuation +// test.kt:7 doResume: +// test.kt:5 foo: $completion=$foo1COROUTINE$0 +// test.kt:8 doResume: +// test.kt:5 foo: $completion=$foo1COROUTINE$0 +// test.kt:9 doResume: +// test.kt:10 doResume: dead=kotlin.Long diff --git a/compiler/testData/debug/localVariables/suspend/completion/staticSimple.kt b/compiler/testData/debug/localVariables/suspend/completion/staticSimple.kt index 19531a27f06..6ac91ff63ec 100644 --- a/compiler/testData/debug/localVariables/suspend/completion/staticSimple.kt +++ b/compiler/testData/debug/localVariables/suspend/completion/staticSimple.kt @@ -4,5 +4,8 @@ suspend fun box() {} -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:4 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 + +// EXPECTATIONS JS_IR +// test.kt:4 box: $completion=EmptyContinuation diff --git a/compiler/testData/debug/localVariables/suspend/completion/staticSimpleReceiver.kt b/compiler/testData/debug/localVariables/suspend/completion/staticSimpleReceiver.kt index 25b548f8d36..1da33af3d7b 100644 --- a/compiler/testData/debug/localVariables/suspend/completion/staticSimpleReceiver.kt +++ b/compiler/testData/debug/localVariables/suspend/completion/staticSimpleReceiver.kt @@ -10,10 +10,16 @@ suspend fun box() { } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:9 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:4 : // test.kt:9 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:6 foo: $this$foo:A=A, $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:9 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:10 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 + +// EXPECTATIONS JS_IR +// test.kt:9 box: $completion=EmptyContinuation +// test.kt:4 : +// test.kt:9 box: $completion=EmptyContinuation +// test.kt:6 foo: =A, $completion=EmptyContinuation diff --git a/compiler/testData/debug/localVariables/suspend/completion/staticStateMachine.kt b/compiler/testData/debug/localVariables/suspend/completion/staticStateMachine.kt index 7cf09ba685e..03d87635249 100644 --- a/compiler/testData/debug/localVariables/suspend/completion/staticStateMachine.kt +++ b/compiler/testData/debug/localVariables/suspend/completion/staticStateMachine.kt @@ -12,7 +12,7 @@ suspend fun box() { foo1(42) } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:12 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:5 foo1: // test.kt:6 foo1: $continuation:kotlin.coroutines.Continuation=TestKt$foo1$1, $result:java.lang.Object=null, l:long=42:long @@ -25,3 +25,13 @@ suspend fun box() { // test.kt:9 foo1: $continuation:kotlin.coroutines.Continuation=TestKt$foo1$1, $result:java.lang.Object=null, l:long=42:long // test.kt:12 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:13 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 + +// EXPECTATIONS JS_IR +// test.kt:12 box: $completion=EmptyContinuation +// test.kt:12 box: $completion=EmptyContinuation +// test.kt:6 doResume: +// test.kt:4 foo: $completion=$foo1COROUTINE$0 +// test.kt:7 doResume: +// test.kt:4 foo: $completion=$foo1COROUTINE$0 +// test.kt:8 doResume: +// test.kt:9 doResume: dead=kotlin.Long diff --git a/compiler/testData/debug/localVariables/suspend/completion/staticStateMachineReceiver.kt b/compiler/testData/debug/localVariables/suspend/completion/staticStateMachineReceiver.kt index 039e6c85554..d3486ff40bd 100644 --- a/compiler/testData/debug/localVariables/suspend/completion/staticStateMachineReceiver.kt +++ b/compiler/testData/debug/localVariables/suspend/completion/staticStateMachineReceiver.kt @@ -16,7 +16,7 @@ suspend fun box() { // The lambda object constructor has a local variables table on the IR backend. -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:14 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:4 : // test.kt:14 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 @@ -31,3 +31,15 @@ suspend fun box() { // test.kt:11 foo1: $continuation:kotlin.coroutines.Continuation=TestKt$foo1$1, $result:java.lang.Object=null, l:long=42:long // test.kt:14 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:15 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 + +// EXPECTATIONS JS_IR +// test.kt:14 box: $completion=EmptyContinuation +// test.kt:4 : +// test.kt:14 box: $completion=EmptyContinuation +// test.kt:14 box: $completion=EmptyContinuation +// test.kt:8 doResume: +// test.kt:6 foo: =A, $completion=$foo1COROUTINE$0 +// test.kt:9 doResume: +// test.kt:6 foo: =A, $completion=$foo1COROUTINE$0 +// test.kt:10 doResume: +// test.kt:11 doResume: dead=kotlin.Long diff --git a/compiler/testData/debug/localVariables/suspend/inlineLocalsStateMachineTransform.kt b/compiler/testData/debug/localVariables/suspend/inlineLocalsStateMachineTransform.kt index 1d1f097b1a0..ca5295d3aa8 100644 --- a/compiler/testData/debug/localVariables/suspend/inlineLocalsStateMachineTransform.kt +++ b/compiler/testData/debug/localVariables/suspend/inlineLocalsStateMachineTransform.kt @@ -18,7 +18,7 @@ suspend fun box() { hasLocal() } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:10 box: // test.kt:12 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null // test.kt:8 h: $completion:kotlin.coroutines.Continuation=TestKt$box$1 @@ -31,3 +31,12 @@ suspend fun box() { // test.kt:4 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, $i$f$hasLocal:int=0:int // test.kt:5 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, $i$f$hasLocal:int=0:int, x$iv:int=41:int // test.kt:19 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null + +// EXPECTATIONS JS_IR +// test.kt:12 doResume: +// test.kt:8 h: $completion=$boxCOROUTINE$0 +// test.kt:4 doResume: +// test.kt:5 doResume: x=41:number +// test.kt:4 doResume: x=41:number +// test.kt:5 doResume: x=41:number, x=41:number +// test.kt:19 doResume: x=41:number, x=41:number diff --git a/compiler/testData/debug/localVariables/suspend/localsStateMachineTransform.kt b/compiler/testData/debug/localVariables/suspend/localsStateMachineTransform.kt index 2e6d1a42e2c..cfbc6b9b75b 100644 --- a/compiler/testData/debug/localVariables/suspend/localsStateMachineTransform.kt +++ b/compiler/testData/debug/localVariables/suspend/localsStateMachineTransform.kt @@ -20,7 +20,7 @@ suspend fun box() { } } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:10 box: // test.kt:12 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null // test.kt:6 h: $completion:kotlin.coroutines.Continuation=TestKt$box$1 @@ -45,3 +45,32 @@ suspend fun box() { // test.kt:19 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int // test.kt:18 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, x:int=1:int // test.kt:21 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null + +// EXPECTATIONS JS_IR +// test.kt:12 doResume: +// test.kt:6 h: $completion=$boxCOROUTINE$0 +// test.kt:13 doResume: +// test.kt:13 doResume: +// test.kt:13 doResume: +// test.kt:13 doResume: x=0:number +// test.kt:14 doResume: x=0:number +// test.kt:8 f: x=0:number +// test.kt:13 doResume: x=0:number +// test.kt:13 doResume: x=0:number +// test.kt:13 doResume: x=1:number +// test.kt:14 doResume: x=1:number +// test.kt:8 f: x=1:number +// test.kt:13 doResume: x=1:number +// test.kt:18 doResume: x=1:number +// test.kt:18 doResume: x=1:number +// test.kt:18 doResume: x=1:number +// test.kt:18 doResume: x=1:number, x=0:number +// test.kt:19 doResume: x=1:number, x=0:number +// test.kt:8 f: x=0:number +// test.kt:18 doResume: x=1:number, x=0:number +// test.kt:18 doResume: x=1:number, x=0:number +// test.kt:18 doResume: x=1:number, x=1:number +// test.kt:19 doResume: x=1:number, x=1:number +// test.kt:8 f: x=1:number +// test.kt:18 doResume: x=1:number, x=1:number +// test.kt:21 doResume: x=1:number, x=1:number diff --git a/compiler/testData/debug/localVariables/suspend/mergeLvt.kt b/compiler/testData/debug/localVariables/suspend/mergeLvt.kt index c6bb66273e5..4a5e1891c70 100644 --- a/compiler/testData/debug/localVariables/suspend/mergeLvt.kt +++ b/compiler/testData/debug/localVariables/suspend/mergeLvt.kt @@ -26,14 +26,16 @@ suspend fun box() { val a = suspendBar() } -// EXPECTATIONS +// FIXME(JS_IR): KT-54657 + +// EXPECTATIONS JVM JVM_IR // test.kt:25 box: // test.kt:26 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null // test.kt:19 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, $i$f$suspendBar:int=0:int // EXPECTATIONS JVM // test.kt:19 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, $i$f$suspendBar:int=0:int // test.kt:14 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, $i$f$suspendBar:int=0:int, $this$extensionFun$iv$iv:AtomicInt=AtomicInt, $i$f$extensionFun:int=0:int -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:14 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, $i$f$suspendBar:int=0:int, $this$extensionFun$iv$iv:AtomicInt=AtomicInt, $i$f$extensionFun:int=0:int // test.kt:15 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, $i$f$suspendBar:int=0:int, $this$extensionFun$iv$iv:AtomicInt=AtomicInt, $i$f$extensionFun:int=0:int // test.kt:6 getValue: @@ -46,3 +48,21 @@ suspend fun box() { // test.kt:23 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null, $i$f$suspendBar:int=0:int // test.kt:26 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null // test.kt:27 box: $continuation:kotlin.coroutines.Continuation=TestKt$box$1, $result:java.lang.Object=null + +// EXPECTATIONS JS_IR +// test.kt:19 doResume: +// test.kt:10 : +// test.kt:8 atomic: i=0:number +// test.kt:6 : value=0:number +// test.kt:6 : value=0:number +// test.kt:11 : +// test.kt:10 $accessor$1gle43a: +// test.kt:10 : +// test.kt:14 doResume: +// test.kt:11 $accessor$1gle43a: +// test.kt:11 : +// test.kt:37 doResume: +// test.kt:37 doResume: +// test.kt:37 doResume: +// test.kt:26 doResume: +// test.kt:27 doResume: a=Unit diff --git a/compiler/testData/debug/localVariables/suspend/simple.kt b/compiler/testData/debug/localVariables/suspend/simple.kt index e5c5dd18b52..ea1e0e5ceae 100644 --- a/compiler/testData/debug/localVariables/suspend/simple.kt +++ b/compiler/testData/debug/localVariables/suspend/simple.kt @@ -5,6 +5,10 @@ suspend fun box() { var x = 1 } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:5 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:6 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1, x:int=1:int + +// EXPECTATIONS JS_IR +// test.kt:5 box: $completion=EmptyContinuation +// test.kt:6 box: $completion=EmptyContinuation, x=1:number diff --git a/compiler/testData/debug/localVariables/suspend/underscoreNames.kt b/compiler/testData/debug/localVariables/suspend/underscoreNames.kt index 2132fedc0f3..e2c19d86a36 100644 --- a/compiler/testData/debug/localVariables/suspend/underscoreNames.kt +++ b/compiler/testData/debug/localVariables/suspend/underscoreNames.kt @@ -13,33 +13,41 @@ suspend fun box() = foo(A()) { (x_param, _, y_param) -> x_param + y_param } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:12 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:4 : // test.kt:12 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:10 foo: a:A=A, block:kotlin.jvm.functions.Function2=TestKt$box$2, $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:5 component1: - // EXPECTATIONS JVM // test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit, $dstr$x_param$_u24__u24$y_param:A=A // EXPECTATIONS JVM_IR // test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit - -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:7 component3: - // EXPECTATIONS JVM_IR // test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit, x_param:java.lang.String="O":java.lang.String // test.kt:13 invokeSuspend: $result:java.lang.Object=kotlin.Unit, x_param:java.lang.String="O":java.lang.String, y_param:java.lang.String="K":java.lang.String // EXPECTATIONS JVM // test.kt:12 invokeSuspend: $result:java.lang.Object=kotlin.Unit, $dstr$x_param$_u24__u24$y_param:A=A // test.kt:13 invokeSuspend: $result:java.lang.Object=kotlin.Unit, $dstr$x_param$_u24__u24$y_param:A=A, x_param:java.lang.String="O":java.lang.String, y_param:java.lang.String="K":java.lang.String - // EXPECTATIONS JVM_IR // test.kt:-1 invoke: p1:A=A, p2:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // EXPECTATIONS JVM // test.kt:-1 invoke: - -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:10 foo: a:A=A, block:kotlin.jvm.functions.Function2=TestKt$box$2, $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 // test.kt:14 box: $completion:kotlin.coroutines.Continuation=Generated_Box_MainKt$main$1 + +// EXPECTATIONS JS_IR +// test.kt:12 box: $completion=EmptyContinuation +// test.kt:4 : +// test.kt:12 box: $completion=EmptyContinuation +// test.kt:12 box$slambda: +// test.kt:12 box: $completion=EmptyContinuation +// test.kt:10 foo: a=A, block=Function2, $completion=EmptyContinuation +// test.kt:12 doResume: +// test.kt:5 component1: +// test.kt:12 doResume: x_param="O":kotlin.String +// test.kt:7 component3: +// test.kt:13 doResume: x_param="O":kotlin.String, y_param="K":kotlin.String diff --git a/compiler/testData/debug/localVariables/tryFinally.kt b/compiler/testData/debug/localVariables/tryFinally.kt index 7698051e0cd..2588f5619fb 100644 --- a/compiler/testData/debug/localVariables/tryFinally.kt +++ b/compiler/testData/debug/localVariables/tryFinally.kt @@ -18,7 +18,7 @@ fun box() { } } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:7 box: // test.kt:8 box: result:java.lang.String="":java.lang.String // test.kt:9 box: result:java.lang.String="":java.lang.String, x:java.lang.String="A":java.lang.String @@ -28,3 +28,16 @@ fun box() { // test.kt:15 box: result:java.lang.String="y":java.lang.String, x:java.lang.String="A":java.lang.String // test.kt:16 box: result:java.lang.String="y":java.lang.String, x:java.lang.String="A":java.lang.String, z:java.lang.String="z":java.lang.String // test.kt:19 box: result:java.lang.String="yz":java.lang.String + +// EXPECTATIONS JS_IR +// test.kt:7 box: +// test.kt:8 box: result="":kotlin.String +// test.kt:8 box: result="":kotlin.String +// test.kt:8 box: result="":kotlin.String +// test.kt:8 box: result="":kotlin.String +// test.kt:10 box: result="":kotlin.String, x="A":kotlin.String +// test.kt:11 box: result="":kotlin.String, x="A":kotlin.String, y="y":kotlin.String +// test.kt:12 box: result="y":kotlin.String, x="A":kotlin.String, y="y":kotlin.String +// test.kt:15 box: result="y":kotlin.String, x="A":kotlin.String, y="y":kotlin.String +// test.kt:16 box: result="y":kotlin.String, x="A":kotlin.String, y="y":kotlin.String, z="z":kotlin.String +// test.kt:19 box: result="yz":kotlin.String, x="A":kotlin.String, y="y":kotlin.String, z="z":kotlin.String diff --git a/compiler/testData/debug/localVariables/tryFinally10.kt b/compiler/testData/debug/localVariables/tryFinally10.kt index a06ea462a5b..ad0f05d9149 100644 --- a/compiler/testData/debug/localVariables/tryFinally10.kt +++ b/compiler/testData/debug/localVariables/tryFinally10.kt @@ -36,7 +36,7 @@ fun box() { val localX = x } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:35 box: // test.kt:20 compute: // test.kt:21 compute: @@ -53,3 +53,20 @@ fun box() { // test.kt:35 box: // test.kt:36 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String // test.kt:37 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String, localX:java.lang.String="OK":java.lang.String + +// EXPECTATIONS JS_IR +// test.kt:35 box: +// test.kt:21 compute: +// test.kt:22 compute: y=42:number +// test.kt:22 compute: y=42:number +// test.kt:22 compute: y=42:number +// test.kt:22 compute: y=42:number, i=0:number +// test.kt:8 compute: y=42:number, i=0:number +// test.kt:9 compute: y=42:number, i=0:number, z=32:number +// test.kt:9 compute: y=42:number, i=0:number, z=32:number +// test.kt:9 compute: y=42:number, i=0:number, z=32:number +// test.kt:9 compute: y=42:number, i=0:number, z=32:number, j=0:number +// test.kt:10 compute: y=42:number, i=0:number, z=32:number, j=0:number +// test.kt:24 compute: y=42:number, i=0:number, z=32:number, j=0:number +// test.kt:28 compute: y=42:number, i=0:number, z=32:number, j=0:number +// test.kt:29 compute: y=42:number, i=0:number, z=32:number, j=0:number, s2="OK":kotlin.String diff --git a/compiler/testData/debug/localVariables/tryFinally11.kt b/compiler/testData/debug/localVariables/tryFinally11.kt index fee1d3b019c..85c1156b8d0 100644 --- a/compiler/testData/debug/localVariables/tryFinally11.kt +++ b/compiler/testData/debug/localVariables/tryFinally11.kt @@ -23,7 +23,7 @@ fun box(): String { return "FAIL" } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:7 box: // test.kt:8 box: // test.kt:9 box: i:int=0:int @@ -35,3 +35,18 @@ fun box(): String { // test.kt:15 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException, y:java.lang.String="y":java.lang.String, z:java.lang.String="z":java.lang.String // test.kt:17 box: i:int=0:int // test.kt:21 box: + +// EXPECTATIONS JS_IR +// test.kt:8 box: +// test.kt:8 box: +// test.kt:8 box: +// test.kt:8 box: i=0:number +// test.kt:10 box: i=0:number +// test.kt:11 box: i=0:number, x="x":kotlin.String +// test.kt:12 box: i=0:number, x="x":kotlin.String +// test.kt:12 box: i=0:number, x="x":kotlin.String +// test.kt:13 box: i=0:number, x="x":kotlin.String, e=kotlin.RuntimeException +// test.kt:14 box: i=0:number, x="x":kotlin.String, e=kotlin.RuntimeException, y="y":kotlin.String +// test.kt:15 box: i=0:number, x="x":kotlin.String, e=kotlin.RuntimeException, y="y":kotlin.String, z="z":kotlin.String +// test.kt:17 box: i=0:number, x="x":kotlin.String, e=kotlin.RuntimeException, y="y":kotlin.String, z="z":kotlin.String +// test.kt:21 box: i=0:number, x="x":kotlin.String, e=kotlin.RuntimeException, y="y":kotlin.String, z="z":kotlin.String diff --git a/compiler/testData/debug/localVariables/tryFinally12.kt b/compiler/testData/debug/localVariables/tryFinally12.kt index 98713465fa5..54d99fef4cc 100644 --- a/compiler/testData/debug/localVariables/tryFinally12.kt +++ b/compiler/testData/debug/localVariables/tryFinally12.kt @@ -23,7 +23,7 @@ fun box(): String { return "FAIL" } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:7 box: // test.kt:8 box: // test.kt:9 box: i:int=0:int @@ -35,3 +35,18 @@ fun box(): String { // test.kt:15 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException, y:java.lang.String="y":java.lang.String, z:java.lang.String="z":java.lang.String // test.kt:17 box: i:int=0:int // test.kt:21 box: + +// EXPECTATIONS JS_IR +// test.kt:8 box: +// test.kt:8 box: +// test.kt:8 box: +// test.kt:8 box: i=0:number +// test.kt:10 box: i=0:number +// test.kt:11 box: i=0:number, x="x":kotlin.String +// test.kt:12 box: i=0:number, x="x":kotlin.String +// test.kt:12 box: i=0:number, x="x":kotlin.String +// test.kt:13 box: i=0:number, x="x":kotlin.String, e=kotlin.RuntimeException +// test.kt:14 box: i=0:number, x="x":kotlin.String, e=kotlin.RuntimeException, y="y":kotlin.String +// test.kt:15 box: i=0:number, x="x":kotlin.String, e=kotlin.RuntimeException, y="y":kotlin.String, z="z":kotlin.String +// test.kt:17 box: i=0:number, x="x":kotlin.String, e=kotlin.RuntimeException, y="y":kotlin.String, z="z":kotlin.String +// test.kt:21 box: i=0:number, x="x":kotlin.String, e=kotlin.RuntimeException, y="y":kotlin.String, z="z":kotlin.String diff --git a/compiler/testData/debug/localVariables/tryFinally13.kt b/compiler/testData/debug/localVariables/tryFinally13.kt index 578745b9894..d19a8343274 100644 --- a/compiler/testData/debug/localVariables/tryFinally13.kt +++ b/compiler/testData/debug/localVariables/tryFinally13.kt @@ -22,7 +22,7 @@ fun box(): String { return "FAIL3" } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:7 box: // test.kt:8 box: // test.kt:9 box: i:int=0:int @@ -33,3 +33,17 @@ fun box(): String { // test.kt:14 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException, y:java.lang.String="y":java.lang.String // test.kt:16 box: i:int=0:int // test.kt:20 box: + +// EXPECTATIONS JS_IR +// test.kt:8 box: +// test.kt:8 box: +// test.kt:8 box: +// test.kt:8 box: i=0:number +// test.kt:10 box: i=0:number +// test.kt:11 box: i=0:number, x="x":kotlin.String +// test.kt:12 box: i=0:number, x="x":kotlin.String +// test.kt:12 box: i=0:number, x="x":kotlin.String +// test.kt:13 box: i=0:number, x="x":kotlin.String, e=kotlin.RuntimeException +// test.kt:14 box: i=0:number, x="x":kotlin.String, e=kotlin.RuntimeException, y="y":kotlin.String +// test.kt:16 box: i=0:number, x="x":kotlin.String, e=kotlin.RuntimeException, y="y":kotlin.String +// test.kt:20 box: i=0:number, x="x":kotlin.String, e=kotlin.RuntimeException, y="y":kotlin.String diff --git a/compiler/testData/debug/localVariables/tryFinally14.kt b/compiler/testData/debug/localVariables/tryFinally14.kt index a8b885f8606..f9c76e65aaa 100644 --- a/compiler/testData/debug/localVariables/tryFinally14.kt +++ b/compiler/testData/debug/localVariables/tryFinally14.kt @@ -16,7 +16,7 @@ fun box(): String { return "FAIL" } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:4 box: // test.kt:5 box: // test.kt:6 box: i:int=0:int @@ -24,3 +24,13 @@ fun box(): String { // test.kt:8 box: i:int=0:int, x:java.lang.String="x":java.lang.String // test.kt:10 box: i:int=0:int // test.kt:14 box: + +// EXPECTATIONS JS_IR +// test.kt:5 box: +// test.kt:5 box: +// test.kt:5 box: +// test.kt:5 box: i=0:number +// test.kt:7 box: i=0:number +// test.kt:8 box: i=0:number, x="x":kotlin.String +// test.kt:10 box: i=0:number, x="x":kotlin.String, y="y":kotlin.String +// test.kt:14 box: i=0:number, x="x":kotlin.String, y="y":kotlin.String diff --git a/compiler/testData/debug/localVariables/tryFinally15.kt b/compiler/testData/debug/localVariables/tryFinally15.kt index 29f65da704d..fd07b4d8621 100644 --- a/compiler/testData/debug/localVariables/tryFinally15.kt +++ b/compiler/testData/debug/localVariables/tryFinally15.kt @@ -16,7 +16,7 @@ fun box(): String { return "FAIL" } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:4 box: // test.kt:5 box: // test.kt:6 box: i:int=0:int @@ -27,5 +27,16 @@ fun box(): String { // test.kt:5 box: i:int=0:int // EXPECTATIONS JVM_IR // test.kt:5 box: i:int=0:int -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:14 box: + +// EXPECTATIONS JS_IR +// test.kt:5 box: +// test.kt:5 box: +// test.kt:5 box: +// test.kt:5 box: i=0:number +// test.kt:7 box: i=0:number +// test.kt:8 box: i=0:number, x="x":kotlin.String +// test.kt:10 box: i=0:number, x="x":kotlin.String, y="y":kotlin.String +// test.kt:5 box: i=0:number, x="x":kotlin.String, y="y":kotlin.String +// test.kt:14 box: i=0:number, x="x":kotlin.String, y="y":kotlin.String diff --git a/compiler/testData/debug/localVariables/tryFinally16.kt b/compiler/testData/debug/localVariables/tryFinally16.kt index 8bdf6480dea..ccd650fe36a 100644 --- a/compiler/testData/debug/localVariables/tryFinally16.kt +++ b/compiler/testData/debug/localVariables/tryFinally16.kt @@ -18,7 +18,7 @@ fun box(): String { return "FAIL2" } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:6 box: // test.kt:7 box: // test.kt:8 box: i:int=0:int @@ -26,3 +26,13 @@ fun box(): String { // test.kt:10 box: i:int=0:int, x:java.lang.String="x":java.lang.String // test.kt:12 box: i:int=0:int // test.kt:16 box: + +// EXPECTATIONS JS_IR +// test.kt:7 box: +// test.kt:7 box: +// test.kt:7 box: +// test.kt:7 box: i=0:number +// test.kt:9 box: i=0:number +// test.kt:10 box: i=0:number, x="x":kotlin.String +// test.kt:12 box: i=0:number, x="x":kotlin.String, y="y":kotlin.String +// test.kt:16 box: i=0:number, x="x":kotlin.String, y="y":kotlin.String diff --git a/compiler/testData/debug/localVariables/tryFinally17.kt b/compiler/testData/debug/localVariables/tryFinally17.kt index fd85fb0d97e..958b74aad65 100644 --- a/compiler/testData/debug/localVariables/tryFinally17.kt +++ b/compiler/testData/debug/localVariables/tryFinally17.kt @@ -14,8 +14,13 @@ fun box(): String { return "FAIL" } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:8 box: // test.kt:9 box: // test.kt:10 box: x:java.lang.String="x":java.lang.String // test.kt:12 box: + +// EXPECTATIONS JS_IR +// test.kt:9 box: +// test.kt:10 box: x="x":kotlin.String +// test.kt:12 box: x="x":kotlin.String diff --git a/compiler/testData/debug/localVariables/tryFinally2.kt b/compiler/testData/debug/localVariables/tryFinally2.kt index 0fe6b07d52f..7cf01e9951a 100644 --- a/compiler/testData/debug/localVariables/tryFinally2.kt +++ b/compiler/testData/debug/localVariables/tryFinally2.kt @@ -17,7 +17,7 @@ fun box() { } } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:6 box: // test.kt:7 box: result:java.lang.String="":java.lang.String // test.kt:8 box: result:java.lang.String="":java.lang.String, x:java.lang.String="A":java.lang.String @@ -35,3 +35,24 @@ fun box() { // test.kt:15 box: result:java.lang.String="yzy":java.lang.String, x:java.lang.String="B":java.lang.String, z:java.lang.String="z":java.lang.String // test.kt:7 box: result:java.lang.String="yzyz":java.lang.String // test.kt:18 box: result:java.lang.String="yzyz":java.lang.String + +// EXPECTATIONS JS_IR +// test.kt:6 box: +// test.kt:7 box: result="":kotlin.String +// test.kt:7 box: result="":kotlin.String +// test.kt:7 box: result="":kotlin.String +// test.kt:7 box: result="":kotlin.String +// test.kt:9 box: result="":kotlin.String, x="A":kotlin.String +// test.kt:10 box: result="":kotlin.String, x="A":kotlin.String, y="y":kotlin.String +// test.kt:11 box: result="y":kotlin.String, x="A":kotlin.String, y="y":kotlin.String +// test.kt:14 box: result="y":kotlin.String, x="A":kotlin.String, y="y":kotlin.String +// test.kt:15 box: result="y":kotlin.String, x="A":kotlin.String, y="y":kotlin.String, z="z":kotlin.String +// test.kt:7 box: result="yz":kotlin.String, x="A":kotlin.String, y="y":kotlin.String, z="z":kotlin.String +// test.kt:7 box: result="yz":kotlin.String, x="A":kotlin.String, y="y":kotlin.String, z="z":kotlin.String +// test.kt:9 box: result="yz":kotlin.String, x="B":kotlin.String, y="y":kotlin.String, z="z":kotlin.String +// test.kt:10 box: result="yz":kotlin.String, x="B":kotlin.String, y="y":kotlin.String, z="z":kotlin.String +// test.kt:11 box: result="yzy":kotlin.String, x="B":kotlin.String, y="y":kotlin.String, z="z":kotlin.String +// test.kt:14 box: result="yzy":kotlin.String, x="B":kotlin.String, y="y":kotlin.String, z="z":kotlin.String +// test.kt:15 box: result="yzy":kotlin.String, x="B":kotlin.String, y="y":kotlin.String, z="z":kotlin.String +// test.kt:7 box: result="yzyz":kotlin.String, x="B":kotlin.String, y="y":kotlin.String, z="z":kotlin.String +// test.kt:18 box: result="yzyz":kotlin.String, x="B":kotlin.String, y="y":kotlin.String, z="z":kotlin.String diff --git a/compiler/testData/debug/localVariables/tryFinally3.kt b/compiler/testData/debug/localVariables/tryFinally3.kt index 5f751f086f2..193ec6ddcd5 100644 --- a/compiler/testData/debug/localVariables/tryFinally3.kt +++ b/compiler/testData/debug/localVariables/tryFinally3.kt @@ -23,7 +23,7 @@ fun box() { compute() } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:23 box: // test.kt:7 compute: // test.kt:8 compute: result:java.lang.String="":java.lang.String @@ -36,3 +36,16 @@ fun box() { // test.kt:12 compute: result:java.lang.String="yz":java.lang.String, x:java.lang.String="A":java.lang.String, y:java.lang.String="y":java.lang.String // test.kt:23 box: // test.kt:24 box: + +// EXPECTATIONS JS_IR +// test.kt:23 box: +// test.kt:7 compute: +// test.kt:8 compute: result="":kotlin.String +// test.kt:8 compute: result="":kotlin.String +// test.kt:8 compute: result="":kotlin.String +// test.kt:8 compute: result="":kotlin.String +// test.kt:10 compute: result="":kotlin.String, x="A":kotlin.String +// test.kt:11 compute: result="":kotlin.String, x="A":kotlin.String, y="y":kotlin.String +// test.kt:12 compute: result="y":kotlin.String, x="A":kotlin.String, y="y":kotlin.String +// test.kt:15 compute: result="y":kotlin.String, x="A":kotlin.String, y="y":kotlin.String +// test.kt:16 compute: result="y":kotlin.String, x="A":kotlin.String, y="y":kotlin.String, z="z":kotlin.String diff --git a/compiler/testData/debug/localVariables/tryFinally4.kt b/compiler/testData/debug/localVariables/tryFinally4.kt index eea15b09757..a9d795cfa45 100644 --- a/compiler/testData/debug/localVariables/tryFinally4.kt +++ b/compiler/testData/debug/localVariables/tryFinally4.kt @@ -29,7 +29,7 @@ fun box() { compute() } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:29 box: // test.kt:7 compute: // test.kt:8 compute: result:java.lang.String="":java.lang.String @@ -47,3 +47,20 @@ fun box() { // test.kt:15 compute: result:java.lang.String="bcd":java.lang.String, a:java.lang.String="a":java.lang.String, b:java.lang.String="b":java.lang.String, i:int=0:int, e:java.lang.String="e":java.lang.String // test.kt:29 box: // test.kt:30 box: + +// EXPECTATIONS JS_IR +// test.kt:29 box: +// test.kt:7 compute: +// test.kt:9 compute: result="":kotlin.String +// test.kt:11 compute: result="":kotlin.String, a="a":kotlin.String +// test.kt:12 compute: result="":kotlin.String, a="a":kotlin.String, b="b":kotlin.String +// test.kt:12 compute: result="":kotlin.String, a="a":kotlin.String, b="b":kotlin.String +// test.kt:12 compute: result="":kotlin.String, a="a":kotlin.String, b="b":kotlin.String +// test.kt:12 compute: result="":kotlin.String, a="a":kotlin.String, b="b":kotlin.String, i=0:number +// test.kt:13 compute: result="":kotlin.String, a="a":kotlin.String, b="b":kotlin.String, i=0:number +// test.kt:14 compute: result="":kotlin.String, a="a":kotlin.String, b="b":kotlin.String, i=0:number, e="e":kotlin.String +// test.kt:15 compute: result="b":kotlin.String, a="a":kotlin.String, b="b":kotlin.String, i=0:number, e="e":kotlin.String +// test.kt:18 compute: result="b":kotlin.String, a="a":kotlin.String, b="b":kotlin.String, i=0:number, e="e":kotlin.String +// test.kt:19 compute: result="b":kotlin.String, a="a":kotlin.String, b="b":kotlin.String, i=0:number, e="e":kotlin.String, c="c":kotlin.String +// test.kt:22 compute: result="bc":kotlin.String, a="a":kotlin.String, b="b":kotlin.String, i=0:number, e="e":kotlin.String, c="c":kotlin.String +// test.kt:23 compute: result="bc":kotlin.String, a="a":kotlin.String, b="b":kotlin.String, i=0:number, e="e":kotlin.String, c="c":kotlin.String, d="d":kotlin.String diff --git a/compiler/testData/debug/localVariables/tryFinally5.kt b/compiler/testData/debug/localVariables/tryFinally5.kt index d28e849875e..b06a591d9cd 100644 --- a/compiler/testData/debug/localVariables/tryFinally5.kt +++ b/compiler/testData/debug/localVariables/tryFinally5.kt @@ -29,7 +29,7 @@ fun box() { val localX = x } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:28 box: // test.kt:13 compute: // test.kt:14 compute: @@ -41,3 +41,16 @@ fun box() { // test.kt:28 box: // test.kt:29 box: result:java.lang.String="b":java.lang.String // test.kt:30 box: result:java.lang.String="b":java.lang.String, localX:java.lang.String="OK":java.lang.String + +// EXPECTATIONS JS_IR +// test.kt:28 box: +// test.kt:14 compute: +// test.kt:14 compute: +// test.kt:14 compute: +// test.kt:14 compute: +// test.kt:16 compute: a="a":kotlin.String +// test.kt:16 compute: a="a":kotlin.String +// test.kt:16 compute: a="a":kotlin.String +// test.kt:16 compute: a="a":kotlin.String +// test.kt:17 compute: a="a":kotlin.String, b="b":kotlin.String +// test.kt:22 compute: a="a":kotlin.String, b="b":kotlin.String diff --git a/compiler/testData/debug/localVariables/tryFinally6.kt b/compiler/testData/debug/localVariables/tryFinally6.kt index aeb01dd52ec..1f147c4809d 100644 --- a/compiler/testData/debug/localVariables/tryFinally6.kt +++ b/compiler/testData/debug/localVariables/tryFinally6.kt @@ -43,7 +43,7 @@ fun box() { val localX = x } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:42 box: // test.kt:27 compute: // test.kt:28 compute: @@ -62,3 +62,20 @@ fun box() { // test.kt:42 box: // test.kt:43 box: result:java.lang.String="b":java.lang.String // test.kt:44 box: result:java.lang.String="b":java.lang.String, localX:java.lang.String="OK":java.lang.String + +// EXPECTATIONS JS_IR +// test.kt:42 box: +// test.kt:28 compute: +// test.kt:28 compute: +// test.kt:28 compute: +// test.kt:28 compute: +// test.kt:17 compute: a="a":kotlin.String +// test.kt:8 compute: a="a":kotlin.String, gLocal="gLocal":kotlin.String +// test.kt:30 compute: a="a":kotlin.String, gLocal="gLocal":kotlin.String, hLocal="hLocal":kotlin.String +// test.kt:30 compute: a="a":kotlin.String, gLocal="gLocal":kotlin.String, hLocal="hLocal":kotlin.String +// test.kt:30 compute: a="a":kotlin.String, gLocal="gLocal":kotlin.String, hLocal="hLocal":kotlin.String +// test.kt:30 compute: a="a":kotlin.String, gLocal="gLocal":kotlin.String, hLocal="hLocal":kotlin.String +// test.kt:31 compute: a="a":kotlin.String, gLocal="gLocal":kotlin.String, hLocal="hLocal":kotlin.String, b="b":kotlin.String +// test.kt:11 compute: a="a":kotlin.String, gLocal="gLocal":kotlin.String, hLocal="hLocal":kotlin.String, b="b":kotlin.String +// test.kt:20 compute: a="a":kotlin.String, gLocal="gLocal":kotlin.String, hLocal="hLocal":kotlin.String, b="b":kotlin.String, h="h":kotlin.String +// test.kt:36 compute: a="a":kotlin.String, gLocal="gLocal":kotlin.String, hLocal="hLocal":kotlin.String, b="b":kotlin.String, h="h":kotlin.String, g="g":kotlin.String diff --git a/compiler/testData/debug/localVariables/tryFinally7.kt b/compiler/testData/debug/localVariables/tryFinally7.kt index 6c5481811d3..cfd77add59f 100644 --- a/compiler/testData/debug/localVariables/tryFinally7.kt +++ b/compiler/testData/debug/localVariables/tryFinally7.kt @@ -33,7 +33,7 @@ fun box() { val localX = x } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:32 box: // test.kt:13 compute: // test.kt:14 compute: @@ -49,3 +49,21 @@ fun box() { // test.kt:32 box: // test.kt:33 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String // test.kt:34 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String, localX:java.lang.String="OK":java.lang.String + +// EXPECTATIONS JS_IR +// test.kt:32 box: +// test.kt:14 compute: +// test.kt:15 compute: y=42:number +// test.kt:15 compute: y=42:number +// test.kt:15 compute: y=42:number +// test.kt:15 compute: y=42:number, i=0:number +// test.kt:16 compute: y=42:number, i=0:number +// test.kt:18 compute: y=42:number, i=0:number +// test.kt:18 compute: y=42:number, i=0:number +// test.kt:19 compute: y=42:number, i=0:number, e=kotlin.RuntimeException +// test.kt:20 compute: y=42:number, i=0:number, e=kotlin.RuntimeException, y=32:number +// test.kt:20 compute: y=42:number, i=0:number, e=kotlin.RuntimeException, y=32:number +// test.kt:20 compute: y=42:number, i=0:number, e=kotlin.RuntimeException, y=32:number +// test.kt:20 compute: y=42:number, i=0:number, e=kotlin.RuntimeException, y=32:number, j=0:number +// test.kt:22 compute: y=42:number, i=0:number, e=kotlin.RuntimeException, y=32:number, j=0:number +// test.kt:26 compute: y=42:number, i=0:number, e=kotlin.RuntimeException, y=32:number, j=0:number diff --git a/compiler/testData/debug/localVariables/tryFinally8.kt b/compiler/testData/debug/localVariables/tryFinally8.kt index 04f22a8013e..2e7e1729cb4 100644 --- a/compiler/testData/debug/localVariables/tryFinally8.kt +++ b/compiler/testData/debug/localVariables/tryFinally8.kt @@ -35,7 +35,7 @@ fun box() { val localX = x } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:34 box: // test.kt:20 compute: // test.kt:21 compute: @@ -52,3 +52,21 @@ fun box() { // test.kt:34 box: // test.kt:35 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String // test.kt:36 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String, localX:java.lang.String="OK":java.lang.String + +// EXPECTATIONS JS_IR +// test.kt:34 box: +// test.kt:21 compute: +// test.kt:22 compute: y=42:number +// test.kt:22 compute: y=42:number +// test.kt:22 compute: y=42:number +// test.kt:22 compute: y=42:number, i=0:number +// test.kt:8 compute: y=42:number, i=0:number +// test.kt:9 compute: y=42:number, i=0:number, z=32:number +// test.kt:9 compute: y=42:number, i=0:number, z=32:number +// test.kt:9 compute: y=42:number, i=0:number, z=32:number +// test.kt:9 compute: y=42:number, i=0:number, z=32:number, j=0:number +// test.kt:10 compute: y=42:number, i=0:number, z=32:number, j=0:number +// test.kt:12 compute: y=42:number, i=0:number, z=32:number, j=0:number +// test.kt:12 compute: y=42:number, i=0:number, z=32:number, j=0:number +// test.kt:24 compute: y=42:number, i=0:number, z=32:number, j=0:number, e=kotlin.RuntimeException +// test.kt:28 compute: y=42:number, i=0:number, z=32:number, j=0:number, e=kotlin.RuntimeException diff --git a/compiler/testData/debug/localVariables/tryFinally9.kt b/compiler/testData/debug/localVariables/tryFinally9.kt index 05f2eaf0548..6fbdb01d9d1 100644 --- a/compiler/testData/debug/localVariables/tryFinally9.kt +++ b/compiler/testData/debug/localVariables/tryFinally9.kt @@ -38,7 +38,7 @@ fun box() { val localX = x } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:37 box: // test.kt:13 compute: // test.kt:14 compute: @@ -58,3 +58,23 @@ fun box() { // test.kt:37 box: // test.kt:38 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String // test.kt:39 box: result:java.lang.String="NON_LOCAL_RETURN":java.lang.String, localX:java.lang.String="OK":java.lang.String + +// EXPECTATIONS JS_IR +// test.kt:37 box: +// test.kt:15 compute: +// test.kt:16 compute: y=42:number +// test.kt:16 compute: y=42:number +// test.kt:16 compute: y=42:number +// test.kt:16 compute: y=42:number, i=0:number +// test.kt:17 compute: y=42:number, i=0:number +// test.kt:20 compute: y=42:number, i=0:number +// test.kt:21 compute: y=42:number, i=0:number, s="NOPE":kotlin.String +// test.kt:23 compute: y=42:number, i=0:number, s="NOPE":kotlin.String +// test.kt:27 compute: y=42:number, i=0:number, s="NOPE":kotlin.String +// test.kt:28 compute: y=42:number, i=0:number, s="NOPE":kotlin.String, s2="NOPE":kotlin.String +// test.kt:28 compute: y=42:number, i=0:number, s="NOPE":kotlin.String, s2="NOPE":kotlin.String +// test.kt:28 compute: y=42:number, i=0:number, s="NOPE":kotlin.String, s2="NOPE":kotlin.String +// test.kt:28 compute: y=42:number, i=0:number, s="NOPE":kotlin.String, s2="NOPE":kotlin.String, j=0:number +// test.kt:29 compute: y=42:number, i=0:number, s="NOPE":kotlin.String, s2="NOPE":kotlin.String, j=0:number +// test.kt:28 compute: y=42:number, i=0:number, s="NOPE":kotlin.String, s2="OK":kotlin.String, j=0:number +// test.kt:31 compute: y=42:number, i=0:number, s="NOPE":kotlin.String, s2="OK":kotlin.String, j=0:number diff --git a/compiler/testData/debug/localVariables/underscoreNames.kt b/compiler/testData/debug/localVariables/underscoreNames.kt index 002cbdd1475..6d43f079834 100644 --- a/compiler/testData/debug/localVariables/underscoreNames.kt +++ b/compiler/testData/debug/localVariables/underscoreNames.kt @@ -23,49 +23,106 @@ fun box() { } } -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:12 box: // test.kt:4 : x:double=1.0:double, y:java.lang.String="":java.lang.String, z:char=0:char // test.kt:12 box: // test.kt:6 foo: a:A=A, block:kotlin.jvm.functions.Function3=TestKt$box$1 - // EXPECTATIONS JVM_IR // test.kt:13 invoke: w:int=1:int // test.kt:15 invoke: w:int=1:int, x:double=1.0:double, y:char=0:char // EXPECTATIONS JVM // test.kt:15 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int - -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:4 : x:double=1.0:double, y:java.lang.String="":java.lang.String, z:char=0:char - // EXPECTATIONS JVM // test.kt:15 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int, x:double=1.0:double, y:char=0:char // test.kt:16 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int, x:double=1.0:double, y:char=0:char, a:double=1.0:double, c:char=0:char // EXPECTATIONS JVM_IR // test.kt:15 invoke: w:int=1:int, x:double=1.0:double, y:char=0:char // test.kt:16 invoke: w:int=1:int, x:double=1.0:double, y:char=0:char, a:double=1.0:double, c:char=0:char - -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:4 : x:double=1.0:double, y:java.lang.String="":java.lang.String, z:char=0:char - // EXPECTATIONS JVM // test.kt:16 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int, x:double=1.0:double, y:char=0:char, a:double=1.0:double, c:char=0:char // test.kt:18 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int, x:double=1.0:double, y:char=0:char, a:double=1.0:double, c:char=0:char, _:java.lang.String="":java.lang.String, d:char=0:char // EXPECTATIONS JVM_IR // test.kt:16 invoke: w:int=1:int, x:double=1.0:double, y:char=0:char, a:double=1.0:double, c:char=0:char // test.kt:18 invoke: w:int=1:int, x:double=1.0:double, y:char=0:char, a:double=1.0:double, c:char=0:char, _:java.lang.String="":java.lang.String, d:char=0:char - -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:8 getArrayOfA: - // EXPECTATIONS JVM // test.kt:18 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int, x:double=1.0:double, y:char=0:char, a:double=1.0:double, c:char=0:char, _:java.lang.String="":java.lang.String, d:char=0:char // test.kt:22 invoke: $dstr$x$_u24__u24$y:A=A, $noName_1:java.lang.String="":java.lang.String, w:int=1:int, x:double=1.0:double, y:char=0:char, a:double=1.0:double, c:char=0:char, _:java.lang.String="":java.lang.String, d:char=0:char // EXPECTATIONS JVM_IR // test.kt:18 invoke: w:int=1:int, x:double=1.0:double, y:char=0:char, a:double=1.0:double, c:char=0:char, _:java.lang.String="":java.lang.String, d:char=0:char // test.kt:22 invoke: w:int=1:int, x:double=1.0:double, y:char=0:char, a:double=1.0:double, c:char=0:char, _:java.lang.String="":java.lang.String, d:char=0:char - -// EXPECTATIONS +// EXPECTATIONS JVM JVM_IR // test.kt:6 foo: a:A=A, block:kotlin.jvm.functions.Function3=TestKt$box$1 // test.kt:12 box: // test.kt:24 box: + +// EXPECTATIONS JS_IR +// test.kt:8 : +// test.kt:8 : +// test.kt:8 : +// test.kt:8 : +// test.kt:8 : +// test.kt:8 : +// test.kt:4 : +// test.kt:4 : x=1:number +// test.kt:4 : x=1:number, y="":kotlin.String +// test.kt:4 : x=1:number, y="":kotlin.String, z=48:number +// test.kt:4 : x=1:number, y="":kotlin.String, z=48:number +// test.kt:4 : x=1:number, y="":kotlin.String, z=48:number +// test.kt:8 : +// test.kt:8 : +// test.kt:8 : +// test.kt:8 : +// test.kt:12 box: +// test.kt:4 : +// test.kt:4 : x=1:number +// test.kt:4 : x=1:number, y="":kotlin.String +// test.kt:4 : x=1:number, y="":kotlin.String, z=48:number +// test.kt:4 : x=1:number, y="":kotlin.String, z=48:number +// test.kt:4 : x=1:number, y="":kotlin.String, z=48:number +// test.kt:12 box: +// test.kt:6 foo: a=A, block=Function3 +// test.kt:13 box$lambda: w=1:number +// test.kt:1 component1: +// test.kt:13 box$lambda: w=1:number, x=1:number +// test.kt:1 component3: +// test.kt:15 box$lambda: w=1:number, x=1:number, y=48:number +// test.kt:4 : +// test.kt:4 : x=1:number +// test.kt:4 : x=1:number, y="":kotlin.String +// test.kt:4 : x=1:number, y="":kotlin.String, z=48:number +// test.kt:4 : x=1:number, y="":kotlin.String, z=48:number +// test.kt:4 : x=1:number, y="":kotlin.String, z=48:number +// test.kt:15 box$lambda: w=1:number, x=1:number, y=48:number +// test.kt:1 component1: +// test.kt:15 box$lambda: w=1:number, x=1:number, y=48:number, a=1:number +// test.kt:1 component3: +// test.kt:16 box$lambda: w=1:number, x=1:number, y=48:number, a=1:number, c=48:number +// test.kt:4 : +// test.kt:4 : x=1:number +// test.kt:4 : x=1:number, y="":kotlin.String +// test.kt:4 : x=1:number, y="":kotlin.String, z=48:number +// test.kt:4 : x=1:number, y="":kotlin.String, z=48:number +// test.kt:4 : x=1:number, y="":kotlin.String, z=48:number +// test.kt:16 box$lambda: w=1:number, x=1:number, y=48:number, a=1:number, c=48:number +// test.kt:1 component2: +// test.kt:16 box$lambda: w=1:number, x=1:number, y=48:number, a=1:number, c=48:number, _="":kotlin.String +// test.kt:1 component3: +// test.kt:18 box$lambda: w=1:number, x=1:number, y=48:number, a=1:number, c=48:number, _="":kotlin.String, d=48:number +// test.kt:8 : +// test.kt:18 box$lambda: w=1:number, x=1:number, y=48:number, a=1:number, c=48:number, _="":kotlin.String, d=48:number +// test.kt:18 box$lambda: w=1:number, x=1:number, y=48:number, a=1:number, c=48:number, _="":kotlin.String, d=48:number +// test.kt:18 box$lambda: w=1:number, x=1:number, y=48:number, a=1:number, c=48:number, _="":kotlin.String, d=48:number +// test.kt:18 box$lambda: w=1:number, x=1:number, y=48:number, a=1:number, c=48:number, _="":kotlin.String, d=48:number +// test.kt:18 box$lambda: w=1:number, x=1:number, y=48:number, a=1:number, c=48:number, _="":kotlin.String, d=48:number +// test.kt:18 box$lambda: w=1:number, x=1:number, y=48:number, a=1:number, c=48:number, _="":kotlin.String, d=48:number +// test.kt:1 component2: +// test.kt:18 box$lambda: w=1:number, x=1:number, y=48:number, a=1:number, c=48:number, _="":kotlin.String, d=48:number, q="":kotlin.String +// test.kt:22 box$lambda: w=1:number, x=1:number, y=48:number, a=1:number, c=48:number, _="":kotlin.String, d=48:number, q="":kotlin.String +// test.kt:24 box: diff --git a/compiler/testData/debug/stepping/jsCode.kt b/compiler/testData/debug/stepping/jsCode.kt deleted file mode 100644 index d1bc475a514..00000000000 --- a/compiler/testData/debug/stepping/jsCode.kt +++ /dev/null @@ -1,80 +0,0 @@ -// TARGET_BACKEND: JS_IR - -// FILE: a.kt -@JsExport -fun exclamate(a: String) = - "$a!" - -@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -@JsFun(""" - function (a, b) { - return _.exclamate(a) + - _.exclamate(b); - } -""") -external fun exclamateAndConcat(a: String, b: String): String - -@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -@JsPolyfill(""" -if (typeof String.prototype.myAwesomePolyfill === "undefined") { - Object.defineProperty(String.prototype, "myAwesomePolyfill", { - value: function () { - return this + "!"; - } - }); -} -""") -internal inline fun String.myAwesomePolyfill(): Boolean = - asDynamic() - .myAwesomePolyfill() - -val walter1VarDecl = "var walter1 = _.exclamate('Walter');" -val jesse1VarDecl = "var jesse1 = _.exclamate(jesse);" - -// FILE: test.kt - - - -fun box() { - - exclamateAndConcat( - "hello", - "world") - val jesse = "Jesse" - js( - "_.exclamate(jesse);") // Local variable is captured - js( - "_.exclamate('Walter');") // No local variables captured - js( - walter1VarDecl + - "_.exclamate(walter1);") - js( - jesse1VarDecl + - "_.exclamate(jesse1);") - - "foo".myAwesomePolyfill() -} - -// EXPECTATIONS -// test.kt:41 box -// test.kt:42 box -// a.kt:11 box -// a.kt:6 exclamate -// a.kt:12 box -// a.kt:6 exclamate -// test.kt:43 box -// test.kt:45 box -// a.kt:6 exclamate -// test.kt:47 box -// a.kt:6 exclamate -// test.kt:49 box -// a.kt:6 exclamate -// test.kt:49 box -// a.kt:6 exclamate -// test.kt:52 box -// a.kt:6 exclamate -// test.kt:52 box -// a.kt:6 exclamate -// a.kt:29 box -// a.kt:22 value -// test.kt:56 box diff --git a/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/diagnostics/JsCallChecker.kt b/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/diagnostics/JsCallChecker.kt index 31bcd475ddd..8cceef76020 100644 --- a/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/diagnostics/JsCallChecker.kt +++ b/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/diagnostics/JsCallChecker.kt @@ -19,7 +19,7 @@ package org.jetbrains.kotlin.js.resolve.diagnostics import com.google.gwt.dev.js.parserExceptions.AbortParsingException import com.google.gwt.dev.js.rhino.CodePosition import com.google.gwt.dev.js.rhino.ErrorReporter -import com.google.gwt.dev.js.rhino.Utils.isEndOfLine +import com.google.gwt.dev.js.rhino.offsetOf import com.intellij.openapi.util.TextRange import com.intellij.psi.PsiElement import org.jetbrains.kotlin.descriptors.CallableDescriptor @@ -148,35 +148,6 @@ class JsCodeErrorReporter( } } -/** - * Calculates an offset from the start of a text for a position, - * defined by line and offset in that line. - */ -private fun String.offsetOf(position: CodePosition): Int { - var i = 0 - var lineCount = 0 - var offsetInLine = 0 - - while (i < length) { - val c = this[i] - - if (lineCount == position.line && offsetInLine == position.offset) { - return i - } - - i++ - offsetInLine++ - - if (isEndOfLine(c.code)) { - offsetInLine = 0 - lineCount++ - assert(lineCount <= position.line) - } - } - - return length -} - private val KtExpression.isConstantStringLiteral: Boolean get() = this is KtStringTemplateExpression && entries.all { it is KtLiteralStringTemplateEntry } diff --git a/js/js.parser/src/com/google/gwt/dev/js/rhino/CodePosition.kt b/js/js.parser/src/com/google/gwt/dev/js/rhino/CodePosition.kt index 3c432a0f680..927abadde50 100644 --- a/js/js.parser/src/com/google/gwt/dev/js/rhino/CodePosition.kt +++ b/js/js.parser/src/com/google/gwt/dev/js/rhino/CodePosition.kt @@ -26,3 +26,32 @@ class CodePosition(val line: Int, val offset: Int) : Comparable { override fun toString(): String = "($line, $offset)" } + +/** + * Calculates an offset from the start of a text for a position, + * defined by line and offset in that line. + */ +fun String.offsetOf(position: CodePosition): Int { + var i = 0 + var lineCount = 0 + var offsetInLine = 0 + + while (i < length) { + val c = this[i] + + if (lineCount == position.line && offsetInLine == position.offset) { + return i + } + + i++ + offsetInLine++ + + if (Utils.isEndOfLine(c.code)) { + offsetInLine = 0 + lineCount++ + assert(lineCount <= position.line) + } + } + + return length +} diff --git a/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt b/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt index f137f208249..45206047b3e 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt @@ -158,6 +158,10 @@ fun main(args: Array) { model("debug/stepping") } + testClass { + model("debug/localVariables") + } + testClass( suiteTestClassName = "Fir2IrJsTextTestGenerated" ) { diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/JsSteppingTestAdditionalSourceProvider.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/JsSteppingTestAdditionalSourceProvider.kt new file mode 100644 index 00000000000..098d037de4f --- /dev/null +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/JsSteppingTestAdditionalSourceProvider.kt @@ -0,0 +1,43 @@ +/* + * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.js.test + +import org.jetbrains.kotlin.test.directives.ConfigurationDirectives +import org.jetbrains.kotlin.test.directives.model.RegisteredDirectives +import org.jetbrains.kotlin.test.model.TestFile +import org.jetbrains.kotlin.test.model.TestModule +import org.jetbrains.kotlin.test.services.AdditionalSourceProvider +import org.jetbrains.kotlin.test.services.ModuleStructureExtractor +import org.jetbrains.kotlin.test.services.TestServices +import java.io.File + +class JsSteppingTestAdditionalSourceProvider(testServices: TestServices) : AdditionalSourceProvider(testServices) { + + override fun produceAdditionalFiles(globalDirectives: RegisteredDirectives, module: TestModule): List { + // HACK: For some reason if we add the same additional files to each module (not only the main one), + // we get the 'Symbol already bound' exception during linking. + // The craziest part is that we run most of the box tests with additional files, where we _do_ add the same additional files + // to each module (using JsAdditionalSourceProvider), but the linker doesn't complain. + // For some reason, it doesn't like _specifically_ the symbols defined in compiler/testData/debug/jsTestHelpers. + return if (module.name == ModuleStructureExtractor.DEFAULT_MODULE_NAME) { + buildList { + if (containsDirective(globalDirectives, module, ConfigurationDirectives.WITH_STDLIB)) + add(File(WITH_STDLIB_HELPER_PATH).toTestFile()) + else + add(File(MINIMAL_HELPER_PATH).toTestFile()) + add(File(COMMON_HELPER_PATH).toTestFile()) + } + } else + emptyList() + } + + companion object { + private const val HELPERS_DIR = "compiler/testData/debug/jsTestHelpers" + private const val COMMON_HELPER_PATH = "$HELPERS_DIR/jsCommonTestHelpers.kt" + private const val MINIMAL_HELPER_PATH = "$HELPERS_DIR/jsMinimalTestHelpers.kt" + private const val WITH_STDLIB_HELPER_PATH = "$HELPERS_DIR/jsWithStdlibTestHelpers.kt" + } +} diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/debugger/ChromeDevToolsProtocol.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/debugger/ChromeDevToolsProtocol.kt index fe96c98ac2c..d34cb08983c 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/debugger/ChromeDevToolsProtocol.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/debugger/ChromeDevToolsProtocol.kt @@ -310,6 +310,9 @@ class Runtime(private val requestEvaluator: CDPRequestEvaluator) { @SerialName("symbol") SYMBOL, + @SerialName("accessor") + ACCESSOR, + @SerialName("bigint") BIGINT, } @@ -396,6 +399,10 @@ class Runtime(private val requestEvaluator: CDPRequestEvaluator) { * Object class (constructor) name. Specified for [ValueType.OBJECT] type values only. */ val className: String? = null, + /** + * Remote object value in case of primitive values or JSON values (if it was requested). + */ + val value: JsonElement? = null, /** * String representation of the object. */ @@ -403,7 +410,7 @@ class Runtime(private val requestEvaluator: CDPRequestEvaluator) { /** * Unique object identifier (for non-primitive values). */ - val objectId: RemoteObjectId? = null + val objectId: RemoteObjectId? = null, ) /** @@ -718,7 +725,11 @@ class Debugger(private val requestEvaluator: CDPRequestEvaluator) { } @Serializable - private class EvaluateOnCallFrameRequestParams(val callFrameId: CallFrameId, val expression: String) : CDPRequestParams() + private class EvaluateOnCallFrameRequestParams( + val callFrameId: CallFrameId, + val expression: String, + val returnByValue: Boolean? = null, + ) : CDPRequestParams() /** * Evaluates expression on a given call frame. @@ -727,15 +738,19 @@ class Debugger(private val requestEvaluator: CDPRequestEvaluator) { * * @param callFrameId Call frame identifier to evaluate on. * @param expression Expression to evaluate. + * @param returnByValue Whether the result is expected to be a JSON object that should be sent by value. */ - suspend fun evaluateOnCallFrame(callFrameId: CallFrameId, expression: String) = - requestEvaluator.evaluateRequest { messageId -> - encodeCDPMethodCall( - messageId, - "Debugger.evaluateOnCallFrame", - EvaluateOnCallFrameRequestParams(callFrameId, expression) - ) - } + suspend fun evaluateOnCallFrame( + callFrameId: CallFrameId, + expression: String, + returnByValue: Boolean? = null, + ) = requestEvaluator.evaluateRequest { messageId -> + encodeCDPMethodCall( + messageId, + "Debugger.evaluateOnCallFrame", + EvaluateOnCallFrameRequestParams(callFrameId, expression, returnByValue) + ) + } /** * Breakpoint identifier. @@ -803,6 +818,11 @@ class Debugger(private val requestEvaluator: CDPRequestEvaluator) { */ val location: Location, + /** + * Scope chain for this call frame. + */ + val scopeChain: List, + /** * `this` object for this call frame. */ @@ -814,6 +834,66 @@ class Debugger(private val requestEvaluator: CDPRequestEvaluator) { val returnValue: Runtime.RemoteObject? = null, ) + @Serializable + class Scope private constructor( + + /** + * Scope type. + */ + val type: ScopeType, + + /** + * Object representing the scope. For [ScopeType.GLOBAL] and [Scopetype.WITH] scopes it represents the actual object; + * for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties. + */ + val `object`: Runtime.RemoteObject, + + val name: String? = null, + + /** + * Location in the source code where scope starts + */ + val startLocation: Location? = null, + + /** + * Location in the source code where scope ends + */ + val endLocation: Location? = null, + ) + + @Serializable + enum class ScopeType { + @SerialName("global") + GLOBAL, + + @SerialName("local") + LOCAL, + + @SerialName("with") + WITH, + + @SerialName("closure") + CLOSURE, + + @SerialName("catch") + CATCH, + + @SerialName("block") + BLOCK, + + @SerialName("script") + SCRIPT, + + @SerialName("eval") + EVAL, + + @SerialName("module") + MODULE, + + @SerialName("wasm-expression-stack") + WASM_EXPRESSION_STACK, + } + @Serializable enum class PauseReason { diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/debugger/stepping_test_executor.js b/js/js.tests/test/org/jetbrains/kotlin/js/test/debugger/stepping_test_executor.js index aca1469d365..35e0198daeb 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/debugger/stepping_test_executor.js +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/debugger/stepping_test_executor.js @@ -16,8 +16,11 @@ try { vm.runInContext(code, sandbox, testFilePath); // language=JavaScript vm.runInContext(` + const __continuation = main.testUtils.makeEmptyContinuation(); + // noinspection JSUnusedLocalSymbols (called in debugger, see JsDebugRunner) + const __makeValueDescriptionForSteppingTests = main.testUtils.makeValueDescriptionForSteppingTests; debugger; - main.box(); + main.box(__continuation); `, sandbox ); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/handlers/JsDebugRunner.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/handlers/JsDebugRunner.kt index 1c30d2875a9..f5fd96da839 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/handlers/JsDebugRunner.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/handlers/JsDebugRunner.kt @@ -4,8 +4,16 @@ */ package org.jetbrains.kotlin.js.test.handlers +import com.google.gwt.dev.js.ThrowExceptionOnErrorReporter +import com.google.gwt.dev.js.rhino.CodePosition +import com.google.gwt.dev.js.rhino.offsetOf import kotlinx.coroutines.withTimeout +import kotlinx.serialization.Serializable +import kotlinx.serialization.json.Json +import kotlinx.serialization.json.decodeFromJsonElement import org.jetbrains.kotlin.ir.backend.js.transformers.irToJs.TranslationMode +import org.jetbrains.kotlin.js.backend.ast.* +import org.jetbrains.kotlin.js.parser.parseFunction import org.jetbrains.kotlin.js.parser.sourcemaps.* import org.jetbrains.kotlin.js.test.debugger.* import org.jetbrains.kotlin.js.test.utils.getAllFilesForRunner @@ -15,9 +23,7 @@ import org.jetbrains.kotlin.test.model.TestModule import org.jetbrains.kotlin.test.services.TestServices import org.jetbrains.kotlin.test.services.configuration.JsEnvironmentConfigurator import org.jetbrains.kotlin.test.services.moduleStructure -import org.jetbrains.kotlin.test.utils.SteppingTestLoggedData -import org.jetbrains.kotlin.test.utils.checkSteppingTestResult -import org.jetbrains.kotlin.test.utils.formatAsSteppingTestExpectation +import org.jetbrains.kotlin.test.utils.* import java.io.File import java.net.URI import java.net.URISyntaxException @@ -39,7 +45,7 @@ import java.net.URISyntaxException * supported. * */ -class JsDebugRunner(testServices: TestServices) : AbstractJsArtifactsCollector(testServices) { +class JsDebugRunner(testServices: TestServices, private val localVariables: Boolean) : AbstractJsArtifactsCollector(testServices) { override fun processAfterAllModules(someAssertionWasFailed: Boolean) { if (someAssertionWasFailed) return @@ -69,7 +75,7 @@ class JsDebugRunner(testServices: TestServices) : AbstractJsArtifactsCollector(t mainModule: TestModule, ) { val originalFile = mainModule.files.first { !it.isAdditional }.originalFile - val debuggerFacade = NodeJsDebuggerFacade(jsFilePath) + val debuggerFacade = NodeJsDebuggerFacade(jsFilePath, localVariables) val jsFile = File(jsFilePath) @@ -105,7 +111,7 @@ class JsDebugRunner(testServices: TestServices) : AbstractJsArtifactsCollector(t repeatedlyStepInto { callFrame -> callFrame.isInFileUnderTest().also { if (it) - addCallFrameInfoToLoggedItems(sourceMap, callFrame, loggedItems) + addCallFrameInfoToLoggedItems(jsFile, sourceMap, callFrame, loggedItems) } } @@ -120,7 +126,8 @@ class JsDebugRunner(testServices: TestServices) : AbstractJsArtifactsCollector(t ) } - private fun addCallFrameInfoToLoggedItems( + private suspend fun NodeJsDebuggerFacade.Context.addCallFrameInfoToLoggedItems( + jsFile: File, sourceMap: SourceMap, topMostCallFrame: Debugger.CallFrame, loggedItems: MutableList @@ -139,6 +146,7 @@ class JsDebugRunner(testServices: TestServices) : AbstractJsArtifactsCollector(t sourceLine + 1, originalFunctionName ?: topMostCallFrame.functionName, false, + getLocalVariables(jsFile, sourceMap, topMostCallFrame), ) loggedItems.add(SteppingTestLoggedData(sourceLine + 1, false, expectation)) } @@ -164,7 +172,7 @@ class JsDebugRunner(testServices: TestServices) : AbstractJsArtifactsCollector(t * * @param jsFilePath the test file to execute and debug. */ -private class NodeJsDebuggerFacade(jsFilePath: String) { +private class NodeJsDebuggerFacade(jsFilePath: String, private val localVariables: Boolean) { private val inspector = NodeJsInspectorClient("js/js.tests/test/org/jetbrains/kotlin/js/test/debugger/stepping_test_executor.js", listOf(jsFilePath)) @@ -173,6 +181,8 @@ private class NodeJsDebuggerFacade(jsFilePath: String) { private var pausedEvent: Debugger.Event.Paused? = null + private val sourceCache = mutableMapOf() + init { inspector.onEvent { event -> when (event) { @@ -220,6 +230,100 @@ private class NodeJsDebuggerFacade(jsFilePath: String) { } suspend fun waitForResumeEvent() = waitForConditionToBecomeTrue { pausedEvent == null } + + suspend fun getLocalVariables( + jsFile: File, + sourceMap: SourceMap, + callFrame: Debugger.CallFrame + ): List? { + if (!localVariables) return null + val functionScope = callFrame.scopeChain.find { it.type in setOf(Debugger.ScopeType.LOCAL, Debugger.ScopeType.CLOSURE) } + ?: return null + val scopeStart = functionScope.startLocation?.toCodePosition() ?: error("Missing scope location") + val scopeEnd = functionScope.endLocation?.toCodePosition() ?: error("Missing scope location") + val jsFileURI = jsFile.makeURI() + require(URI(scriptUrlByScriptId(functionScope.startLocation.scriptId)) == jsFileURI) { + "Invalid scope location: $scopeStart. Expected scope location to be in $jsFile" + } + + val sourceText = sourceCache.getOrPut(jsFileURI, jsFile::readText) + + val scopeText = sourceText.let { + it.substring(it.offsetOf(scopeStart), it.offsetOf(scopeEnd)) + } + + val prefix = "function" + + // Function scope starts with an open paren, so we need to add the keyword to make it valid JavaScript. + // TODO: This will not work with arrows. As of 2022 we don't generate them, but we might in the future. + val parseableScopeText = prefix + scopeText + val scope = JsProgram().scope + val jsFunction = parseFunction( + parseableScopeText, + jsFile.name, + CodePosition(scopeStart.line, scopeStart.offset - prefix.length), + 0, + ThrowExceptionOnErrorReporter, + scope + ) ?: error("Could not parse scope: \n$parseableScopeText") + + val variables = mutableListOf() + + object : JsVisitor() { + override fun visitElement(node: JsNode) { + node.acceptChildren(this) + } + + override fun visit(x: JsVars.JsVar) { + super.visit(x) + variables.add(x) + } + + override fun visitParameter(x: JsParameter) { + super.visitParameter(x) + variables.add(x) + } + }.accept(jsFunction) + + val nameMapping = variables.mapNotNull { variable -> + if (variable !is HasName) error("Unexpected JsNode: $variable") + + // Filter out variables declared in nested functions + if (!jsFunction.scope.hasOwnName(variable.name.toString())) return@mapNotNull null + + val location = variable.source + if (location !is JsLocation?) error("JsLocation expected. Found instead: $location") + if (location == null) + null + else sourceMap.segmentForGeneratedLocation(location.startLine, location.startChar)?.name?.let { + it to variable.name.toString() + } + } + + if (nameMapping.isEmpty()) return emptyList() + + val expression = nameMapping.joinToString(separator = ",", prefix = "[", postfix = "]") { (_, generatedName) -> + "__makeValueDescriptionForSteppingTests($generatedName)" + } + val evaluationResult = debugger.evaluateOnCallFrame(callFrame.callFrameId, expression, returnByValue = true) + if (evaluationResult.exceptionDetails != null) { + evaluationResult.exceptionDetails.rethrow() + } + + val valueDescriptions = + Json.Default.decodeFromJsonElement>(evaluationResult.result.value ?: error("missing value")) + + return nameMapping.mapIndexedNotNull { i, (originalName, _) -> + valueDescriptions[i]?.toLocalVariableRecord(originalName) + } + } + + private fun Runtime.ExceptionDetails.rethrow(): Nothing { + if (exception?.description != null) error(exception.description) + if (scriptId == null) error(text) + val scriptURL = scriptUrls[scriptId] ?: url ?: error(text) + error("$text ($scriptURL:$lineNumber:$columnNumber)") + } } } @@ -228,6 +332,8 @@ private fun File.makeURI(): URI = absoluteFile.toURI().withAuthority("") private fun URI.withAuthority(newAuthority: String?) = URI(scheme, newAuthority, path, query, fragment) +private fun Debugger.Location.toCodePosition() = CodePosition(lineNumber, columnNumber ?: -1) + private fun SourceMap.segmentForGeneratedLocation(lineNumber: Int, columnNumber: Int?): SourceMapSegment? { val group = groups.getOrNull(lineNumber)?.takeIf { it.segments.isNotEmpty() } ?: return null @@ -245,3 +351,16 @@ private fun SourceMap.segmentForGeneratedLocation(lineNumber: Int, columnNumber: group.segments[candidateIndex - 1] } } + +@Serializable +private class ValueDescription(val isNull: Boolean, val isReferenceType: Boolean, val valueDescription: String, val typeName: String) { + fun toLocalVariableRecord(variableName: String) = LocalVariableRecord( + variable = variableName, + variableType = null, // In JavaScript variables are untyped + value = when { + isNull -> LocalNullValue + isReferenceType -> LocalReference("", typeName) + else -> LocalPrimitive(valueDescription, typeName) + } + ) +} diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/AbstractJsIrTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/AbstractJsIrTest.kt index 9b1658c18f4..e6617e80abd 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/AbstractJsIrTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/AbstractJsIrTest.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.js.test.ir import org.jetbrains.kotlin.js.test.AbstractJsBlackBoxCodegenTestBase import org.jetbrains.kotlin.js.test.JsAdditionalSourceProvider +import org.jetbrains.kotlin.js.test.JsSteppingTestAdditionalSourceProvider import org.jetbrains.kotlin.js.test.converters.JsIrBackendFacade import org.jetbrains.kotlin.js.test.converters.JsKlibBackendFacade import org.jetbrains.kotlin.js.test.converters.incremental.RecompileModuleJsIrBackendFacade @@ -157,8 +158,25 @@ open class AbstractIrJsSteppingTest : AbstractJsIrTest( defaultDirectives { +JsEnvironmentConfigurationDirectives.NO_COMMON_FILES } + useAdditionalSourceProviders(::JsSteppingTestAdditionalSourceProvider) jsArtifactsHandlersStep { - useHandlers(::JsDebugRunner) + useHandlers({ JsDebugRunner(it, localVariables = false) }) + } + } +} + +open class AbstractIrJsLocalVariableTest : AbstractJsIrTest( + pathToTestDir = "compiler/testData/debug/localVariables/", + testGroupOutputDirPrefix = "debug/localVariables/" +) { + override fun TestConfigurationBuilder.configuration() { + commonConfigurationForJsBlackBoxCodegenTest() + defaultDirectives { + +JsEnvironmentConfigurationDirectives.NO_COMMON_FILES + } + useAdditionalSourceProviders(::JsSteppingTestAdditionalSourceProvider) + jsArtifactsHandlersStep { + useHandlers({ JsDebugRunner(it, localVariables = true) }) } } } diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsLocalVariableTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsLocalVariableTestGenerated.java new file mode 100644 index 00000000000..ddac4e3e4f9 --- /dev/null +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsLocalVariableTestGenerated.java @@ -0,0 +1,455 @@ +/* + * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.js.test.ir; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.util.KtTestUtil; +import org.jetbrains.kotlin.test.TargetBackend; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateJsTestsKt}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/testData/debug/localVariables") +@TestDataPath("$PROJECT_ROOT") +public class IrJsLocalVariableTestGenerated extends AbstractIrJsLocalVariableTest { + @Test + public void testAllFilesPresentInLocalVariables() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/localVariables"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @Test + @TestMetadata("assignment.kt") + public void testAssignment() throws Exception { + runTest("compiler/testData/debug/localVariables/assignment.kt"); + } + + @Test + @TestMetadata("catchClause.kt") + public void testCatchClause() throws Exception { + runTest("compiler/testData/debug/localVariables/catchClause.kt"); + } + + @Test + @TestMetadata("copyFunction.kt") + public void testCopyFunction() throws Exception { + runTest("compiler/testData/debug/localVariables/copyFunction.kt"); + } + + @Test + @TestMetadata("directInvoke.kt") + public void testDirectInvoke() throws Exception { + runTest("compiler/testData/debug/localVariables/directInvoke.kt"); + } + + @Test + @TestMetadata("doWhile.kt") + public void testDoWhile() throws Exception { + runTest("compiler/testData/debug/localVariables/doWhile.kt"); + } + + @Test + @TestMetadata("emptyFun.kt") + public void testEmptyFun() throws Exception { + runTest("compiler/testData/debug/localVariables/emptyFun.kt"); + } + + @Test + @TestMetadata("forLoopMultiline.kt") + public void testForLoopMultiline() throws Exception { + runTest("compiler/testData/debug/localVariables/forLoopMultiline.kt"); + } + + @Test + @TestMetadata("inlineProperty.kt") + public void testInlineProperty() throws Exception { + runTest("compiler/testData/debug/localVariables/inlineProperty.kt"); + } + + @Test + @TestMetadata("jsCode.kt") + public void testJsCode() throws Exception { + runTest("compiler/testData/debug/localVariables/jsCode.kt"); + } + + @Test + @TestMetadata("localFun.kt") + public void testLocalFun() throws Exception { + runTest("compiler/testData/debug/localVariables/localFun.kt"); + } + + @Test + @TestMetadata("localFunUnused.kt") + public void testLocalFunUnused() throws Exception { + runTest("compiler/testData/debug/localVariables/localFunUnused.kt"); + } + + @Test + @TestMetadata("tryFinally.kt") + public void testTryFinally() throws Exception { + runTest("compiler/testData/debug/localVariables/tryFinally.kt"); + } + + @Test + @TestMetadata("tryFinally10.kt") + public void testTryFinally10() throws Exception { + runTest("compiler/testData/debug/localVariables/tryFinally10.kt"); + } + + @Test + @TestMetadata("tryFinally11.kt") + public void testTryFinally11() throws Exception { + runTest("compiler/testData/debug/localVariables/tryFinally11.kt"); + } + + @Test + @TestMetadata("tryFinally12.kt") + public void testTryFinally12() throws Exception { + runTest("compiler/testData/debug/localVariables/tryFinally12.kt"); + } + + @Test + @TestMetadata("tryFinally13.kt") + public void testTryFinally13() throws Exception { + runTest("compiler/testData/debug/localVariables/tryFinally13.kt"); + } + + @Test + @TestMetadata("tryFinally14.kt") + public void testTryFinally14() throws Exception { + runTest("compiler/testData/debug/localVariables/tryFinally14.kt"); + } + + @Test + @TestMetadata("tryFinally15.kt") + public void testTryFinally15() throws Exception { + runTest("compiler/testData/debug/localVariables/tryFinally15.kt"); + } + + @Test + @TestMetadata("tryFinally16.kt") + public void testTryFinally16() throws Exception { + runTest("compiler/testData/debug/localVariables/tryFinally16.kt"); + } + + @Test + @TestMetadata("tryFinally17.kt") + public void testTryFinally17() throws Exception { + runTest("compiler/testData/debug/localVariables/tryFinally17.kt"); + } + + @Test + @TestMetadata("tryFinally2.kt") + public void testTryFinally2() throws Exception { + runTest("compiler/testData/debug/localVariables/tryFinally2.kt"); + } + + @Test + @TestMetadata("tryFinally3.kt") + public void testTryFinally3() throws Exception { + runTest("compiler/testData/debug/localVariables/tryFinally3.kt"); + } + + @Test + @TestMetadata("tryFinally4.kt") + public void testTryFinally4() throws Exception { + runTest("compiler/testData/debug/localVariables/tryFinally4.kt"); + } + + @Test + @TestMetadata("tryFinally5.kt") + public void testTryFinally5() throws Exception { + runTest("compiler/testData/debug/localVariables/tryFinally5.kt"); + } + + @Test + @TestMetadata("tryFinally6.kt") + public void testTryFinally6() throws Exception { + runTest("compiler/testData/debug/localVariables/tryFinally6.kt"); + } + + @Test + @TestMetadata("tryFinally7.kt") + public void testTryFinally7() throws Exception { + runTest("compiler/testData/debug/localVariables/tryFinally7.kt"); + } + + @Test + @TestMetadata("tryFinally8.kt") + public void testTryFinally8() throws Exception { + runTest("compiler/testData/debug/localVariables/tryFinally8.kt"); + } + + @Test + @TestMetadata("tryFinally9.kt") + public void testTryFinally9() throws Exception { + runTest("compiler/testData/debug/localVariables/tryFinally9.kt"); + } + + @Test + @TestMetadata("underscoreNames.kt") + public void testUnderscoreNames() throws Exception { + runTest("compiler/testData/debug/localVariables/underscoreNames.kt"); + } + + @Nested + @TestMetadata("compiler/testData/debug/localVariables/constructors") + @TestDataPath("$PROJECT_ROOT") + public class Constructors { + @Test + public void testAllFilesPresentInConstructors() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/localVariables/constructors"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @Test + @TestMetadata("multipleConstructors.kt") + public void testMultipleConstructors() throws Exception { + runTest("compiler/testData/debug/localVariables/constructors/multipleConstructors.kt"); + } + + @Test + @TestMetadata("property.kt") + public void testProperty() throws Exception { + runTest("compiler/testData/debug/localVariables/constructors/property.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/debug/localVariables/destructuring") + @TestDataPath("$PROJECT_ROOT") + public class Destructuring { + @Test + public void testAllFilesPresentInDestructuring() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/localVariables/destructuring"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @Test + @TestMetadata("assignment.kt") + public void testAssignment() throws Exception { + runTest("compiler/testData/debug/localVariables/destructuring/assignment.kt"); + } + + @Test + @TestMetadata("assignmentCustomComponentNs.kt") + public void testAssignmentCustomComponentNs() throws Exception { + runTest("compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNs.kt"); + } + + @Test + @TestMetadata("assignmentCustomComponentNsMultiline.kt") + public void testAssignmentCustomComponentNsMultiline() throws Exception { + runTest("compiler/testData/debug/localVariables/destructuring/assignmentCustomComponentNsMultiline.kt"); + } + + @Test + @TestMetadata("assignmentMultiline.kt") + public void testAssignmentMultiline() throws Exception { + runTest("compiler/testData/debug/localVariables/destructuring/assignmentMultiline.kt"); + } + + @Test + @TestMetadata("assignmentUnderscoreNames.kt") + public void testAssignmentUnderscoreNames() throws Exception { + runTest("compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNames.kt"); + } + + @Test + @TestMetadata("assignmentUnderscoreNamesMultiline.kt") + public void testAssignmentUnderscoreNamesMultiline() throws Exception { + runTest("compiler/testData/debug/localVariables/destructuring/assignmentUnderscoreNamesMultiline.kt"); + } + + @Test + @TestMetadata("forLoop.kt") + public void testForLoop() throws Exception { + runTest("compiler/testData/debug/localVariables/destructuring/forLoop.kt"); + } + + @Test + @TestMetadata("forLoopMultiline.kt") + public void testForLoopMultiline() throws Exception { + runTest("compiler/testData/debug/localVariables/destructuring/forLoopMultiline.kt"); + } + + @Test + @TestMetadata("lambda.kt") + public void testLambda() throws Exception { + runTest("compiler/testData/debug/localVariables/destructuring/lambda.kt"); + } + + @Test + @TestMetadata("lambdaCustomComponentNs.kt") + public void testLambdaCustomComponentNs() throws Exception { + runTest("compiler/testData/debug/localVariables/destructuring/lambdaCustomComponentNs.kt"); + } + + @Test + @TestMetadata("lambdaCustomComponentNsMultiline.kt") + public void testLambdaCustomComponentNsMultiline() throws Exception { + runTest("compiler/testData/debug/localVariables/destructuring/lambdaCustomComponentNsMultiline.kt"); + } + + @Test + @TestMetadata("lambdaMultiline.kt") + public void testLambdaMultiline() throws Exception { + runTest("compiler/testData/debug/localVariables/destructuring/lambdaMultiline.kt"); + } + + @Test + @TestMetadata("lambdaMultipleDestructs.kt") + public void testLambdaMultipleDestructs() throws Exception { + runTest("compiler/testData/debug/localVariables/destructuring/lambdaMultipleDestructs.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/debug/localVariables/receiverMangling") + @TestDataPath("$PROJECT_ROOT") + public class ReceiverMangling { + @Test + public void testAllFilesPresentInReceiverMangling() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/localVariables/receiverMangling"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @Test + @TestMetadata("capturedThisField.kt") + public void testCapturedThisField() throws Exception { + runTest("compiler/testData/debug/localVariables/receiverMangling/capturedThisField.kt"); + } + + @Test + @TestMetadata("labeledThisParameterLabel.kt") + public void testLabeledThisParameterLabel() throws Exception { + runTest("compiler/testData/debug/localVariables/receiverMangling/labeledThisParameterLabel.kt"); + } + + @Test + @TestMetadata("lambdaWithExtensionReceiver.kt") + public void testLambdaWithExtensionReceiver() throws Exception { + runTest("compiler/testData/debug/localVariables/receiverMangling/lambdaWithExtensionReceiver.kt"); + } + + @Test + @TestMetadata("receiverParameter.kt") + public void testReceiverParameter() throws Exception { + runTest("compiler/testData/debug/localVariables/receiverMangling/receiverParameter.kt"); + } + + @Test + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/debug/localVariables/receiverMangling/simple.kt"); + } + + @Test + @TestMetadata("simpleCapturedReceiver.kt") + public void testSimpleCapturedReceiver() throws Exception { + runTest("compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiver.kt"); + } + + @Test + @TestMetadata("simpleCapturedReceiverWithLabel.kt") + public void testSimpleCapturedReceiverWithLabel() throws Exception { + runTest("compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithLabel.kt"); + } + + @Test + @TestMetadata("simpleCapturedReceiverWithParenthesis.kt") + public void testSimpleCapturedReceiverWithParenthesis() throws Exception { + runTest("compiler/testData/debug/localVariables/receiverMangling/simpleCapturedReceiverWithParenthesis.kt"); + } + } + + @Nested + @TestMetadata("compiler/testData/debug/localVariables/suspend") + @TestDataPath("$PROJECT_ROOT") + public class Suspend { + @Test + public void testAllFilesPresentInSuspend() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/localVariables/suspend"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @Test + @TestMetadata("inlineLocalsStateMachineTransform.kt") + public void testInlineLocalsStateMachineTransform() throws Exception { + runTest("compiler/testData/debug/localVariables/suspend/inlineLocalsStateMachineTransform.kt"); + } + + @Test + @TestMetadata("localsStateMachineTransform.kt") + public void testLocalsStateMachineTransform() throws Exception { + runTest("compiler/testData/debug/localVariables/suspend/localsStateMachineTransform.kt"); + } + + @Test + @TestMetadata("mergeLvt.kt") + public void testMergeLvt() throws Exception { + runTest("compiler/testData/debug/localVariables/suspend/mergeLvt.kt"); + } + + @Test + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + runTest("compiler/testData/debug/localVariables/suspend/simple.kt"); + } + + @Test + @TestMetadata("underscoreNames.kt") + public void testUnderscoreNames() throws Exception { + runTest("compiler/testData/debug/localVariables/suspend/underscoreNames.kt"); + } + + @Nested + @TestMetadata("compiler/testData/debug/localVariables/suspend/completion") + @TestDataPath("$PROJECT_ROOT") + public class Completion { + @Test + public void testAllFilesPresentInCompletion() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/debug/localVariables/suspend/completion"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + + @Test + @TestMetadata("nonStaticSimple.kt") + public void testNonStaticSimple() throws Exception { + runTest("compiler/testData/debug/localVariables/suspend/completion/nonStaticSimple.kt"); + } + + @Test + @TestMetadata("nonStaticStateMachine.kt") + public void testNonStaticStateMachine() throws Exception { + runTest("compiler/testData/debug/localVariables/suspend/completion/nonStaticStateMachine.kt"); + } + + @Test + @TestMetadata("staticSimple.kt") + public void testStaticSimple() throws Exception { + runTest("compiler/testData/debug/localVariables/suspend/completion/staticSimple.kt"); + } + + @Test + @TestMetadata("staticSimpleReceiver.kt") + public void testStaticSimpleReceiver() throws Exception { + runTest("compiler/testData/debug/localVariables/suspend/completion/staticSimpleReceiver.kt"); + } + + @Test + @TestMetadata("staticStateMachine.kt") + public void testStaticStateMachine() throws Exception { + runTest("compiler/testData/debug/localVariables/suspend/completion/staticStateMachine.kt"); + } + + @Test + @TestMetadata("staticStateMachineReceiver.kt") + public void testStaticStateMachineReceiver() throws Exception { + runTest("compiler/testData/debug/localVariables/suspend/completion/staticStateMachineReceiver.kt"); + } + } + } +} diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsSteppingTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsSteppingTestGenerated.java index 1d90d3db8e7..1ec89e3807f 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsSteppingTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsSteppingTestGenerated.java @@ -247,12 +247,6 @@ public class IrJsSteppingTestGenerated extends AbstractIrJsSteppingTest { runTest("compiler/testData/debug/stepping/inlineSimpleCall.kt"); } - @Test - @TestMetadata("jsCode.kt") - public void testJsCode() throws Exception { - runTest("compiler/testData/debug/stepping/jsCode.kt"); - } - @Test @TestMetadata("kt15259.kt") public void testKt15259() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsIrLineNumberTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsIrLineNumberTestGenerated.java index 70e526fad9d..88d5344ed78 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsIrLineNumberTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/JsIrLineNumberTestGenerated.java @@ -205,12 +205,6 @@ public class JsIrLineNumberTestGenerated extends AbstractJsIrLineNumberTest { runTest("js/js.translator/testData/lineNumbers/isOperator.kt"); } - @Test - @TestMetadata("jsCode.kt") - public void testJsCode() throws Exception { - runTest("js/js.translator/testData/lineNumbers/jsCode.kt"); - } - @Test @TestMetadata("lambdaWithClosure.kt") public void testLambdaWithClosure() throws Exception { diff --git a/js/js.translator/testData/lineNumbers/catch.kt b/js/js.translator/testData/lineNumbers/catch.kt index aa8d367f972..0a0768935b5 100644 --- a/js/js.translator/testData/lineNumbers/catch.kt +++ b/js/js.translator/testData/lineNumbers/catch.kt @@ -19,5 +19,5 @@ fun bar() { } } -// LINES(JS): 1 11 3 3 5 5 6 6 8 8 9 9 2 2 * 13 20 15 15 18 18 -// LINES(JS_IR): 1 1 3 3 * 5 5 5 6 6 * 8 8 8 9 9 * 13 13 15 15 17 17 17 18 18 +// LINES(JS): 1 11 3 3 5 5 6 6 8 8 9 9 2 2 * 13 20 15 15 18 18 +// LINES(JS_IR): 1 1 3 3 * 5 5 6 6 * 8 8 9 9 * 13 13 15 15 17 17 18 18 diff --git a/js/js.translator/testData/lineNumbers/classCapturingLocals.kt b/js/js.translator/testData/lineNumbers/classCapturingLocals.kt index 9441bbf6948..2ca4f510977 100644 --- a/js/js.translator/testData/lineNumbers/classCapturingLocals.kt +++ b/js/js.translator/testData/lineNumbers/classCapturingLocals.kt @@ -15,4 +15,4 @@ fun A.foo() { fun baz() = 23 // LINES(JS): 1 * 5 5 5 6 9 7 7 8 8 * 3 13 4 4 11 11 12 12 15 15 15 -// LINES(JS_IR): 1 1 3 3 4 4 11 11 12 12 15 15 15 15 5 5 * 6 7 7 8 8 +// LINES(JS_IR): 1 1 3 3 4 11 11 12 12 15 15 15 15 5 3 4 5 * 6 7 7 8 8 diff --git a/js/js.translator/testData/lineNumbers/closure.kt b/js/js.translator/testData/lineNumbers/closure.kt index 1d711ee200d..331b009bae0 100644 --- a/js/js.translator/testData/lineNumbers/closure.kt +++ b/js/js.translator/testData/lineNumbers/closure.kt @@ -5,5 +5,5 @@ fun box(x: Int, y: Int): Int { return foo(y) } -// LINES(JS): 2 2 2 4 4 1 6 2 2 5 5 -// LINES(JS_IR): 1 1 5 5 2 4 4 4 +// LINES(JS): 2 2 2 4 4 1 6 2 2 5 5 +// LINES(JS_IR): 1 1 5 5 2 1 3 4 4 4 diff --git a/js/js.translator/testData/lineNumbers/complexExpressionAsDefaultArgument.kt b/js/js.translator/testData/lineNumbers/complexExpressionAsDefaultArgument.kt index 848009eb5d9..234c41a26e5 100644 --- a/js/js.translator/testData/lineNumbers/complexExpressionAsDefaultArgument.kt +++ b/js/js.translator/testData/lineNumbers/complexExpressionAsDefaultArgument.kt @@ -11,5 +11,5 @@ fun baz() = 1 fun bar() = 2 -// LINES(JS): 1 3 3 2 2 4 3 4 4 4 5 5 2 8 8 10 10 10 12 12 12 -// LINES(JS_IR): 1 * 3 3 4 5 * 8 8 10 10 10 10 12 12 12 12 +// LINES(JS): 1 3 3 2 2 4 3 4 4 4 5 5 2 8 8 10 10 10 12 12 12 +// LINES(JS_IR): 1 2 * 3 4 5 * 8 8 10 10 10 10 12 12 12 12 diff --git a/js/js.translator/testData/lineNumbers/coroutine.kt b/js/js.translator/testData/lineNumbers/coroutine.kt index c769c09452b..20e872f1ef0 100644 --- a/js/js.translator/testData/lineNumbers/coroutine.kt +++ b/js/js.translator/testData/lineNumbers/coroutine.kt @@ -15,4 +15,4 @@ suspend fun bar(): Unit { } // LINES(JS): 39 4 4 4 7 5 5 45 45 5 93 45 5 5 6 4 4 4 9 15 9 9 9 * 9 15 10 10 11 11 11 11 11 * 11 12 12 13 13 13 13 13 13 13 14 14 * 9 15 9 9 9 9 -// LINES(JS_IR): 4 4 * 19 * 19 19 * 5 * 45 * 50 50 93 93 3 45 3 45 45 6 6 19 19 7 7 9 9 * 9 * 10 10 * 11 * 11 12 12 * 13 * 13 13 14 14 15 15 +// LINES(JS_IR): 4 4 * 19 * 19 * 5 * 45 * 50 93 93 3 45 3 45 45 6 6 19 7 7 9 9 * 9 * 9 * 10 10 * 11 * 11 12 12 * 13 * 13 14 14 15 15 diff --git a/js/js.translator/testData/lineNumbers/coroutineNullAssertion.kt b/js/js.translator/testData/lineNumbers/coroutineNullAssertion.kt index 0bc7cd6d26f..c61bc388869 100644 --- a/js/js.translator/testData/lineNumbers/coroutineNullAssertion.kt +++ b/js/js.translator/testData/lineNumbers/coroutineNullAssertion.kt @@ -9,4 +9,4 @@ suspend fun delay() { } // LINES(JS): 1 6 1 1 * 1 6 2 2 2 2 2 * 3 3 4 4 4 4 4 5 5 * 1 6 1 1 1 1 8 9 -// LINES(JS_IR): 1 1 * 8 8 9 9 * 1 * 2 * 3 3 3 * 5 5 6 6 +// LINES(JS_IR): 1 1 * 8 8 9 9 1 * 1 * 2 * 3 3 3 * 5 5 6 6 diff --git a/js/js.translator/testData/lineNumbers/dataClass.kt b/js/js.translator/testData/lineNumbers/dataClass.kt index ff6c6889ae4..1224da4a58c 100644 --- a/js/js.translator/testData/lineNumbers/dataClass.kt +++ b/js/js.translator/testData/lineNumbers/dataClass.kt @@ -4,4 +4,4 @@ data class A( ) // LINES(JS): 1 2 3 * 1 2 2 1 3 3 1 1 1 2 3 1 1 1 2 3 1 1 1 2 3 1 1 1 1 1 2 3 -// LINES(JS_IR): 1 1 2 2 3 3 2 2 2 3 3 3 1 1 1 1 1 1 1 1 1 1 1 1 * 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +// LINES(JS_IR): 1 2 3 1 2 2 3 3 2 2 2 3 3 3 1 1 1 1 1 1 1 2 3 1 1 1 1 2 3 1 1 * 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 diff --git a/js/js.translator/testData/lineNumbers/delegateMemberVal.kt b/js/js.translator/testData/lineNumbers/delegateMemberVal.kt index 83c0e862808..98e828d1aba 100644 --- a/js/js.translator/testData/lineNumbers/delegateMemberVal.kt +++ b/js/js.translator/testData/lineNumbers/delegateMemberVal.kt @@ -14,4 +14,4 @@ class Delegate(val f: () -> Int) { } // LINES(JS): 1 2 3 * 2 2 3 3 3 3 * 6 8 7 7 10 10 11 13 12 12 -// LINES(JS_IR): 3 3 3 3 1 1 3 3 3 2 3 3 3 2 1 2 6 6 7 7 10 10 10 10 10 10 10 11 12 12 2 2 +// LINES(JS_IR): 3 3 3 3 1 1 3 3 3 2 3 3 3 2 1 2 6 6 7 7 10 10 10 10 10 10 10 11 12 12 2 2 18 * 2 diff --git a/js/js.translator/testData/lineNumbers/delegatedProperty.kt b/js/js.translator/testData/lineNumbers/delegatedProperty.kt index 0f6b658439c..4a9223de5c9 100644 --- a/js/js.translator/testData/lineNumbers/delegatedProperty.kt +++ b/js/js.translator/testData/lineNumbers/delegatedProperty.kt @@ -16,4 +16,4 @@ class B { } // LINES(JS): 3 4 5 * 4 4 4 * 8 9 11 10 10 13 15 14 14 -// LINES(JS_IR): 3 3 5 5 4 5 5 5 4 1 4 5 4 5 5 5 4 1 4 8 8 9 10 10 13 14 14 4 4 * 4 4 +// LINES(JS_IR): 3 3 5 5 4 5 5 5 4 1 4 5 4 5 5 5 4 1 4 8 8 9 10 10 13 14 14 4 4 20 * 4 20 * 4 4 20 * 4 20 diff --git a/js/js.translator/testData/lineNumbers/destructuring.kt b/js/js.translator/testData/lineNumbers/destructuring.kt index e43857c796e..ac6762254de 100644 --- a/js/js.translator/testData/lineNumbers/destructuring.kt +++ b/js/js.translator/testData/lineNumbers/destructuring.kt @@ -28,4 +28,4 @@ fun bar(f: (Pair) -> Unit) { // LINES(JS): 15 22 16 16 17 18 20 20 21 21 22 22 3 23 9 9 9 9 4 9 9 9 5 5 6 7 11 11 12 12 15 15 25 27 26 26 * 1 * 1 -// LINES(JS_IR): 1 1 1 1 1 1 1 1 * 3 3 9 9 9 4 9 9 6 6 9 7 7 9 11 11 12 12 15 15 25 25 26 26 15 15 17 17 16 18 18 16 20 20 21 21 22 22 * 1 +// LINES(JS_IR): 1 1 1 1 1 1 1 1 * 3 3 9 9 4 9 6 9 7 9 11 11 12 12 15 15 25 25 26 26 15 16 15 17 16 18 16 20 20 21 21 22 22 * 1 diff --git a/js/js.translator/testData/lineNumbers/destructuringInline.kt b/js/js.translator/testData/lineNumbers/destructuringInline.kt index 4c5412bcb28..74e12471a6b 100644 --- a/js/js.translator/testData/lineNumbers/destructuringInline.kt +++ b/js/js.translator/testData/lineNumbers/destructuringInline.kt @@ -33,4 +33,4 @@ inline operator fun P.component1() = a inline operator fun P.component2() = b // LINES(JS): 15 22 17 17 31 18 18 33 20 20 21 21 22 22 3 23 9 9 9 9 4 9 9 9 6 6 31 7 7 33 11 11 12 12 15 15 25 27 26 26 29 29 29 * 31 31 31 33 33 33 * 1 * 1 -// LINES(JS_IR): 1 1 1 1 1 1 1 1 * 3 3 9 9 9 4 9 9 * 6 * 31 31 9 6 6 * 7 * 33 33 9 7 7 11 11 12 12 15 15 25 25 26 26 29 29 29 29 29 29 29 29 29 29 29 29 31 31 31 31 33 33 33 33 15 15 * 17 * 31 31 16 17 17 * 18 * 33 33 16 18 18 20 20 21 21 22 22 * 1 +// LINES(JS_IR): 1 1 1 1 1 1 1 1 * 3 3 9 9 4 9 * 6 * 31 31 9 6 * 7 * 33 33 9 7 11 11 12 12 15 15 25 25 26 26 29 29 29 29 29 29 29 29 29 29 29 29 31 31 31 31 33 33 33 33 15 16 15 * 17 * 31 31 16 17 * 18 * 33 33 16 18 20 20 21 21 22 22 * 1 diff --git a/js/js.translator/testData/lineNumbers/doWhileWithComplexCondition.kt b/js/js.translator/testData/lineNumbers/doWhileWithComplexCondition.kt index dff6ecca68e..47499fd207a 100644 --- a/js/js.translator/testData/lineNumbers/doWhileWithComplexCondition.kt +++ b/js/js.translator/testData/lineNumbers/doWhileWithComplexCondition.kt @@ -13,5 +13,5 @@ fun box() { ) } -// LINES(JS): 1 14 8 8 7 3 2 2 3 3 3 8 8 11 11 * 3 7 12 3 3 4 4 -// LINES(JS_IR): 1 1 2 2 3 3 4 4 * 8 8 8 8 8 11 11 * 7 12 +// LINES(JS): 1 14 8 8 7 3 2 2 3 3 3 8 8 11 11 * 3 7 12 3 3 4 4 +// LINES(JS_IR): 1 1 2 3 3 4 4 * 8 8 8 8 11 11 * 7 12 diff --git a/js/js.translator/testData/lineNumbers/elvis.kt b/js/js.translator/testData/lineNumbers/elvis.kt index 9c8fc7978c0..02b0760620d 100644 --- a/js/js.translator/testData/lineNumbers/elvis.kt +++ b/js/js.translator/testData/lineNumbers/elvis.kt @@ -10,4 +10,4 @@ fun box(x: String?) { fun foo() = "bar" // LINES(JS): 3 8 7 7 4 4 4 5 5 7 7 7 7 * 5 4 5 10 10 10 * 1 * 1 -// LINES(JS_IR): 1 1 1 1 1 1 1 1 * 3 3 4 5 5 * 5 5 * 7 7 7 * 5 4 4 10 10 10 10 * 1 +// LINES(JS_IR): 1 1 1 1 1 1 1 1 * 3 3 4 5 * 5 5 * 7 7 7 * 5 4 4 10 10 10 10 * 1 diff --git a/js/js.translator/testData/lineNumbers/enumCompanionObject.kt b/js/js.translator/testData/lineNumbers/enumCompanionObject.kt index 7e4d2358ef9..4be00727463 100644 --- a/js/js.translator/testData/lineNumbers/enumCompanionObject.kt +++ b/js/js.translator/testData/lineNumbers/enumCompanionObject.kt @@ -7,4 +7,4 @@ enum class Foo { } // LINES(JS): 1 1 1 1 1 1 1 1 1 2 2 4 * 2 2 2 2 4 4 5 5 * 4 4 4 4 4 4 4 * 1 1 1 * 1 1 1 1 1 1 -// LINES(JS_IR): 4 4 * 5 5 5 5 5 * 1 * 1 * 1 1 +// LINES(JS_IR): 4 4 * 5 5 5 5 5 * 1 * 1 1 * 1 1 diff --git a/js/js.translator/testData/lineNumbers/enumObject.kt b/js/js.translator/testData/lineNumbers/enumObject.kt index fefd2a73ca2..e941d3d1cfc 100644 --- a/js/js.translator/testData/lineNumbers/enumObject.kt +++ b/js/js.translator/testData/lineNumbers/enumObject.kt @@ -11,4 +11,4 @@ enum class E { } // LINES(JS): 1 1 1 1 1 1 1 1 1 2 2 4 8 * 2 2 2 2 4 4 4 5 5 5 * 4 4 4 4 8 8 8 9 9 9 * 8 8 8 8 * 1 1 1 * 1 1 1 1 1 1 1 1 1 1 -// LINES(JS_IR): 4 4 * 5 5 5 * 8 8 * 9 9 9 * 1 * 1 * 1 1 +// LINES(JS_IR): 4 4 * 5 5 5 * 8 8 * 9 9 9 * 1 * 1 1 * 1 1 diff --git a/js/js.translator/testData/lineNumbers/for.kt b/js/js.translator/testData/lineNumbers/for.kt index 39653029a2c..e03f9504e78 100644 --- a/js/js.translator/testData/lineNumbers/for.kt +++ b/js/js.translator/testData/lineNumbers/for.kt @@ -18,4 +18,4 @@ fun box() { } // LINES(JS): 1 18 2 2 10 2 2 2 2 2 2 3 3 6 6 6 6 7 7 10 10 10 10 10 10 11 11 14 14 15 15 15 15 16 16 -// LINES(JS_IR): 1 1 * 2 * 35 * 18 * 12 2 18 18 35 35 2 2 2 2 2 2 2 2 2 2 2 2 3 3 6 6 6 6 6 6 6 6 6 7 7 10 10 10 10 10 10 11 11 14 14 15 15 15 15 15 15 15 15 15 15 15 16 16 +// LINES(JS_IR): 1 1 * 2 * 35 * 18 * 12 2 18 18 35 35 2 2 2 2 2 2 2 2 3 3 6 6 6 6 6 6 6 7 7 10 10 10 10 11 11 14 15 15 15 15 15 15 15 15 16 16 diff --git a/js/js.translator/testData/lineNumbers/increment.kt b/js/js.translator/testData/lineNumbers/increment.kt index 113f83ac399..56cc7be61af 100644 --- a/js/js.translator/testData/lineNumbers/increment.kt +++ b/js/js.translator/testData/lineNumbers/increment.kt @@ -8,5 +8,5 @@ fun foo(x: Int) { println(y) } -// LINES(JS): 1 9 2 2 3 3 4 4 5 5 6 6 7 7 8 8 -// LINES(JS_IR): 1 1 2 2 3 3 3 3 4 4 5 5 6 6 7 7 8 8 +// LINES(JS): 1 9 2 2 3 3 4 4 5 5 6 6 7 7 8 8 +// LINES(JS_IR): 1 1 2 3 3 3 4 4 5 5 6 6 7 7 8 8 diff --git a/js/js.translator/testData/lineNumbers/inlineArguments.kt b/js/js.translator/testData/lineNumbers/inlineArguments.kt index 8d3a63efe05..12f58b39983 100644 --- a/js/js.translator/testData/lineNumbers/inlineArguments.kt +++ b/js/js.translator/testData/lineNumbers/inlineArguments.kt @@ -12,4 +12,4 @@ inline fun foo(x: Int) { fun bar() = 23 // LINES(JS): 3 5 4 4 8 8 9 9 7 10 8 8 9 9 12 12 12 * 1 * 1 -// LINES(JS_IR): 1 1 1 1 1 1 1 1 * 3 3 4 * 4 4 8 8 9 9 7 7 8 8 9 9 12 12 12 12 * 1 +// LINES(JS_IR): 1 1 1 1 1 1 1 1 * 3 3 4 * 4 8 8 9 9 7 7 8 8 9 9 12 12 12 12 * 1 diff --git a/js/js.translator/testData/lineNumbers/inlineLocalVarsRef.kt b/js/js.translator/testData/lineNumbers/inlineLocalVarsRef.kt index 9c09fdc3c4f..f2ea4357312 100644 --- a/js/js.translator/testData/lineNumbers/inlineLocalVarsRef.kt +++ b/js/js.translator/testData/lineNumbers/inlineLocalVarsRef.kt @@ -10,4 +10,4 @@ fun bar() { } // LINES(JS): 1 1 1 1 1 6 2 2 3 3 4 4 8 10 2 2 9 2 3 3 4 4 -// LINES(JS_IR): 1 1 2 2 3 3 3 4 4 8 8 9 * 2 2 3 3 3 4 4 +// LINES(JS_IR): 1 1 2 3 3 3 4 4 8 8 9 * 2 3 3 3 4 4 diff --git a/js/js.translator/testData/lineNumbers/inlineReturn.kt b/js/js.translator/testData/lineNumbers/inlineReturn.kt index 931ac9b1fa3..ce6fbbca423 100644 --- a/js/js.translator/testData/lineNumbers/inlineReturn.kt +++ b/js/js.translator/testData/lineNumbers/inlineReturn.kt @@ -22,4 +22,4 @@ fun bar(x: Int) { } // LINES(JS): 1 1 1 1 1 1 1 1 1 17 2 2 3 3 4 7 7 9 9 10 10 11 14 14 16 16 19 22 20 20 20 20 17 2 2 3 3 4 3 7 7 9 9 10 10 11 10 14 14 16 16 20 21 21 -// LINES(JS_IR): 1 1 2 2 2 3 3 4 7 7 9 9 9 10 10 11 14 14 16 16 19 19 * 20 * 20 20 2 2 2 3 3 4 * 7 7 9 9 9 10 10 11 * 14 14 16 16 20 20 21 21 +// LINES(JS_IR): 1 1 2 2 2 3 3 4 7 7 9 9 9 10 10 11 14 14 16 16 19 19 * 20 * 20 2 2 2 3 3 4 * 7 7 9 9 9 10 10 11 * 14 14 16 16 20 20 21 21 diff --git a/js/js.translator/testData/lineNumbers/jsCode.kt b/js/js.translator/testData/lineNumbers/jsCode.kt index 8929544137d..3fac7b4cfd7 100644 --- a/js/js.translator/testData/lineNumbers/jsCode.kt +++ b/js/js.translator/testData/lineNumbers/jsCode.kt @@ -5,5 +5,7 @@ fun foo() { println("after: $x") } +// DONT_TARGET_EXACT_BACKEND: JS_IR +// ^There is a better stepping test + // LINES(JS): 1 6 2 2 3 3 4 4 5 5 -// LINES(JS_IR): 1 1 2 2 3 3 4 4 5 5 diff --git a/js/js.translator/testData/lineNumbers/lambdaWithClosure.kt b/js/js.translator/testData/lineNumbers/lambdaWithClosure.kt index 14e879f99ca..22296430170 100644 --- a/js/js.translator/testData/lineNumbers/lambdaWithClosure.kt +++ b/js/js.translator/testData/lineNumbers/lambdaWithClosure.kt @@ -5,4 +5,4 @@ fun foo(x: Int): () -> Unit = { fun bar() = 23 // LINES(JS): 1 1 1 3 2 2 3 3 1 1 1 5 5 5 -// LINES(JS_IR): 1 1 3 3 1 5 5 5 5 1 1 2 2 3 3 +// LINES(JS_IR): 1 1 3 3 1 5 5 5 5 1 1 1 2 2 3 3 diff --git a/js/js.translator/testData/lineNumbers/lastExpressionInInlineLambda.kt b/js/js.translator/testData/lineNumbers/lastExpressionInInlineLambda.kt index ff9b09ba9de..92d93e497c5 100644 --- a/js/js.translator/testData/lineNumbers/lastExpressionInInlineLambda.kt +++ b/js/js.translator/testData/lineNumbers/lastExpressionInInlineLambda.kt @@ -24,5 +24,5 @@ fun baz() = "baz" fun boo() = "boo" -// LINES(JS): 1 17 9 4 6 6 7 7 3 3 3 * 13 12 13 13 14 19 21 20 20 23 23 23 25 25 25 -// LINES(JS_IR): 1 1 * 2 * 20 * 4 * 6 6 7 * 3 20 20 * 11 * 20 * 12 12 12 13 14 20 20 19 19 20 20 23 23 23 23 25 25 25 25 +// LINES(JS): 1 17 9 4 6 6 7 7 3 3 3 * 13 12 13 13 14 19 21 20 20 23 23 23 25 25 25 +// LINES(JS_IR): 1 1 * 2 * 20 * 4 * 6 7 * 3 20 20 * 11 * 20 * 12 12 13 14 20 20 19 19 20 20 23 23 23 23 25 25 25 25 diff --git a/js/js.translator/testData/lineNumbers/optionalArgs.kt b/js/js.translator/testData/lineNumbers/optionalArgs.kt index a683750e829..37f1957e2fa 100644 --- a/js/js.translator/testData/lineNumbers/optionalArgs.kt +++ b/js/js.translator/testData/lineNumbers/optionalArgs.kt @@ -7,5 +7,5 @@ fun box( println(y) } -// LINES(JS): 1 8 2 2 2 2 3 3 3 4 6 6 7 7 -// LINES(JS_IR): 1 2 4 6 6 7 7 +// LINES(JS): 1 8 2 2 2 2 3 3 3 4 6 6 7 7 +// LINES(JS_IR): 1 2 3 2 4 6 6 7 7 diff --git a/js/js.translator/testData/lineNumbers/syntheticCodeInConstructors.kt b/js/js.translator/testData/lineNumbers/syntheticCodeInConstructors.kt index cae9320f58d..ad4ef730662 100644 --- a/js/js.translator/testData/lineNumbers/syntheticCodeInConstructors.kt +++ b/js/js.translator/testData/lineNumbers/syntheticCodeInConstructors.kt @@ -25,5 +25,5 @@ class C : A { ) } -// LINES(JS): 1 1 3 * 1 1 1 1 1 1 7 * 9 10 11 * 15 15 16 17 14 19 15 15 22 22 23 24 22 22 -// LINES(JS_IR): 1 1 * 3 * 7 7 9 9 10 11 15 16 17 15 19 * 15 * 22 23 24 23 * 22 * 14 +// LINES(JS): 1 1 3 * 1 1 1 1 1 1 7 * 9 10 11 * 15 15 16 17 14 19 15 15 22 22 23 24 22 22 +// LINES(JS_IR): 1 1 * 3 * 7 7 9 9 10 11 15 15 16 17 15 19 * 15 15 * 22 23 24 23 * 22 * 14 diff --git a/js/js.translator/testData/lineNumbers/syntheticCodeInEnums.kt b/js/js.translator/testData/lineNumbers/syntheticCodeInEnums.kt index 9c766f570b3..c2567746ff6 100644 --- a/js/js.translator/testData/lineNumbers/syntheticCodeInEnums.kt +++ b/js/js.translator/testData/lineNumbers/syntheticCodeInEnums.kt @@ -8,5 +8,5 @@ enum class E { } } -// LINES(JS): 1 1 1 1 1 1 1 1 1 2 2 3 3 4 * 2 2 2 2 * 3 3 3 3 4 4 4 6 6 * 4 4 4 4 * 1 1 1 * 1 1 1 1 1 1 1 1 1 1 -// LINES(JS_IR): 4 4 * 6 6 * 1 * 1 * 1 1 +// LINES(JS): 1 1 1 1 1 1 1 1 1 2 2 3 3 4 * 2 2 2 2 * 3 3 3 3 4 4 4 6 6 * 4 4 4 4 * 1 1 1 * 1 1 1 1 1 1 1 1 1 1 +// LINES(JS_IR): 4 4 * 6 6 * 1 * 1 1 * 1 1 diff --git a/js/js.translator/testData/lineNumbers/valParameter.kt b/js/js.translator/testData/lineNumbers/valParameter.kt index aef6f01201f..e978e21cc1a 100644 --- a/js/js.translator/testData/lineNumbers/valParameter.kt +++ b/js/js.translator/testData/lineNumbers/valParameter.kt @@ -7,5 +7,5 @@ fun foo() { A(23, "foo") } -// LINES(JS): 1 2 3 * 6 8 7 7 -// LINES(JS_IR): 1 1 2 2 3 3 2 2 2 3 3 3 6 6 7 7 +// LINES(JS): 1 2 3 * 6 8 7 7 +// LINES(JS_IR): 1 2 3 1 2 2 3 3 2 2 2 3 3 3 6 6 7 7 diff --git a/js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditions.kt b/js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditions.kt index 30b41dff00a..35ecb04dda6 100644 --- a/js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditions.kt +++ b/js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditions.kt @@ -18,5 +18,5 @@ fun box(x: Int) { ) } -// LINES(JS): 1 19 4 4 3 3 4 6 9 9 6 11 13 13 11 16 16 3 2 -// LINES(JS_IR): 1 1 4 4 2 8 7 6 7 8 9 12 11 12 13 16 +// LINES(JS): 1 19 4 4 3 3 4 6 9 9 6 11 13 13 11 16 16 3 2 +// LINES(JS_IR): 1 1 4 2 8 7 6 7 8 9 12 11 12 13 16 diff --git a/js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditionsNonOptimized.kt b/js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditionsNonOptimized.kt index be8e9faa4d7..e5bc4e4773a 100644 --- a/js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditionsNonOptimized.kt +++ b/js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditionsNonOptimized.kt @@ -28,5 +28,5 @@ fun four() = 4 fun five() = 5 -// LINES(JS): 1 19 4 4 3 6 4 6 4 7 4 8 9 9 11 4 11 4 12 13 13 16 16 2 21 21 21 23 23 23 25 25 25 27 27 27 29 29 29 -// LINES(JS_IR): 1 1 4 4 2 8 7 6 7 8 9 12 11 12 13 16 21 21 21 21 23 23 23 23 25 25 25 25 27 27 27 27 29 29 29 29 +// LINES(JS): 1 19 4 4 3 6 4 6 4 7 4 8 9 9 11 4 11 4 12 13 13 16 16 2 21 21 21 23 23 23 25 25 25 27 27 27 29 29 29 +// LINES(JS_IR): 1 1 4 2 8 7 6 7 8 9 12 11 12 13 16 21 21 21 21 23 23 23 23 25 25 25 25 27 27 27 27 29 29 29 29 diff --git a/js/js.translator/testData/lineNumbers/whenIn.kt b/js/js.translator/testData/lineNumbers/whenIn.kt index e84e95e32c7..6ec1e64f0da 100644 --- a/js/js.translator/testData/lineNumbers/whenIn.kt +++ b/js/js.translator/testData/lineNumbers/whenIn.kt @@ -13,5 +13,5 @@ fun foo(): Int = 23 fun bar(): IntRange = 1000..2000 -// LINES(JS): 1 10 2 2 2 2 3 3 4 4 5 5 6 6 7 7 8 8 12 12 12 14 14 14 -// LINES(JS_IR): 1 1 2 2 3 3 4 4 5 5 6 6 7 7 7 7 7 7 8 8 12 12 12 12 14 14 14 14 +// LINES(JS): 1 10 2 2 2 2 3 3 4 4 5 5 6 6 7 7 8 8 12 12 12 14 14 14 +// LINES(JS_IR): 1 1 2 3 3 4 4 5 5 6 6 7 7 7 7 8 8 12 12 12 12 14 14 14 14 diff --git a/js/js.translator/testData/lineNumbers/whenIs.kt b/js/js.translator/testData/lineNumbers/whenIs.kt index baefb5cd254..d4945ca8377 100644 --- a/js/js.translator/testData/lineNumbers/whenIs.kt +++ b/js/js.translator/testData/lineNumbers/whenIs.kt @@ -14,4 +14,4 @@ open class A open class B : A() // LINES(JS): 1 10 2 2 2 2 3 3 4 4 5 5 6 6 8 8 12 * 14 14 -// LINES(JS_IR): 1 1 2 2 3 3 4 4 5 5 6 6 8 8 12 12 14 14 14 +// LINES(JS_IR): 1 1 2 3 3 4 4 5 5 6 6 8 8 12 12 14 14 14 diff --git a/js/js.translator/testData/lineNumbers/whileWithComplexCondition.kt b/js/js.translator/testData/lineNumbers/whileWithComplexCondition.kt index 232fab9997a..b9ebdaa980b 100644 --- a/js/js.translator/testData/lineNumbers/whileWithComplexCondition.kt +++ b/js/js.translator/testData/lineNumbers/whileWithComplexCondition.kt @@ -12,5 +12,5 @@ fun box() { } } -// LINES(JS): 1 13 5 5 4 2 2 3 5 5 8 8 * 3 4 9 3 11 11 -// LINES(JS_IR): 1 1 2 2 * 3 * 5 5 5 5 5 8 8 * 4 9 * 11 11 +// LINES(JS): 1 13 5 5 4 2 2 3 5 5 8 8 * 3 4 9 3 11 11 +// LINES(JS_IR): 1 1 2 * 3 * 5 5 5 5 8 8 * 4 9 * 11 11