diff --git a/compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/DiagnosticReporter.kt b/compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/DiagnosticReporter.kt
index 19e239afe60..9883e47dc0e 100644
--- a/compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/DiagnosticReporter.kt
+++ b/compiler/frontend.common/src/org/jetbrains/kotlin/diagnostics/DiagnosticReporter.kt
@@ -58,47 +58,27 @@ open class KtDiagnosticReporterWithContext(
override val languageVersionSettings: LanguageVersionSettings
get() = this@KtDiagnosticReporterWithContext.languageVersionSettings
- @OptIn(InternalDiagnosticFactoryMethod::class)
- fun report(
- factory: KtDiagnosticFactory0,
- positioningStrategy: AbstractSourceElementPositioningStrategy? = null
- ) {
- sourceElement?.let { report(factory.on(it, positioningStrategy), this) }
- }
-
- @OptIn(InternalDiagnosticFactoryMethod::class)
- fun report(
- factory: KtDiagnosticFactory1,
- a: A,
- positioningStrategy: AbstractSourceElementPositioningStrategy? = null
- ) {
- sourceElement?.let { report(factory.on(it, a, positioningStrategy), this) }
- }
-
- @OptIn(InternalDiagnosticFactoryMethod::class)
- fun report(
- factory: KtDiagnosticFactory2,
- a1: A1,
- a2: A2,
- positioningStrategy: AbstractSourceElementPositioningStrategy? = null
- ) {
- sourceElement?.let { report(factory.on(it, a1, a2, positioningStrategy), this) }
- }
-
- fun reportAndCommit(factory: KtDiagnosticFactory0) {
+ fun report(factory: KtDiagnosticFactory0) {
sourceElement?.let {
reportOn(it, factory, this)
checkAndCommitReportsOn(it, this)
}
}
- fun reportAndCommit(factory: KtDiagnosticFactory1, a: A) {
+ fun report(factory: KtDiagnosticFactory1, a: A) {
sourceElement?.let {
reportOn(it, factory, a, this)
checkAndCommitReportsOn(it, this)
}
}
+ fun report(factory: KtDiagnosticFactory2, a: A, b: B) {
+ sourceElement?.let {
+ reportOn(it, factory, a, b, this)
+ checkAndCommitReportsOn(it, this)
+ }
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is DiagnosticContextImpl) return false
diff --git a/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt b/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt
index 4a962fb8ad1..766ecd22a14 100644
--- a/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt
+++ b/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt
@@ -25,7 +25,6 @@ import org.jetbrains.kotlin.codegen.inline.ReifiedTypeInliner.OperationKind.SAFE
import org.jetbrains.kotlin.codegen.intrinsics.TypeIntrinsics
import org.jetbrains.kotlin.codegen.pseudoInsns.fakeAlwaysFalseIfeq
import org.jetbrains.kotlin.codegen.pseudoInsns.fixStackAndJump
-import org.jetbrains.kotlin.codegen.signature.BothSignatureWriter
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.config.languageVersionSettings
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
@@ -874,7 +873,7 @@ class ExpressionCodegen(
private fun generateGlobalReturnFlagIfPossible(expression: IrExpression, label: String) {
if (state.isInlineDisabled) {
- context.ktDiagnosticReporter.at(expression, irFunction).reportAndCommit(BackendErrors.NON_LOCAL_RETURN_IN_DISABLED_INLINE)
+ context.ktDiagnosticReporter.at(expression, irFunction).report(BackendErrors.NON_LOCAL_RETURN_IN_DISABLED_INLINE)
genThrow(mv, "java/lang/UnsupportedOperationException", "Non-local returns are not allowed with inlining disabled")
} else {
generateGlobalReturnFlag(mv, label)
diff --git a/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineIntrinsicsSupport.kt b/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineIntrinsicsSupport.kt
index 3244609b037..9765e4f7ee1 100644
--- a/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineIntrinsicsSupport.kt
+++ b/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineIntrinsicsSupport.kt
@@ -119,12 +119,12 @@ class IrInlineIntrinsicsSupport(
override fun toKotlinType(type: IrType): KotlinType = type.toIrBasedKotlinType()
override fun reportSuspendTypeUnsupported() {
- classCodegen.context.ktDiagnosticReporter.at(reportErrorsOn, containingFile).reportAndCommit(JvmBackendErrors.TYPEOF_SUSPEND_TYPE)
+ classCodegen.context.ktDiagnosticReporter.at(reportErrorsOn, containingFile).report(JvmBackendErrors.TYPEOF_SUSPEND_TYPE)
}
override fun reportNonReifiedTypeParameterWithRecursiveBoundUnsupported(typeParameterName: Name) {
classCodegen.context.ktDiagnosticReporter.at(reportErrorsOn, containingFile)
- .reportAndCommit(JvmBackendErrors.TYPEOF_NON_REIFIED_TYPE_PARAMETER_WITH_RECURSIVE_BOUND, typeParameterName.asString())
+ .report(JvmBackendErrors.TYPEOF_NON_REIFIED_TYPE_PARAMETER_WITH_RECURSIVE_BOUND, typeParameterName.asString())
}
override fun rewritePluginDefinedOperationMarker(v: InstructionAdapter, reifiedInsn: AbstractInsnNode, instructions: InsnList, type: IrType): Boolean {
diff --git a/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/IrSourceCompilerForInline.kt b/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/IrSourceCompilerForInline.kt
index b847f625d34..f7c460392fe 100644
--- a/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/IrSourceCompilerForInline.kt
+++ b/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/IrSourceCompilerForInline.kt
@@ -129,7 +129,7 @@ class IrSourceCompilerForInline(
override fun reportSuspensionPointInsideMonitor(stackTraceElement: String) {
codegen.context.ktDiagnosticReporter
.at(callElement.symbol.owner as IrDeclaration)
- .reportAndCommit(JvmBackendErrors.SUSPENSION_POINT_INSIDE_MONITOR, stackTraceElement)
+ .report(JvmBackendErrors.SUSPENSION_POINT_INSIDE_MONITOR, stackTraceElement)
}
}
diff --git a/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/JvmSignatureClashDetector.kt b/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/JvmSignatureClashDetector.kt
index 72d9c9c7fd6..fdf9c21cdad 100644
--- a/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/JvmSignatureClashDetector.kt
+++ b/compiler/ir/backend.jvm/codegen/src/org/jetbrains/kotlin/backend/jvm/codegen/JvmSignatureClashDetector.kt
@@ -147,7 +147,7 @@ class JvmSignatureClashDetector(
irDeclarations.mapNotNullTo(LinkedHashSet()) { irDeclaration ->
classCodegen.context.ktDiagnosticReporter.atFirstValidFrom(irDeclaration, classCodegen.irClass, containingIrFile = irDeclaration.file)
}.forEach {
- it.reportAndCommit(diagnosticFactory1, conflictingJvmDeclarationsData)
+ it.report(diagnosticFactory1, conflictingJvmDeclarationsData)
}
}
diff --git a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/ConstEvaluationLowering.kt b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/ConstEvaluationLowering.kt
index 79c5a53d962..e5ab7ad9f89 100644
--- a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/ConstEvaluationLowering.kt
+++ b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/ConstEvaluationLowering.kt
@@ -33,12 +33,12 @@ class ConstEvaluationLowering(val context: JvmBackendContext) : FileLoweringPass
override fun lower(irFile: IrFile) {
fun onError(element: IrElement, error: IrErrorExpression) {
context.ktDiagnosticReporter.at(element, irFile)
- .reportAndCommit(JvmBackendErrors.EXCEPTION_IN_CONST_VAL_INITIALIZER, error.description)
+ .report(JvmBackendErrors.EXCEPTION_IN_CONST_VAL_INITIALIZER, error.description)
}
fun onWarning(element: IrElement, warning: IrErrorExpression) {
context.ktDiagnosticReporter.at(element, irFile)
- .reportAndCommit(JvmBackendErrors.EXCEPTION_IN_CONST_EXPRESSION, warning.description)
+ .report(JvmBackendErrors.EXCEPTION_IN_CONST_EXPRESSION, warning.description)
}
val suppressErrors = context.configuration.getBoolean(JVMConfigurationKeys.IGNORE_CONST_OPTIMIZATION_ERRORS)
diff --git a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/ScriptLowering.kt b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/ScriptLowering.kt
index 48ac773744c..45876d0e067 100644
--- a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/ScriptLowering.kt
+++ b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/ScriptLowering.kt
@@ -127,7 +127,9 @@ private class ScriptsToClassesLowering(val context: JvmBackendContext, val inner
declaration.isEnumClass -> reportError(JvmBackendErrors.SCRIPT_CAPTURING_ENUM)
declaration.isEnumEntry -> reportError(JvmBackendErrors.SCRIPT_CAPTURING_ENUM_ENTRY)
// TODO: ClosureAnnotator is not catching companion's closures, so the following reporting never happens. Make it work or drop
- declaration.isCompanion -> reportError(JvmBackendErrors.SCRIPT_CAPTURING_OBJECT, SpecialNames.DEFAULT_NAME_FOR_COMPANION_OBJECT)
+ declaration.isCompanion -> reportError(
+ JvmBackendErrors.SCRIPT_CAPTURING_OBJECT, SpecialNames.DEFAULT_NAME_FOR_COMPANION_OBJECT
+ )
declaration.kind.isSingleton -> reportError(JvmBackendErrors.SCRIPT_CAPTURING_OBJECT)
declaration.isClass ->
@@ -201,7 +203,7 @@ private class ScriptsToClassesLowering(val context: JvmBackendContext, val inner
irScriptClass.thisReceiver = scriptTransformer.scriptClassReceiver
val defaultContext = ScriptToClassTransformerContext(irScriptClass.thisReceiver?.symbol, null, null, false)
- fun E.patchForClass(): IrElement {
+ fun E.patchForClass(): IrElement {
return transform(scriptTransformer, defaultContext)
.transform(lambdaPatcher, ScriptFixLambdasTransformerContext())
}