Replace appendln with appendLine in project

This commit is contained in:
Alexander Udalov
2020-06-09 21:09:45 +02:00
parent d1c88798df
commit 6e67e1e78d
76 changed files with 405 additions and 402 deletions
@@ -685,13 +685,13 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
else -> "?"
}
val compiledPort: Int? = daemonInfo.trim().split(" ").last().toIntOrNull()
appendln("#$i\tcompiled on $daemonInfo, session ${daemonInfos[i]?.second}, result ${resultCodes[i]}; started daemon on port ${port2logs[i]?.first}, log: ${logFiles[i]?.canonicalPath}")
appendLine("#$i\tcompiled on $daemonInfo, session ${daemonInfos[i]?.second}, result ${resultCodes[i]}; started daemon on port ${port2logs[i]?.first}, log: ${logFiles[i]?.canonicalPath}")
if (resultCodes[i] != 0 || electionLogs[i] == null) {
appendln("--- out $i, result ${resultCodes[i]}:\n${outStreams[i].toByteArray().toString(Charset.defaultCharset())}\n---")
appendLine("--- out $i, result ${resultCodes[i]}:\n${outStreams[i].toByteArray().toString(Charset.defaultCharset())}\n---")
compiledPort?.let { port -> port2logs.find { it?.first == port } }?.second?.let { logFile ->
appendln("--- log file ${logFile.name}:\n${logFile.readText()}\n---")
appendLine("--- log file ${logFile.name}:\n${logFile.readText()}\n---")
}
?: appendln("--- log not found (port: $compiledPort)")
?: appendLine("--- log not found (port: $compiledPort)")
}
}
}
@@ -917,20 +917,20 @@ internal fun generateLargeKotlinFile(size: Int): String {
return buildString {
append("package large\n\n")
(0..size).forEach {
appendln("class Class$it")
appendln("{")
appendln("\tfun foo(): Long = $it")
appendln("}")
appendln("\n")
appendLine("class Class$it")
appendLine("{")
appendLine("\tfun foo(): Long = $it")
appendLine("}")
appendLine("\n")
repeat(2000) {
appendln("// kotlin rules ... and stuff")
appendLine("// kotlin rules ... and stuff")
}
}
appendln("fun main(args: Array<String>)")
appendln("{")
appendln("\tval result = Class5().foo() + Class$size().foo()")
appendln("\tprintln(result)")
appendln("}")
appendLine("fun main(args: Array<String>)")
appendLine("{")
appendLine("\tval result = Class5().foo() + Class$size().foo()")
appendLine("\tprintln(result)")
appendLine("}")
}
}
@@ -980,13 +980,13 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
else -> "?"
}
val compiledPort: Int? = daemonInfo.trim().split(" ").last().toIntOrNull()
appendln("#$i\tcompiled on $daemonInfo, session ${daemonInfos[i]?.second}, result ${resultCodes[i]}; started daemon on port ${port2logs[i]?.first}, log: ${logFiles[i]?.canonicalPath}")
appendLine("#$i\tcompiled on $daemonInfo, session ${daemonInfos[i]?.second}, result ${resultCodes[i]}; started daemon on port ${port2logs[i]?.first}, log: ${logFiles[i]?.canonicalPath}")
if (resultCodes[i] != 0 || electionLogs[i] == null) {
appendln("--- out $i, result ${resultCodes[i]}:\n${outStreams[i].toByteArray().toString(Charset.defaultCharset())}\n---")
appendLine("--- out $i, result ${resultCodes[i]}:\n${outStreams[i].toByteArray().toString(Charset.defaultCharset())}\n---")
compiledPort?.let { port -> port2logs.find { it?.first == port } }?.second?.let { logFile ->
appendln("--- log file ${logFile.name}:\n${logFile.readText()}\n---")
appendLine("--- log file ${logFile.name}:\n${logFile.readText()}\n---")
}
?: appendln("--- log not found (port: $compiledPort)")
?: appendLine("--- log not found (port: $compiledPort)")
}
}
}
@@ -1371,20 +1371,20 @@ internal fun generateLargeKotlinFile(size: Int): String {
return buildString {
append("package large\n\n")
(0..size).forEach {
appendln("class Class$it")
appendln("{")
appendln("\tfun foo(): Long = $it")
appendln("}")
appendln("\n")
appendLine("class Class$it")
appendLine("{")
appendLine("\tfun foo(): Long = $it")
appendLine("}")
appendLine("\n")
repeat(2000) {
appendln("// kotlin rules ... and stuff")
appendLine("// kotlin rules ... and stuff")
}
}
appendln("fun main(args: Array<String>)")
appendln("{")
appendln("\tval result = Class5().foo() + Class$size().foo()")
appendln("\tprintln(result)")
appendln("}")
appendLine("fun main(args: Array<String>)")
appendLine("{")
appendLine("\tval result = Class5().foo() + Class$size().foo()")
appendLine("\tprintln(result)")
appendLine("}")
}
}
@@ -66,7 +66,7 @@ abstract class AbstractFirLoadCompiledKotlin : AbstractFirResolveWithSessionTest
for (name in provider.getAllCallableNamesInPackage(packageFqName)) {
for (symbol in provider.getTopLevelCallableSymbols(packageFqName, name)) {
symbol.fir.accept(firRenderer)
builder.appendln()
builder.appendLine()
}
}
@@ -75,7 +75,7 @@ abstract class AbstractFirLoadCompiledKotlin : AbstractFirResolveWithSessionTest
provider.getClassLikeSymbolByFqName(ClassId.topLevel(packageFqName.child(name))) as FirClassSymbol?
?: continue
classLikeSymbol.fir.accept(firRenderer)
builder.appendln()
builder.appendLine()
}
val testDataDirectoryPath =
@@ -42,7 +42,7 @@ class BuiltInsDeserializationForFirTestCase : AbstractFirResolveWithSessionTestC
for (name in provider.getAllCallableNamesInPackage(packageFqName)) {
for (symbol in provider.getTopLevelCallableSymbols(packageFqName, name)) {
symbol.fir.accept(firRenderer)
builder.appendln()
builder.appendLine()
}
}
@@ -51,7 +51,7 @@ class BuiltInsDeserializationForFirTestCase : AbstractFirResolveWithSessionTestC
provider.getClassLikeSymbolByFqName(ClassId.topLevel(packageFqName.child(name))) as FirClassSymbol?
?: continue
classLikeSymbol.fir.accept(firRenderer)
builder.appendln()
builder.appendLine()
}
@@ -44,7 +44,7 @@ abstract class AbstractFirOldFrontendLightClassesTest : AbstractFirOldFrontendDi
)
psiClass.appendMirrorText(0, stringBuilder)
stringBuilder.appendln()
stringBuilder.appendLine()
}
val expectedPath = testDataFile.path.replace(".kt", ".txt")
@@ -173,22 +173,22 @@ abstract class AbstractBuilderConfigurator<T : AbstractFirTreeBuilder>(val firTr
return if (type == null) {
allImplementations.filter { it.kind?.hasLeafBuilder == true }.singleOrNull() ?: this@AbstractBuilderConfigurator.run {
val message = buildString {
appendln("${this@extractImplementation} has multiple implementations:")
appendLine("${this@extractImplementation} has multiple implementations:")
for (implementation in allImplementations) {
appendln(" - ${implementation.type}")
appendLine(" - ${implementation.type}")
}
appendln("Please specify implementation is needed")
appendLine("Please specify implementation is needed")
}
throw IllegalArgumentException(message)
}
} else {
allImplementations.firstOrNull { it.type == type } ?: this@AbstractBuilderConfigurator.run {
val message = buildString {
appendln("${this@extractImplementation} has not implementation $type. Existing implementations:")
appendLine("${this@extractImplementation} has not implementation $type. Existing implementations:")
for (implementation in allImplementations) {
appendln(" - ${implementation.type}")
appendLine(" - ${implementation.type}")
}
appendln("Please specify implementation is needed")
appendLine("Please specify implementation is needed")
}
throw IllegalArgumentException(message)
}
@@ -64,11 +64,11 @@ class IncompatibleExpectedActualClassScopesRenderer(
open class MultiplatformDiagnosticRenderingMode {
open fun newLine(sb: StringBuilder) {
sb.appendln()
sb.appendLine()
}
open fun renderList(sb: StringBuilder, elements: List<() -> Unit>) {
sb.appendln()
sb.appendLine()
for (element in elements) {
element()
}
@@ -77,7 +77,7 @@ open class MultiplatformDiagnosticRenderingMode {
open fun renderDescriptor(sb: StringBuilder, descriptor: DeclarationDescriptor, context: RenderingContext, indent: String) {
sb.append(indent)
sb.append(INDENTATION_UNIT)
sb.appendln(Renderers.COMPACT_WITH_MODIFIERS.render(descriptor, context))
sb.appendLine(Renderers.COMPACT_WITH_MODIFIERS.render(descriptor, context))
}
}
@@ -14,12 +14,12 @@ fun getExceptionMessage(
location: String?
): String = ApplicationManager.getApplication().runReadAction<String> {
buildString {
append(subsystemName).append(" Internal error: ").appendln(message)
append(subsystemName).append(" Internal error: ").appendLine(message)
if (location != null) {
append("File being compiled: ").appendln(location)
append("File being compiled: ").appendLine(location)
} else {
appendln("File is unknown")
appendLine("File is unknown")
}
if (cause != null) {
@@ -104,20 +104,20 @@ fun dumpBuildLog(buildSteps: Iterable<BuildStep>): String {
for ((i, step) in buildSteps.withIndex()) {
if (i > 0) {
sb.appendln()
sb.appendLine()
}
sb.appendln("================ Step #${i + 1} =================")
sb.appendln()
sb.appendln(BEGIN_COMPILED_FILES)
step.compiledKotlinFiles.sorted().forEach { sb.appendln(it) }
step.compiledJavaFiles.sorted().forEach { sb.appendln(it) }
sb.appendln(END_COMPILED_FILES)
sb.appendln("------------------------------------------")
sb.appendLine("================ Step #${i + 1} =================")
sb.appendLine()
sb.appendLine(BEGIN_COMPILED_FILES)
step.compiledKotlinFiles.sorted().forEach { sb.appendLine(it) }
step.compiledJavaFiles.sorted().forEach { sb.appendLine(it) }
sb.appendLine(END_COMPILED_FILES)
sb.appendLine("------------------------------------------")
if (!step.compileSucceeded) {
sb.appendln(BEGIN_ERRORS)
step.compileErrors.forEach { sb.appendln(it) }
sb.appendLine(BEGIN_ERRORS)
step.compileErrors.forEach { sb.appendLine(it) }
}
}
@@ -33,7 +33,7 @@ fun BasicBlock.dump(builder: StringBuilder = StringBuilder(), indent: String = "
builder.append(indent)
builder.append(String.format("%3d ", index + 1))
val dump = element.cfgDump()
builder.appendln(dump.lines().first())
builder.appendLine(dump.lines().first())
}
return builder.toString()
}
@@ -41,7 +41,7 @@ fun BasicBlock.dump(builder: StringBuilder = StringBuilder(), indent: String = "
fun BlockConnector.dump(builder: StringBuilder = StringBuilder(), indent: String = ""): String {
builder.append(indent)
val dump = element.cfgDump()
builder.appendln(dump.lines().first())
builder.appendLine(dump.lines().first())
return builder.toString()
}
@@ -56,21 +56,21 @@ fun ControlFlowGraph.dump(): String {
}
val builder = StringBuilder()
for ((index, block) in blocks.withIndex()) {
builder.appendln("BB $index")
builder.appendLine("BB $index")
val incoming = block.incoming
if (incoming != null) {
builder.appendln(incoming.previousBlocks.joinToString(prefix = "INCOMING <- BB ") { blockIndex[it].toString() })
builder.appendLine(incoming.previousBlocks.joinToString(prefix = "INCOMING <- BB ") { blockIndex[it].toString() })
incoming.dump(builder, " ")
}
builder.appendln("CONTENT")
builder.appendLine("CONTENT")
block.dump(builder, " ")
val outgoing = block.outgoing
if (outgoing != null) {
if (outgoing.nextBlocks.isEmpty()) {
builder.appendln("OUTGOING -> NONE")
builder.appendLine("OUTGOING -> NONE")
}
else {
builder.appendln(outgoing.nextBlocks.joinToString(prefix = "OUTGOING -> BB ") { blockIndex[it].toString() })
builder.appendLine(outgoing.nextBlocks.joinToString(prefix = "OUTGOING -> BB ") { blockIndex[it].toString() })
}
outgoing.dump(builder, " ")
}
@@ -115,13 +115,13 @@ class MutableContextInfo private constructor(
this.entries.filter { it.value.isNotEmpty() }.forEach { (key, value) ->
append(key.toString())
append(" $separator ")
appendln(value.toString())
appendLine(value.toString())
}
}
append("Fired effects: ")
append(info.firedEffects.joinToString(separator = ", "))
appendln("")
appendLine("")
subtypes.printMapEntriesWithSeparator("is")
@@ -91,7 +91,7 @@ abstract class AbstractPseudoValueTest : AbstractPseudocodeTest() {
"%1$-${valueColumnWidth}s".format(valueDecl(value)) +
" " +
"%1$-${valueDescColumnWidth}s".format(description)
out.appendln(line.trimEnd())
out.appendLine(line.trimEnd())
}
}
@@ -74,12 +74,12 @@ abstract class AbstractAsmLikeInstructionListingTest : CodegenTestCase() {
append(" : " + superTypes.joinToString())
}
appendln(" {")
appendLine(" {")
fields.joinTo(this, LINE_SEPARATOR.repeat(2)) { renderField(it, showTypeAnnotations).withMargin() }
if (fields.isNotEmpty()) {
appendln().appendln()
appendLine().appendLine()
}
methods.joinTo(this, LINE_SEPARATOR.repeat(2)) {
@@ -87,7 +87,7 @@ abstract class AbstractAsmLikeInstructionListingTest : CodegenTestCase() {
renderMethod(it, showBytecode, showLocalVariables, showTypeAnnotations).withMargin()
}
appendln().append("}")
appendLine().append("}")
}
}
@@ -147,7 +147,7 @@ abstract class AbstractAsmLikeInstructionListingTest : CodegenTestCase() {
val actualShowLocalVariables = showLocalVariables && method.localVariables?.takeIf { it.isNotEmpty() } != null
if (actualShowBytecode || actualShowLocalVariables) {
appendln(" {")
appendLine(" {")
if (actualShowLocalVariables) {
val localVariableTable = buildLocalVariableTable(method)
@@ -158,12 +158,12 @@ abstract class AbstractAsmLikeInstructionListingTest : CodegenTestCase() {
if (actualShowBytecode) {
if (actualShowLocalVariables) {
appendln().appendln()
appendLine().appendLine()
}
append(renderBytecodeInstructions(method.instructions).trimEnd().withMargin())
}
appendln().append("}")
appendLine().append("}")
method.visibleTypeAnnotations
}
@@ -188,7 +188,7 @@ abstract class AbstractAsmLikeInstructionListingTest : CodegenTestCase() {
return buildString {
append("Local variables:")
for (variable in localVariables) {
appendln().append((variable.index.toString() + " " + variable.name + ": " + variable.desc).withMargin())
appendLine().append((variable.index.toString() + " " + variable.name + ": " + variable.desc).withMargin())
}
}
}
@@ -205,12 +205,12 @@ abstract class AbstractAsmLikeInstructionListingTest : CodegenTestCase() {
private fun StringBuilder.renderInstruction(node: AbstractInsnNode, labelMappings: LabelMappings) {
if (node is LabelNode) {
appendln("LABEL (L" + labelMappings[node.label] + ")")
appendLine("LABEL (L" + labelMappings[node.label] + ")")
return
}
if (node is LineNumberNode) {
appendln("LINENUMBER (" + node.line + ")")
appendLine("LINENUMBER (" + node.line + ")")
return
}
@@ -227,7 +227,7 @@ abstract class AbstractAsmLikeInstructionListingTest : CodegenTestCase() {
is LdcInsnNode -> append(" (" + node.cst + ")")
}
appendln()
appendLine()
}
private fun String.withMargin(margin: String = " "): String {
@@ -53,7 +53,7 @@ object SMAPTestUtil {
StringReader(file.content).forEachLine { line ->
// Strip comments
if (!line.startsWith("//")) {
appendln(line.trim())
appendLine(line.trim())
}
}
}.trim()
@@ -79,15 +79,15 @@ abstract class AbstractFirDiagnosticsWithLightTreeTest : AbstractFirDiagnosticsT
}
if (wasExpected.isNotEmpty()) {
appendln("Some diagnostics was expected:")
appendLine("Some diagnostics was expected:")
wasExpected.forEach {
appendln(it.errorMessage())
appendLine(it.errorMessage())
}
}
if (isActual.isNotEmpty()) {
appendln("Some new diagnostics:")
appendLine("Some new diagnostics:")
isActual.forEach {
appendln(it.errorMessage())
appendLine(it.errorMessage())
}
}
@@ -63,9 +63,9 @@ abstract class AbstractFirOldFrontendDiagnosticsTest : AbstractFirDiagnosticsTes
private fun checkFailureFile(failure: FirRuntimeException, failureFile: File) {
val failureMessage = buildString {
appendln(failure.message)
appendLine(failure.message)
append("Cause: ")
appendln(failure.cause)
appendLine(failure.cause)
}
KotlinTestUtils.assertEqualsToFile(failureFile, failureMessage)
}
@@ -80,7 +80,7 @@ class RTableContext {
out.append(HLINE.repeat(size))
}
out.append(postfix)
out.appendln()
out.appendLine()
}
appendHLine(CORNER_LU, TOP_T, CORNER_RU)
@@ -93,7 +93,7 @@ class RTableContext {
out.append(VLINE)
out.append(" ")
}
out.appendln()
out.appendLine()
}
is Row.Separator -> {
appendHLine(LEFT_T, CROSS, RIGHT_T)
@@ -31,10 +31,10 @@ abstract class AbstractIrCfgTestCase : AbstractIrGeneratorTestCase() {
val builder = StringBuilder()
for (declaration in this.declarations) {
if (declaration is IrFunction) {
builder.appendln("// FUN: ${declaration.name}")
builder.appendLine("// FUN: ${declaration.name}")
val cfg = FunctionGenerator(declaration).generate()
builder.appendln(cfg.dump())
builder.appendln("// END FUN: ${declaration.name}")
builder.appendLine(cfg.dump())
builder.appendLine("// END FUN: ${declaration.name}")
}
}
return builder.toString()
@@ -43,10 +43,10 @@ abstract class AbstractIrCfgTestCase : AbstractIrGeneratorTestCase() {
private fun IrModuleFragment.cfgDump(): String {
val builder = StringBuilder()
for (file in this.files) {
builder.appendln("// FILE: ${file.path}")
builder.appendln(file.cfgDump())
builder.appendln("// END FILE: ${file.path}")
builder.appendln()
builder.appendLine("// FILE: ${file.path}")
builder.appendLine(file.cfgDump())
builder.appendLine("// END FILE: ${file.path}")
builder.appendLine()
}
return builder.toString()
}
@@ -40,13 +40,13 @@ abstract class AbstractEnhancedSignaturesResolvedCallsTest : AbstractResolvedCal
return buildString {
lines.forEachIndexed { lineIndex, line ->
appendln(line)
appendLine(line)
callsByLine[lineIndex]?.let { calls ->
val indent = line.takeWhile(Char::isWhitespace) + " "
calls.forEach { resolvedCall ->
appendln("$indent// ${resolvedCall?.status}")
appendln("$indent// ORIGINAL: ${resolvedCall?.run { resultingDescriptor!!.original.getText() }}")
appendln("$indent// SUBSTITUTED: ${resolvedCall?.run { resultingDescriptor!!.getText() }}")
appendLine("$indent// ${resolvedCall?.status}")
appendLine("$indent// ORIGINAL: ${resolvedCall?.run { resultingDescriptor!!.original.getText() }}")
appendLine("$indent// SUBSTITUTED: ${resolvedCall?.run { resultingDescriptor!!.getText() }}")
}
}
}
@@ -131,30 +131,30 @@ internal fun DeclarationDescriptor.getText(): String = when (this) {
internal fun ResolvedCall<*>.renderToText(): String {
return buildString {
appendln("Resolved call:")
appendln()
appendLine("Resolved call:")
appendLine()
if (candidateDescriptor != resultingDescriptor) {
appendln("Candidate descriptor: ${candidateDescriptor!!.getText()}")
appendLine("Candidate descriptor: ${candidateDescriptor!!.getText()}")
}
appendln("Resulting descriptor: ${resultingDescriptor!!.getText()}")
appendln()
appendLine("Resulting descriptor: ${resultingDescriptor!!.getText()}")
appendLine()
appendln("Explicit receiver kind = ${explicitReceiverKind}")
appendln("Dispatch receiver = ${dispatchReceiver.getText()}")
appendln("Extension receiver = ${extensionReceiver.getText()}")
appendLine("Explicit receiver kind = ${explicitReceiverKind}")
appendLine("Dispatch receiver = ${dispatchReceiver.getText()}")
appendLine("Extension receiver = ${extensionReceiver.getText()}")
val valueArguments = call.valueArguments
if (!valueArguments.isEmpty()) {
appendln()
appendln("Value arguments mapping:")
appendln()
appendLine()
appendLine("Value arguments mapping:")
appendLine()
for (valueArgument in valueArguments) {
val argumentText = valueArgument!!.getText()
val argumentMappingText = getArgumentMapping(valueArgument).getText()
appendln("$argumentMappingText $argumentText")
appendLine("$argumentMappingText $argumentText")
}
}
}
@@ -32,7 +32,7 @@ class ServiceLoaderLiteTest : AbstractServiceLoaderLiteTest() {
}
fun testSeveralProcessors() {
val processorsContent = buildString { appendln("test.Foo").appendln("test.Bar") }
val processorsContent = buildString { appendLine("test.Foo").appendLine("test.Bar") }
applyForDirAndJar("test", processors(processorsContent)) { file ->
val impls = ServiceLoaderLite.findImplementations(Processor::class.java, listOf(file))
@@ -98,11 +98,11 @@ class ServiceLoaderLiteTest : AbstractServiceLoaderLiteTest() {
fun testCommentsAndWhitespaces() {
val processorsContent = buildString {
appendln(" test.Foo #comment")
appendln("#comment2")
appendln().appendln()
appendln("test.Bar #anotherComemnt")
appendln("test.Zoo ")
appendLine(" test.Foo #comment")
appendLine("#comment2")
appendLine().appendLine()
appendLine("test.Bar #anotherComemnt")
appendLine("test.Zoo ")
}
applyForDirAndJar("test", processors(processorsContent)) { file ->
@@ -127,7 +127,7 @@ class ServiceLoaderLiteTestWithClassLoader : AbstractServiceLoaderLiteTest() {
private inline fun <reified Intf : Any> impls(vararg impls: KClass<out Intf>): Entry {
val content = buildString {
for (impl in impls) {
appendln(impl.java.name)
appendLine(impl.java.name)
}
}
return Entry("META-INF/services/" + Intf::class.java.name, content)
@@ -206,8 +206,8 @@ class CodeConformanceTest : TestCase() {
for (test in tests) {
if (test.result.isNotEmpty()) {
append(test.message.format(test.result.size, test.result.joinToString("\n")))
appendln()
appendln()
appendLine()
appendLine()
}
}
})
@@ -55,10 +55,10 @@ class JvmModuleProtoBufTest : KtUsefulTestCase() {
)
val result = buildString {
for (annotationClassId in mapping.moduleData.annotations) {
appendln("@$annotationClassId")
appendLine("@$annotationClassId")
}
for ((fqName, packageParts) in mapping.packageFqName2Parts) {
appendln(fqName)
appendLine(fqName)
for (part in packageParts.parts) {
append(" ")
append(part)
@@ -68,7 +68,7 @@ class JvmModuleProtoBufTest : KtUsefulTestCase() {
append(facadeName)
append(")")
}
appendln()
appendLine()
}
}
}
@@ -38,20 +38,20 @@ class CompilerFileLimitTest : CompilerSmokeTestBase() {
return buildString {
append("package large\n\n")
(0..size).forEach {
appendln("class Class$it")
appendln("{")
appendln("\tfun foo(): Long = $it")
appendln("}")
appendln("\n")
appendLine("class Class$it")
appendLine("{")
appendLine("\tfun foo(): Long = $it")
appendLine("}")
appendLine("\n")
repeat(2000) {
appendln("// kotlin rules ... and stuff")
appendLine("// kotlin rules ... and stuff")
}
}
appendln("fun main()")
appendln("{")
appendln("\tval result = Class5().foo() + Class$size().foo()")
appendln("\tprintln(result)")
appendln("}")
appendLine("fun main()")
appendLine("{")
appendLine("\tval result = Class5().foo() + Class$size().foo()")
appendLine("\tprintln(result)")
appendLine("}")
}
}
@@ -81,33 +81,33 @@ class CompilerFileLimitTest : CompilerSmokeTestBase() {
return buildString {
append("package usesLarge\n\n")
append("import large.Large\n\n")
appendln("fun main()")
appendln("{")
appendln("\tval result = Large.Class0().foo() + Large.Class$size().foo()")
appendln("\tprintln(result)")
appendln("}")
appendLine("fun main()")
appendLine("{")
appendLine("\tval result = Large.Class0().foo() + Large.Class$size().foo()")
appendLine("\tprintln(result)")
appendLine("}")
}
}
private fun generateLargeJavaFile(size: Int): String {
return buildString {
append("package large;\n\n")
appendln("public class Large")
appendln("{")
appendLine("public class Large")
appendLine("{")
(0..size).forEach {
appendln("\tpublic static class Class$it")
appendln("\t{")
appendln("\t\tpublic long foo()")
appendln("\t\t{")
appendln("\t\t\t return $it;")
appendln("\t\t}")
appendln("\t}")
appendln("\n")
appendLine("\tpublic static class Class$it")
appendLine("\t{")
appendLine("\t\tpublic long foo()")
appendLine("\t\t{")
appendLine("\t\t\t return $it;")
appendLine("\t\t}")
appendLine("\t}")
appendLine("\n")
repeat(2000) {
appendln("// kotlin rules ... and stuff")
appendLine("// kotlin rules ... and stuff")
}
}
appendln("}")
appendLine("}")
}
}
@@ -54,31 +54,31 @@ abstract class AbstractMultiPlatformIntegrationTest : KtUsefulTestCase() {
val jvm2Dest = File(tmpdir, "jvm2").absolutePath.takeIf { jvm2Src != null }
val result = buildString {
appendln("-- Common --")
appendln(K2MetadataCompiler().compile(commonSrc, null, "-d", commonDest, *optionalStdlibCommon))
appendLine("-- Common --")
appendLine(K2MetadataCompiler().compile(commonSrc, null, "-d", commonDest, *optionalStdlibCommon))
if (jvmSrc != null) {
appendln()
appendln("-- JVM --")
appendln(K2JVMCompiler().compile(jvmSrc, commonSrc, "-d", jvmDest!!))
appendLine()
appendLine("-- JVM --")
appendLine(K2JVMCompiler().compile(jvmSrc, commonSrc, "-d", jvmDest!!))
}
if (jsSrc != null) {
appendln()
appendln("-- JS --")
appendln(K2JSCompiler().compile(jsSrc, commonSrc, "-output", jsDest!!))
appendLine()
appendLine("-- JS --")
appendLine(K2JSCompiler().compile(jsSrc, commonSrc, "-output", jsDest!!))
}
if (common2Src != null) {
appendln()
appendln("-- Common (2) --")
appendln(K2MetadataCompiler().compile(common2Src, null, "-d", common2Dest!!, "-cp", commonDest, *optionalStdlibCommon))
appendLine()
appendLine("-- Common (2) --")
appendLine(K2MetadataCompiler().compile(common2Src, null, "-d", common2Dest!!, "-cp", commonDest, *optionalStdlibCommon))
}
if (jvm2Src != null) {
appendln()
appendln("-- JVM (2) --")
appendln(
appendLine()
appendLine("-- JVM (2) --")
appendLine(
K2JVMCompiler().compile(
jvm2Src, common2Src, "-d", jvm2Dest!!,
"-cp", listOfNotNull(commonDest, common2Dest, jvmDest).joinToString(File.pathSeparator)
@@ -110,9 +110,9 @@ abstract class AbstractMultiPlatformIntegrationTest : KtUsefulTestCase() {
"-Xmulti-platform" + mainArguments +
loadExtraArguments(listOfNotNull(sources, commonSources))
)
appendln("Exit code: $exitCode")
appendln("Output:")
appendln(output)
appendLine("Exit code: $exitCode")
appendLine("Output:")
appendLine(output)
}.trimTrailingWhitespacesAndAddNewlineAtEOF().trimEnd('\r', '\n')
private fun loadExtraArguments(sources: List<File>): List<String> = sources.flatMap { source ->
@@ -74,7 +74,7 @@ abstract class AbstractReplInterpreterTest : KtUsefulTestCase() {
val value = StringBuilder()
while (lines.isNotEmpty() && !START_PATTERN.matcher(lines.peek()!!).matches()) {
value.appendln(lines.poll()!!)
value.appendLine(lines.poll()!!)
}
result.add(OneLine(code, value.toString()))
@@ -97,10 +97,10 @@ class CapturedTypeApproximationTest : KotlinTestWithEnvironment() {
val typeParameters = functionFoo.typeParameters
val type = functionFoo.returnType
appendln(testType)
appendLine(testType)
if (bindingContext.diagnostics.noSuppression().any { it.severity == Severity.ERROR }) {
appendln(" compiler error\n")
appendLine(" compiler error\n")
continue
}
@@ -119,9 +119,9 @@ class CapturedTypeApproximationTest : KotlinTestWithEnvironment() {
if (testSubstitution.size > 1) append("${typeParameter.name} = ")
append("${testSubstitution[typeParameter]}. ")
}
appendln("lower: $lower; upper: $upper; substitution: $substitution")
appendLine("lower: $lower; upper: $upper; substitution: $substitution")
}
if (testTypes.lastIndex != index) appendln()
if (testTypes.lastIndex != index) appendLine()
}
}