[K2, CLI] Support endOffset in Kotlin CLI

Duplicated messages in testdata appeared because default renderer
renders diagnostic spans ambiguously. It shows only start position.
In fact, there are 3 failures, 2 of them distinguish only by the
diagnostic end offset. See youtrack for more information.

The issue about inconvenient rendering is KT-64989.

#KT-64608
This commit is contained in:
Evgeniy.Zhelenskiy
2024-01-12 03:08:09 +01:00
committed by Space Team
parent 6404cede07
commit f05c972efb
12 changed files with 154 additions and 28 deletions
@@ -16,6 +16,7 @@
package org.jetbrains.kotlin.codegen
import org.jetbrains.kotlin.cli.common.messages.MessageRenderer
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
import org.jetbrains.kotlin.config.ApiVersion
import org.jetbrains.kotlin.config.LanguageVersion
@@ -34,7 +35,8 @@ class JvmModuleProtoBufTest : KtUsefulTestCase() {
relativeDirectory: String,
compileWith: LanguageVersion = LanguageVersion.LATEST_STABLE,
loadWith: LanguageVersion = LanguageVersion.LATEST_STABLE,
extraOptions: List<String> = emptyList()
extraOptions: List<String> = emptyList(),
messageRenderer: MessageRenderer? = null,
) {
val directory = KtTestUtil.getTestDataPathBase() + relativeDirectory
val tmpdir = KtTestUtil.tmpDir(this::class.simpleName)
@@ -46,7 +48,8 @@ class JvmModuleProtoBufTest : KtUsefulTestCase() {
"-d", tmpdir.path,
"-module-name", moduleName,
"-language-version", compileWith.versionString
) + extraOptions
) + extraOptions,
messageRenderer
)
val mapping = ModuleMapping.loadModuleMapping(