[JS IR] Enable line number tests for JS IR

This commit is contained in:
Sergej Jaskiewicz
2022-03-03 13:40:46 +03:00
committed by Space
parent dc9652e9ce
commit e0dcb0975a
56 changed files with 549 additions and 73 deletions
+1 -1
View File
@@ -28,7 +28,7 @@
<entry key="$PROJECT_DIR$/js/js.translator/testData/lineNumbers">
<value>
<array>
<option value="$PROJECT_DIR$/js/js.tests/build/out/lineNumbers/$TEST_DATA_FILE${-lib,}_v5{.js,.js.map,-lines.js}" />
<option value="$PROJECT_DIR$/js/js.tests/build/{out,out-min,out-per-module,out-per-module-min}/{lineNumbers,irLineNumbers}/$TEST_DATA_FILE${-lib,}_v5-lines.js" />
</array>
</value>
</entry>
@@ -117,6 +117,10 @@ fun main(args: Array<String>) {
testClass<AbstractIrJsTypeScriptExportTest> {
model("typescript-export/", pattern = "^([^_](.+))\\.kt$")
}
testClass<AbstractJsIrLineNumberTest> {
model("lineNumbers/")
}
}
testGroup("js/js.tests/tests-gen", "compiler/testData", testRunnerMethodName = "runTest0") {
@@ -5,7 +5,10 @@
package org.jetbrains.kotlin.js.test.handlers
import org.jetbrains.kotlin.ir.backend.js.CompilationOutputs
import org.jetbrains.kotlin.ir.backend.js.transformers.irToJs.TranslationMode
import org.jetbrains.kotlin.ir.backend.js.transformers.irToJs.safeModuleName
import org.jetbrains.kotlin.js.backend.ast.JsProgram
import org.jetbrains.kotlin.js.facade.TranslationResult
import org.jetbrains.kotlin.js.test.utils.LineCollector
import org.jetbrains.kotlin.js.test.utils.LineOutputToStringVisitor
@@ -16,50 +19,100 @@ import org.jetbrains.kotlin.test.model.TestModule
import org.jetbrains.kotlin.test.services.TestServices
import org.jetbrains.kotlin.test.services.assertions
import org.jetbrains.kotlin.test.services.configuration.JsEnvironmentConfigurator
import org.jetbrains.kotlin.test.services.moduleStructure
import org.jetbrains.kotlin.utils.addToStdlib.cast
import java.io.File
/**
* Verifies the `// LINE` comments in lineNumber tests.
*
* The test file is expected to contain the `// LINE(backend)` directive, followed by the line numbers that the corresponding JS statements
* are generated from.
*
* This handler traverses the JS AST and collects the actual line numbers using [LineCollector], and generates a JavaScript file
* with those line numbers printed as comments for ease of debugging these tests.
*/
class JsLineNumberHandler(testServices: TestServices) : JsBinaryArtifactHandler(testServices) {
companion object {
private val LINES_PATTERN = Regex("^ *// *LINES: *(.*)$", RegexOption.MULTILINE)
}
private val defaultTranslationMode = TranslationMode.PER_MODULE
private val translationModeForIr = TranslationMode.PER_MODULE
override fun processAfterAllModules(someAssertionWasFailed: Boolean) {}
override fun processModule(module: TestModule, info: BinaryArtifacts.Js) {
val translationResult = when (val artifact = info.unwrap()) {
is BinaryArtifacts.Js.OldJsArtifact -> artifact.translationResult as TranslationResult.Success
// TODO: Support JS IR
// is BinaryArtifacts.Js.JsIrArtifact -> artifact.compilerResult.outputs[defaultTranslationMode]!!.jsProgram!!
when (val artifact = info.unwrap()) {
is BinaryArtifacts.Js.OldJsArtifact ->
verifyModule(module, TranslationMode.FULL, artifact.translationResult.cast<TranslationResult.Success>().program, "JS")
is BinaryArtifacts.Js.JsIrArtifact -> {
val testModules = testServices.moduleStructure.modules
val moduleId2TestModule = testModules.associateBy { it.name.safeModuleName }
var verifiedModuleCount = 0
fun verifyModulesRecursively(
module: TestModule,
compilationOutputs: CompilationOutputs,
) {
for ((moduleId, dependencyOutputs) in compilationOutputs.dependencies) {
moduleId2TestModule[moduleId]?.let {
verifyModulesRecursively(it, dependencyOutputs)
}
}
verifyModule(module, translationModeForIr, compilationOutputs.jsProgram!!, "JS_IR")
verifiedModuleCount += 1
}
verifyModulesRecursively(module, artifact.compilerResult.outputs[translationModeForIr]!!)
// Just a sanity check to make sure we indeed verify all the needed modules.
assert(verifiedModuleCount == testModules.size) {
"The number of verified modules ($verifiedModuleCount) must match " +
"the number of all the test modules (${testModules.size})"
}
}
else -> error("This artifact is not supported")
}
}
val jsProgram = translationResult.program
val baseOutputPath = JsEnvironmentConfigurator.getJsModuleArtifactPath(testServices, module.name, defaultTranslationMode)
private fun verifyModule(
module: TestModule,
translationMode: TranslationMode,
jsProgram: JsProgram,
backendPattern: String
) {
val baseOutputPath = JsEnvironmentConfigurator.getJsModuleArtifactPath(testServices, module.name, translationMode)
val lineCollector = LineCollector()
lineCollector.accept(jsProgram)
val programOutput = TextOutputImpl()
jsProgram.globalBlock.accept(LineOutputToStringVisitor(programOutput, lineCollector))
val generatedCode = programOutput.toString()
val generatedCode = kotlin.run {
val programOutput = TextOutputImpl()
jsProgram.globalBlock.accept(LineOutputToStringVisitor(programOutput, lineCollector))
programOutput.toString()
}
with(File("$baseOutputPath-lines.js")) {
parentFile.mkdirs()
writeText(generatedCode)
}
val linesMatcher = module.files
.firstNotNullOfOrNull { LINES_PATTERN.find(it.originalContent) }
?: error("'// LINES: ' comment was not found in source file. Generated code is:\n$generatedCode")
val linesPattern = Regex("^ *// *LINES\\($backendPattern\\): *(.*)$", RegexOption.MULTILINE)
val linesMatcher = module.files
.firstNotNullOfOrNull { linesPattern.find(it.originalContent) }
?: testServices.assertions.fail {
"'// LINES($backendPattern): ' comment was not found in source file. Generated code is:\n$generatedCode"
}
fun List<Int?>.render() = joinToString(" ") { it?.toString() ?: "*" }
val expectedLines =
linesMatcher.groups[1]!!.value.split(Regex("\\s+")).map { if (it == "*") null else it.toInt() }.render()
val expectedLines = linesMatcher.groups[1]!!.value
val actualLines = lineCollector.lines
.dropLastWhile { it == null }
.joinToString(" ") { if (it == null) "*" else (it + 1).toString() }
.map { lineNumber -> lineNumber?.let { it + 1 } }
.render()
testServices.assertions.assertEquals(expectedLines, actualLines) { generatedCode }
}
@@ -110,6 +110,26 @@ open class AbstractIrJsTypeScriptExportTest : AbstractJsIrTest(
}
}
open class AbstractJsIrLineNumberTest : AbstractJsIrTest(
pathToTestDir = "${JsEnvironmentConfigurator.TEST_DATA_DIR_PATH}/lineNumbers/",
testGroupOutputDirPrefix = "irLineNumbers/"
) {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
with(builder) {
defaultDirectives {
+JsEnvironmentConfigurationDirectives.KJS_WITH_FULL_RUNTIME
+JsEnvironmentConfigurationDirectives.NO_COMMON_FILES
-JsEnvironmentConfigurationDirectives.GENERATE_NODE_JS_RUNNER
JsEnvironmentConfigurationDirectives.DONT_RUN_GENERATED_CODE.with(listOf("JS", "JS_IR", "JS_IR_ES6"))
}
configureJsArtifactsHandlersStep {
useHandlers(::JsLineNumberHandler)
}
}
}
}
open class AbstractIrCodegenWasmJsInteropJsTest : AbstractJsIrTest(
pathToTestDir = "compiler/testData/codegen/wasmJsInterop",
testGroupOutputDirPrefix = "codegen/wasmJsInteropJs"
@@ -0,0 +1,343 @@
/*
* Copyright 2010-2021 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 GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("js/js.translator/testData/lineNumbers")
@TestDataPath("$PROJECT_ROOT")
public class JsIrLineNumberTestGenerated extends AbstractJsIrLineNumberTest {
@Test
public void testAllFilesPresentInLineNumbers() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/lineNumbers"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@Test
@TestMetadata("andAndWithSideEffect.kt")
public void testAndAndWithSideEffect() throws Exception {
runTest("js/js.translator/testData/lineNumbers/andAndWithSideEffect.kt");
}
@Test
@TestMetadata("backingField.kt")
public void testBackingField() throws Exception {
runTest("js/js.translator/testData/lineNumbers/backingField.kt");
}
@Test
@TestMetadata("catch.kt")
public void testCatch() throws Exception {
runTest("js/js.translator/testData/lineNumbers/catch.kt");
}
@Test
@TestMetadata("chainedCall.kt")
public void testChainedCall() throws Exception {
runTest("js/js.translator/testData/lineNumbers/chainedCall.kt");
}
@Test
@TestMetadata("classCapturingLocals.kt")
public void testClassCapturingLocals() throws Exception {
runTest("js/js.translator/testData/lineNumbers/classCapturingLocals.kt");
}
@Test
@TestMetadata("closure.kt")
public void testClosure() throws Exception {
runTest("js/js.translator/testData/lineNumbers/closure.kt");
}
@Test
@TestMetadata("complexExpressionAsDefaultArgument.kt")
public void testComplexExpressionAsDefaultArgument() throws Exception {
runTest("js/js.translator/testData/lineNumbers/complexExpressionAsDefaultArgument.kt");
}
@Test
@TestMetadata("conditionalDecomposed.kt")
public void testConditionalDecomposed() throws Exception {
runTest("js/js.translator/testData/lineNumbers/conditionalDecomposed.kt");
}
@Test
@TestMetadata("coroutine.kt")
public void testCoroutine() throws Exception {
runTest("js/js.translator/testData/lineNumbers/coroutine.kt");
}
@Test
@TestMetadata("coroutineNullAssertion.kt")
public void testCoroutineNullAssertion() throws Exception {
runTest("js/js.translator/testData/lineNumbers/coroutineNullAssertion.kt");
}
@Test
@TestMetadata("dataClass.kt")
public void testDataClass() throws Exception {
runTest("js/js.translator/testData/lineNumbers/dataClass.kt");
}
@Test
@TestMetadata("delegateMemberVal.kt")
public void testDelegateMemberVal() throws Exception {
runTest("js/js.translator/testData/lineNumbers/delegateMemberVal.kt");
}
@Test
@TestMetadata("delegatedProperty.kt")
public void testDelegatedProperty() throws Exception {
runTest("js/js.translator/testData/lineNumbers/delegatedProperty.kt");
}
@Test
@TestMetadata("delegation.kt")
public void testDelegation() throws Exception {
runTest("js/js.translator/testData/lineNumbers/delegation.kt");
}
@Test
@TestMetadata("destructuring.kt")
public void testDestructuring() throws Exception {
runTest("js/js.translator/testData/lineNumbers/destructuring.kt");
}
@Test
@TestMetadata("destructuringInline.kt")
public void testDestructuringInline() throws Exception {
runTest("js/js.translator/testData/lineNumbers/destructuringInline.kt");
}
@Test
@TestMetadata("doWhileWithComplexCondition.kt")
public void testDoWhileWithComplexCondition() throws Exception {
runTest("js/js.translator/testData/lineNumbers/doWhileWithComplexCondition.kt");
}
@Test
@TestMetadata("elvis.kt")
public void testElvis() throws Exception {
runTest("js/js.translator/testData/lineNumbers/elvis.kt");
}
@Test
@TestMetadata("enumCompanionObject.kt")
public void testEnumCompanionObject() throws Exception {
runTest("js/js.translator/testData/lineNumbers/enumCompanionObject.kt");
}
@Test
@TestMetadata("enumObject.kt")
public void testEnumObject() throws Exception {
runTest("js/js.translator/testData/lineNumbers/enumObject.kt");
}
@Test
@TestMetadata("expressionAsFunctionBody.kt")
public void testExpressionAsFunctionBody() throws Exception {
runTest("js/js.translator/testData/lineNumbers/expressionAsFunctionBody.kt");
}
@Test
@TestMetadata("for.kt")
public void testFor() throws Exception {
runTest("js/js.translator/testData/lineNumbers/for.kt");
}
@Test
@TestMetadata("increment.kt")
public void testIncrement() throws Exception {
runTest("js/js.translator/testData/lineNumbers/increment.kt");
}
@Test
@TestMetadata("inlineArguments.kt")
public void testInlineArguments() throws Exception {
runTest("js/js.translator/testData/lineNumbers/inlineArguments.kt");
}
@Test
@TestMetadata("inlineLocalVarsRef.kt")
public void testInlineLocalVarsRef() throws Exception {
runTest("js/js.translator/testData/lineNumbers/inlineLocalVarsRef.kt");
}
@Test
@TestMetadata("inlineReturn.kt")
public void testInlineReturn() throws Exception {
runTest("js/js.translator/testData/lineNumbers/inlineReturn.kt");
}
@Test
@TestMetadata("inlining.kt")
public void testInlining() throws Exception {
runTest("js/js.translator/testData/lineNumbers/inlining.kt");
}
@Test
@TestMetadata("inliningWithLambda.kt")
public void testInliningWithLambda() throws Exception {
runTest("js/js.translator/testData/lineNumbers/inliningWithLambda.kt");
}
@Test
@TestMetadata("innerClass.kt")
public void testInnerClass() throws Exception {
runTest("js/js.translator/testData/lineNumbers/innerClass.kt");
}
@Test
@TestMetadata("isOperator.kt")
public void testIsOperator() throws Exception {
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 {
runTest("js/js.translator/testData/lineNumbers/lambdaWithClosure.kt");
}
@Test
@TestMetadata("lastExpressionInInlineLambda.kt")
public void testLastExpressionInInlineLambda() throws Exception {
runTest("js/js.translator/testData/lineNumbers/lastExpressionInInlineLambda.kt");
}
@Test
@TestMetadata("literals.kt")
public void testLiterals() throws Exception {
runTest("js/js.translator/testData/lineNumbers/literals.kt");
}
@Test
@TestMetadata("longLiteral.kt")
public void testLongLiteral() throws Exception {
runTest("js/js.translator/testData/lineNumbers/longLiteral.kt");
}
@Test
@TestMetadata("memberFunWithDefaultParam.kt")
public void testMemberFunWithDefaultParam() throws Exception {
runTest("js/js.translator/testData/lineNumbers/memberFunWithDefaultParam.kt");
}
@Test
@TestMetadata("multipleReferences.kt")
public void testMultipleReferences() throws Exception {
runTest("js/js.translator/testData/lineNumbers/multipleReferences.kt");
}
@Test
@TestMetadata("objectInstanceFunction.kt")
public void testObjectInstanceFunction() throws Exception {
runTest("js/js.translator/testData/lineNumbers/objectInstanceFunction.kt");
}
@Test
@TestMetadata("optionalArgs.kt")
public void testOptionalArgs() throws Exception {
runTest("js/js.translator/testData/lineNumbers/optionalArgs.kt");
}
@Test
@TestMetadata("propertyWithoutInitializer.kt")
public void testPropertyWithoutInitializer() throws Exception {
runTest("js/js.translator/testData/lineNumbers/propertyWithoutInitializer.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("js/js.translator/testData/lineNumbers/simple.kt");
}
@Test
@TestMetadata("stringLiteral.kt")
public void testStringLiteral() throws Exception {
runTest("js/js.translator/testData/lineNumbers/stringLiteral.kt");
}
@Test
@TestMetadata("syntheticCodeInConstructors.kt")
public void testSyntheticCodeInConstructors() throws Exception {
runTest("js/js.translator/testData/lineNumbers/syntheticCodeInConstructors.kt");
}
@Test
@TestMetadata("syntheticCodeInEnums.kt")
public void testSyntheticCodeInEnums() throws Exception {
runTest("js/js.translator/testData/lineNumbers/syntheticCodeInEnums.kt");
}
@Test
@TestMetadata("valParameter.kt")
public void testValParameter() throws Exception {
runTest("js/js.translator/testData/lineNumbers/valParameter.kt");
}
@Test
@TestMetadata("whenEntryWithMultipleConditions.kt")
public void testWhenEntryWithMultipleConditions() throws Exception {
runTest("js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditions.kt");
}
@Test
@TestMetadata("whenEntryWithMultipleConditionsNonOptimized.kt")
public void testWhenEntryWithMultipleConditionsNonOptimized() throws Exception {
runTest("js/js.translator/testData/lineNumbers/whenEntryWithMultipleConditionsNonOptimized.kt");
}
@Test
@TestMetadata("whenIn.kt")
public void testWhenIn() throws Exception {
runTest("js/js.translator/testData/lineNumbers/whenIn.kt");
}
@Test
@TestMetadata("whenIs.kt")
public void testWhenIs() throws Exception {
runTest("js/js.translator/testData/lineNumbers/whenIs.kt");
}
@Test
@TestMetadata("whileWithComplexCondition.kt")
public void testWhileWithComplexCondition() throws Exception {
runTest("js/js.translator/testData/lineNumbers/whileWithComplexCondition.kt");
}
@Nested
@TestMetadata("js/js.translator/testData/lineNumbers/inlineMultiModule")
@TestDataPath("$PROJECT_ROOT")
public class InlineMultiModule {
@Test
public void testAllFilesPresentInInlineMultiModule() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/lineNumbers/inlineMultiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("js/js.translator/testData/lineNumbers/inlineMultiModule/simple.kt");
}
}
}
@@ -6,4 +6,5 @@ fun box(x: Int, y: Int) {
fun foo(x: Int) = x
// LINES: 1 5 3 3 4 3 3 3 3 * 3 3 4 4 4 4 * 4 4 4 4 2 3 7 7 7
// LINES(JS): 1 5 3 3 4 3 3 3 3 * 3 3 4 4 4 4 * 4 4 4 4 2 3 7 7 7
// LINES(JS_IR): 3 3 3 * 3 * 4 4 4 * 4 4 2 * 7 7
+2 -1
View File
@@ -12,4 +12,5 @@ open class A {
}
}
// LINES: 1 2 2 4 4 2 2 2 2 5 5 5 6 7 12 8 9 10 11
// LINES(JS): 1 2 2 4 4 2 2 2 2 5 5 5 6 7 12 8 9 10 11
// LINES(JS_IR): 2 2 4 4 * 2 2 * 2 2 * 8 9 10 10 11 * 6 6 5 6
+2 -1
View File
@@ -19,4 +19,5 @@ fun bar() {
}
}
// LINES: 1 11 3 3 5 5 6 6 8 8 9 9 2 2 * 13 20 15 15 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): 3 3 * 6 6 * 9 9 * 15 15 18 18
+2 -1
View File
@@ -14,4 +14,5 @@ class C {
val baz: dynamic get() = null
}
// LINES: 1 9 2 4 3 2 6 8 7 6 11 12 12 12 14 14 14
// LINES(JS): 1 9 2 4 3 2 6 8 7 6 11 12 12 12 14 14 14
// LINES(JS_IR): 2 4 3 2 6 8 7 6 * 12 12 * 14 14
@@ -14,4 +14,5 @@ fun A.foo() {
fun baz() = 23
// LINES: 1 * 5 5 5 6 9 7 7 8 8 * 3 13 4 4 11 11 12 12 15 15 15
// 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): 4 4 11 11 12 12 * 15 15 * 7 7 8 8
+2 -1
View File
@@ -5,4 +5,5 @@ fun box(x: Int, y: Int): Int {
return foo(y)
}
// LINES: 2 2 2 4 4 1 6 2 2 5 5
// LINES(JS): 2 2 2 4 4 1 6 2 2 5 5
// LINES(JS_IR): 5 5 * 4 4
@@ -11,4 +11,5 @@ fun baz() = 1
fun bar() = 2
// LINES: 1 3 3 2 2 4 3 4 4 4 5 5 2 8 8 10 10 10 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): 8 8 * 1 3 3 1 4 5 1 1 * 10 10 * 12 12
@@ -14,4 +14,5 @@ private inline fun foo(): Int {
return 23
}
// LINES: 1 10 3 3 3 4 3 6 13 13 3 14 2 12 15 13 13 14 14
// LINES(JS): 1 10 3 3 3 4 3 6 13 13 3 14 2 12 15 13 13 14 14
// LINES(JS_IR): 4 6 * 13 13 14 14 8 2 * 13 13 14 14
+2 -1
View File
@@ -14,4 +14,5 @@ suspend fun bar(): Unit {
println(a + b)
}
// LINES: 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): 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): 19 19 * 50 50 93 93 3 45 45 3 45 6 6 19 * 9 9 9 9 9 9 9 9 * 9 9 * 10 10 * 11 * 11 12 12 * 13 * 13 13 14 14
@@ -8,4 +8,5 @@ suspend fun foo() {
suspend fun delay() {
}
// LINES: 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): 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 1 1 1 1 1 1 * 1 1 * 2 * 3 3 3 * 5 5
+4 -1
View File
@@ -3,4 +3,7 @@ data class A(
val y: String
)
// LINES: 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): 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
// FIXME: componentN function body should point to the corresponding property.
// LINES(JS_IR): 2 2 3 3 * 2 2 * 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
+2 -1
View File
@@ -13,4 +13,5 @@ class Delegate(val f: () -> Int) {
}
}
// LINES: 1 2 3 * 2 2 3 3 3 3 * 6 8 7 7 10 10 11 13 12 12
// 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 3 * 3 3 2 1 2 * 7 7 * 10 10 * 10 10 * 12 12 * 2
+2 -1
View File
@@ -15,4 +15,5 @@ class B {
}
}
// LINES: 3 4 5 * 4 4 4 * 8 9 11 10 10 13 15 14 14
// LINES(JS): 3 4 5 * 4 4 4 * 8 9 11 10 10 13 15 14 14
// LINES(JS_IR): 5 5 * 5 5 4 1 4 5 * 5 5 4 1 4 * 10 10 * 14 14 * 4 * 4
+2 -1
View File
@@ -18,4 +18,5 @@ val o = object : I {
}
}
// LINES: 1 2 3 2 2 2 2 2 2 2 * 11 12 12 12 15 15 15 16 18 17 17
// LINES(JS): 1 2 3 2 2 2 2 2 2 2 * 11 12 12 12 15 15 15 16 18 17 17
// LINES(JS_IR): 11 11 * 3 3 * 1 1 * 1 1 * 1 1 * 12 12 * 17 17 * 15 15 * 11
+2 -1
View File
@@ -27,4 +27,5 @@ fun bar(f: (Pair<String, String>) -> Unit) {
}
// LINES: 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): 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 * 9 9 9 9 9 6 6 9 7 7 9 11 11 12 12 15 15 * 26 26 * 17 17 16 18 18 16 20 20 21 21 * 1
@@ -32,4 +32,5 @@ inline operator fun P.component1() = a
inline operator fun P.component2() = b
// LINES: 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): 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 * 9 9 9 9 9 * 31 31 9 6 6 * 33 33 9 7 7 11 11 12 12 15 15 * 26 26 * 29 29 29 29 * 29 29 * 29 29 * 31 31 * 33 33 * 31 31 16 17 17 * 33 33 16 18 18 20 20 21 21 * 1
@@ -13,4 +13,5 @@ fun box() {
)
}
// LINES: 1 14 8 8 7 3 2 2 3 3 3 8 8 11 11 * 3 7 12 3 3 4 4
// 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): 2 2 4 4 * 8 8 8 8 8 11 11 * 7 12
+2 -1
View File
@@ -9,4 +9,5 @@ fun box(x: String?) {
fun foo() = "bar"
// LINES: 3 8 7 7 4 4 4 5 5 7 7 7 7 * 5 4 5 10 10 10 * 1 * 1
// 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 * 4 5 5 * 5 * 7 7 7 * 5 4 4 * 10 10 * 1
@@ -6,4 +6,5 @@ enum class Foo {
}
}
// LINES: 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): 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): 5 5 * 5 5
+2 -1
View File
@@ -10,4 +10,5 @@ enum class E {
}
}
// LINES: 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): 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): 5 5 * 9 9
@@ -4,4 +4,5 @@ fun box() =
fun foo() =
23
// LINES: 1 2 2 4 5 5
// LINES(JS): 1 2 2 4 5 5
// LINES(JS_IR): 2 2 * 5 5
+2 -1
View File
@@ -17,4 +17,5 @@ fun box() {
}
}
// LINES: 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): 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): 12 2 18 18 35 35 2 2 2 2 2 2 2 2 2 2 2 3 3 6 6 6 6 6 6 6 7 7 6 10 10 10 10 10 11 11 14 14 15 15 15 15 15 15 15 15 15 16 16 15
+2 -1
View File
@@ -8,4 +8,5 @@ fun foo(x: Int) {
println(y)
}
// LINES: 1 9 2 2 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): 2 2 3 3 3 3 4 4 5 5 6 6 7 7 8 8
+2 -1
View File
@@ -11,4 +11,5 @@ inline fun foo(x: Int) {
fun bar() = 23
// LINES: 3 5 4 4 8 8 9 9 7 10 8 8 9 9 12 12 12 * 1 * 1
// 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 * 4 4 8 8 9 9 * 8 8 9 9 * 12 12 * 1
@@ -9,4 +9,5 @@ fun bar() {
foo(42)
}
// LINES: 1 1 1 1 1 6 2 2 3 3 4 4 8 10 2 2 9 2 3 3 4 4
// 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): 2 2 3 4 4 * 2 2 3 4 4
@@ -8,7 +8,8 @@ inline fun foo(x: String) {
println("foo2($x);")
}
// LINES: 6 6 6 6 6 9 7 7 8 8
// LINES(JS): 6 6 6 6 6 9 7 7 8 8
// LINES(JS_IR): 7 7 8 8
// MODULE: main(lib)
// FILE: main.kt
@@ -21,4 +22,5 @@ fun box() {
foo("42")
}
// LINES: 6 19 22 7 7 20 7 8 8 20 8 7 7 21 7 8 8 21 8
// LINES(JS): 6 20 23 7 7 21 7 8 8 21 8 7 7 22 7 8 8 22 8
// LINES(JS_IR): 7 7 8 8 7 7 8 8
+2 -1
View File
@@ -21,4 +21,5 @@ fun bar(x: Int) {
println("%")
}
// LINES: 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): 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): 2 3 3 4 7 7 9 10 10 11 14 14 16 16 * 20 20 2 3 3 4 * 7 7 9 10 10 11 * 14 14 16 16 20 20 21 21
+2 -1
View File
@@ -11,4 +11,5 @@ inline fun bar() {
println("bar2")
}
// LINES: 1 7 2 2 10 10 11 11 4 4 10 10 11 11 6 6 9 9 9 9 9 12 10 10 11 11
// LINES(JS): 1 7 2 2 10 10 11 11 4 4 10 10 11 11 6 6 9 9 9 9 9 12 10 10 11 11
// LINES(JS_IR): 2 2 10 10 11 11 4 4 10 10 11 11 6 6 * 10 10 11 11
@@ -16,4 +16,5 @@ inline fun foo(f: () -> Unit) {
println("after")
}
// LINES: 1 11 2 2 14 14 4 4 16 16 6 6 14 14 8 8 16 16 10 10 13 13 13 13 13 17 14 14 15 15 16 16
// LINES(JS): 1 11 2 2 14 14 4 4 16 16 6 6 14 14 8 8 16 16 10 10 13 13 13 13 13 17 14 14 15 15 16 16
// LINES(JS_IR): 2 2 14 14 4 4 16 16 6 6 14 14 8 8 16 16 10 10 * 14 14 15 15 16 16
+2 -1
View File
@@ -6,4 +6,5 @@ class A(val x: Int) {
}
}
// LINES: 1 1 2 2 3 5 4 4
// LINES(JS): 1 1 2 2 3 5 4 4
// LINES(JS_IR): 2 2 * 4 4 * 1 1 * 1 1
+2 -1
View File
@@ -11,4 +11,5 @@ inline fun foo(): Boolean {
return true
}
// LINES: 3 7 4 4 4 10 10 4 11 4 5 5 9 12 10 10 11 11 * 1 * 1
// LINES(JS): 3 7 4 4 4 10 10 4 11 4 5 5 9 12 10 10 11 11 * 1 * 1
// LINES(JS_IR): 1 1 * 1 1 * 4 * 10 10 11 11 4 4 * 5 5 * 10 10 11 11 * 1
+4 -1
View File
@@ -5,4 +5,7 @@ fun foo() {
println("after: $x")
}
// LINES: 1 6 2 2 3 3 4 4 5 5
// LINES(JS): 1 6 2 2 3 3 4 4 5 5
// LINES(JS_IR): 2 2 3 3 2 2 5 5
// FIXME: ^^^^^^^
// js function call debug info is incorrect
+2 -1
View File
@@ -4,4 +4,5 @@ fun foo(x: Int): () -> Unit = {
fun bar() = 23
// LINES: 1 1 1 3 2 2 3 3 1 1 1 5 5 5
// LINES(JS): 1 1 1 3 2 2 3 3 1 1 1 5 5 5
// LINES(JS_IR): 3 3 1 * 5 5 * 2 2
@@ -24,4 +24,5 @@ fun baz() = "baz"
fun boo() = "boo"
// LINES: 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): 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): 4 * 7 * 3 20 20 * 12 12 12 13 14 20 20 * 20 20 * 23 23 * 25 25
+2 -1
View File
@@ -26,4 +26,5 @@ fun bar(vararg x: Any?) {
println(x)
}
// LINES: 1 2 22 3 4 5 6 7 8 9 10 13 14 15 16 17 18 19 20 * 25 27 26 26
// LINES(JS): 1 2 22 3 4 5 6 7 8 9 10 13 14 15 16 17 18 19 20 * 25 27 26 26
// LINES(JS_IR): 3 4 5 6 7 8 9 10 13 14 15 16 17 18 19 20 * 26 26
+2 -1
View File
@@ -5,4 +5,5 @@ fun foo() {
0L)
}
// LINES: 3 * 5 1 6 2 4
// LINES(JS): 3 * 5 1 6 2 4
// LINES(JS_IR): 2 4
@@ -10,4 +10,5 @@ class B : A() {
}
}
// LINES: 1 2 2 2 2 2 2 2 2 2 4 4 4 * 7 7 8 10 9 9
// LINES(JS): 1 2 2 2 2 2 2 2 2 2 4 4 4 * 7 7 8 10 9 9
// LINES(JS_IR): 2 2 * 2 2 2 2 2 * 4 4 * 7 * 9 9
@@ -12,4 +12,5 @@ object O {
val y = 23
}
// LINES: 1 9 2 2 3 3 4 4 6 6 7 7 8 8 11 11 12 12 * 11 11 11 11 11 11
// LINES(JS): 1 9 2 2 3 3 4 4 6 6 7 7 8 8 11 11 12 12 * 11 11 11 11 11 11
// LINES(JS_IR): 2 2 3 3 4 4 6 6 7 7 8 8 * 12 12 * 12 12
@@ -4,4 +4,5 @@ fun foo() {
println("foo")
}
// LINES: 1 1 * 1 1 1 1 1 1 3 5 4 4
// LINES(JS): 1 1 * 1 1 1 1 1 1 3 5 4 4
// LINES(JS_IR): 4 4
+2 -1
View File
@@ -7,4 +7,5 @@ fun box(
println(y)
}
// LINES: 1 8 2 2 2 2 3 3 3 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 1 2 1 4 1 * 6 6 7 7 * 1 1 2 1 1 4 1 1
@@ -9,4 +9,5 @@ open class A {
}
}
// LINES: 1 2 4 7 7 8 8 4 4 4
// LINES(JS): 1 2 4 7 7 8 8 4 4 4
// LINES(JS_IR): 7 7 8 8 * 2 2 * 4 4
+2 -1
View File
@@ -3,4 +3,5 @@ fun box() {
println("bar")
}
// LINES: 1 4 2 2 3 3
// LINES(JS): 1 4 2 2 3 3
// LINES(JS_IR): 2 2 3 3
+2 -1
View File
@@ -4,4 +4,5 @@ fun box(x: Int): String {
"suffix"
}
// LINES: 1 5 2 2 3 4
// LINES(JS): 1 5 2 2 3 4
// LINES(JS_IR): 2 2 3 4
@@ -25,4 +25,5 @@ class C : A {
)
}
// LINES: 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): 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): 3 * 10 11 * 16 17 15 19 * 23 24 23
@@ -8,4 +8,5 @@ enum class E {
}
}
// LINES: 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): 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): 6 6
+2 -1
View File
@@ -7,4 +7,5 @@ fun foo() {
A(23, "foo")
}
// LINES: 1 2 3 * 6 8 7 7
// LINES(JS): 1 2 3 * 6 8 7 7
// LINES(JS_IR): 2 2 3 3 * 2 2 * 3 3 * 7 7
@@ -18,4 +18,5 @@ fun box(x: Int) {
)
}
// LINES: 1 19 4 4 3 3 4 6 9 9 6 11 13 13 11 16 16 3 2
// LINES(JS): 1 19 4 4 3 3 4 6 9 9 6 11 13 13 11 16 16 3 2
// LINES(JS_IR): 4 4 2 6 7 8 9 11 12 13 16
@@ -28,4 +28,5 @@ fun four() = 4
fun five() = 5
// LINES: 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): 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): 4 4 2 6 7 8 9 11 12 13 16 * 21 21 * 23 23 * 25 25 * 27 27 * 29 29
+2 -1
View File
@@ -13,4 +13,5 @@ fun foo(): Int = 23
fun bar(): IntRange = 1000..2000
// LINES: 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): 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): 2 2 3 4 4 5 6 6 7 7 7 7 7 8 8 * 12 12 * 14 14
+2 -1
View File
@@ -13,4 +13,5 @@ open class A
open class B : A()
// LINES: 1 10 2 2 2 2 3 3 4 4 5 5 6 6 8 8 12 * 14 14
// LINES(JS): 1 10 2 2 2 2 3 3 4 4 5 5 6 6 8 8 12 * 14 14
// LINES(JS_IR): 2 2 4 4 * 14
@@ -12,4 +12,5 @@ fun box() {
}
}
// LINES: 1 13 5 5 4 2 2 3 5 5 8 8 * 3 4 9 3 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): 2 2 * 5 5 5 5 5 8 8 * 4 9 * 11 11