diff --git a/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/codeMetaInfo/CodeMetaInfoParser.kt b/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/codeMetaInfo/CodeMetaInfoParser.kt index 807d2c4a737..341bd9838bd 100644 --- a/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/codeMetaInfo/CodeMetaInfoParser.kt +++ b/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/codeMetaInfo/CodeMetaInfoParser.kt @@ -16,10 +16,16 @@ object CodeMetaInfoParser { /* * ([\S&&[^,(){}]]+) -- tag, allowing all non-space characters except bracers and curly bracers * ([{](.*?)[}])? -- list of attributes - * (\("(.*?)"\))? -- arguments of meta info + * (\("((?:\\"|.)*?)"\))? -- arguments of meta info * (, )? -- possible separator between different infos + * + * Note about escaping quotes in arguments: + * `".*?"` matches everything between `"` and the closest next `"` that follows after. `\\"` + * enforces that escaped `"` are matched "along with" other symbols matched via `.`, so that + * the closing quote no longer has a change to match `\\"`. + * Note that just using `.*` would match `` as `A"), RAG("B`. */ - private val tagRegex = """([\S&&[^,(){}]]+)([{](.*?)[}])?(\("(.*?)"\))?(, )?""".toRegex() + private val tagRegex = """([\S&&[^,(){}]]+)([{](.*?)[}])?(\("((?:\\"|.)*?)"\))?(, )?""".toRegex() private class Opening(val index: Int, val tags: String, val startOffset: Int) { override fun equals(other: Any?): Boolean { diff --git a/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/codeMetaInfo/renderConfigurations/DiagnosticCodeMetaInfoRenderConfiguration.kt b/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/codeMetaInfo/renderConfigurations/DiagnosticCodeMetaInfoRenderConfiguration.kt index 1196dec4749..cf8b703e708 100644 --- a/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/codeMetaInfo/renderConfigurations/DiagnosticCodeMetaInfoRenderConfiguration.kt +++ b/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/codeMetaInfo/renderConfigurations/DiagnosticCodeMetaInfoRenderConfiguration.kt @@ -38,7 +38,9 @@ open class DiagnosticCodeMetaInfoRenderConfiguration( else -> DefaultErrorMessages.getRendererForDiagnostic(codeMetaInfo.diagnostic) } if (renderer is AbstractDiagnosticWithParametersRenderer) { - renderer.renderParameters(codeMetaInfo.diagnostic).mapTo(params, Any?::toString) + renderer.renderParameters(codeMetaInfo.diagnostic).mapTo(params) { + it.toString().replace("\"", "\\\"") + } } if (renderSeverity) params.add("severity='${codeMetaInfo.diagnostic.severity}'") diff --git a/compiler/testData/diagnostics/tests/inference/recursiveTypes/selfTypes/disabledInferenceOnSelfTypes/recursiveTypeWithTwoTypeParams.kt b/compiler/testData/diagnostics/tests/inference/recursiveTypes/selfTypes/disabledInferenceOnSelfTypes/recursiveTypeWithTwoTypeParams.kt index e401b2d72d7..3af68705763 100644 --- a/compiler/testData/diagnostics/tests/inference/recursiveTypes/selfTypes/disabledInferenceOnSelfTypes/recursiveTypeWithTwoTypeParams.kt +++ b/compiler/testData/diagnostics/tests/inference/recursiveTypes/selfTypes/disabledInferenceOnSelfTypes/recursiveTypeWithTwoTypeParams.kt @@ -6,5 +6,5 @@ interface BodySpec> { fun test(b: BodySpec) { val x = b.isEqualTo("") - x + x } diff --git a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/annotationArgRendering.kt b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/annotationArgRendering.kt index 899ec8d2450..84c0d3788de 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/annotationArgRendering.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/annotationArgRendering.kt @@ -16,7 +16,7 @@ expect fun onType(): @Ann2("") Any? // FILE: jvm.kt actual annotation class Ann -actual fun stringConcat() {} +actual fun stringConcat() {} // Not reported in K1, because supported starting from K2 actual fun onType(): Any? = null diff --git a/compiler/testData/diagnostics/tests/operatorsOverloading/until/customDisabled.kt b/compiler/testData/diagnostics/tests/operatorsOverloading/until/customDisabled.kt index c82606e1b44..d38920cfb81 100644 --- a/compiler/testData/diagnostics/tests/operatorsOverloading/until/customDisabled.kt +++ b/compiler/testData/diagnostics/tests/operatorsOverloading/until/customDisabled.kt @@ -1,11 +1,11 @@ // !LANGUAGE: -RangeUntilOperator class A { - operator fun rangeUntil(other: A): Iterable = TODO() + operator fun rangeUntil(other: A): Iterable = TODO() } fun main(n: A, f: A) { - for (i in f..<n) { + for (i in f..<n) { } } diff --git a/compiler/testData/diagnostics/tests/unitConversion/kt49394.kt b/compiler/testData/diagnostics/tests/unitConversion/kt49394.kt index ef2bfb706b9..1d9149867fb 100644 --- a/compiler/testData/diagnostics/tests/unitConversion/kt49394.kt +++ b/compiler/testData/diagnostics/tests/unitConversion/kt49394.kt @@ -11,5 +11,5 @@ val x = { } fun test() { - handle( Unit")!>x) + handle( Unit")!>x) } diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/fir/handlers/FirDiagnosticCodeMetaInfo.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/fir/handlers/FirDiagnosticCodeMetaInfo.kt index 4ca08c17bf7..9387e24d5d7 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/fir/handlers/FirDiagnosticCodeMetaInfo.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/frontend/fir/handlers/FirDiagnosticCodeMetaInfo.kt @@ -64,7 +64,9 @@ class FirDiagnosticCodeMetaRenderConfiguration( val renderer = RootDiagnosticRendererFactory(diagnostic) if (renderer is AbstractKtDiagnosticWithParametersRenderer) { - renderer.renderParameters(diagnostic).mapTo(params, Any?::toString) + renderer.renderParameters(diagnostic).mapTo(params) { + it.toString().replace("\"", "\\\"") + } } if (renderSeverity)