FIR: Throw if source is null in DiagnosticReporter.reportOn ^KT-55284 Fixed
This commit is contained in:
committed by
Space Team
parent
c3bdcc6b0d
commit
a7edf5b83e
+9
-6
@@ -15,7 +15,7 @@ fun DiagnosticReporter.reportOn(
|
||||
context: DiagnosticContext,
|
||||
positioningStrategy: AbstractSourceElementPositioningStrategy? = null
|
||||
) {
|
||||
source?.let { report(factory.on(it, positioningStrategy), context) }
|
||||
report(factory.on(requireSourceNotNull(source), positioningStrategy), context)
|
||||
}
|
||||
|
||||
fun <A : Any> DiagnosticReporter.reportOn(
|
||||
@@ -25,7 +25,7 @@ fun <A : Any> DiagnosticReporter.reportOn(
|
||||
context: DiagnosticContext,
|
||||
positioningStrategy: AbstractSourceElementPositioningStrategy? = null
|
||||
) {
|
||||
source?.let { report(factory.on(it, a, positioningStrategy), context) }
|
||||
report(factory.on(requireSourceNotNull(source), a, positioningStrategy), context)
|
||||
}
|
||||
|
||||
fun <A : Any, B : Any> DiagnosticReporter.reportOn(
|
||||
@@ -36,7 +36,7 @@ fun <A : Any, B : Any> DiagnosticReporter.reportOn(
|
||||
context: DiagnosticContext,
|
||||
positioningStrategy: AbstractSourceElementPositioningStrategy? = null
|
||||
) {
|
||||
source?.let { report(factory.on(it, a, b, positioningStrategy), context) }
|
||||
report(factory.on(requireSourceNotNull(source), a, b, positioningStrategy), context)
|
||||
}
|
||||
|
||||
fun <A : Any, B : Any, C : Any> DiagnosticReporter.reportOn(
|
||||
@@ -48,7 +48,7 @@ fun <A : Any, B : Any, C : Any> DiagnosticReporter.reportOn(
|
||||
context: DiagnosticContext,
|
||||
positioningStrategy: AbstractSourceElementPositioningStrategy? = null
|
||||
) {
|
||||
source?.let { report(factory.on(it, a, b, c, positioningStrategy), context) }
|
||||
report(factory.on(requireSourceNotNull(source), a, b, c, positioningStrategy), context)
|
||||
}
|
||||
|
||||
fun <A : Any, B : Any, C : Any, D : Any> DiagnosticReporter.reportOn(
|
||||
@@ -61,9 +61,12 @@ fun <A : Any, B : Any, C : Any, D : Any> DiagnosticReporter.reportOn(
|
||||
context: DiagnosticContext,
|
||||
positioningStrategy: AbstractSourceElementPositioningStrategy? = null
|
||||
) {
|
||||
source?.let { report(factory.on(it, a, b, c, d, positioningStrategy), context) }
|
||||
report(factory.on(requireSourceNotNull(source), a, b, c, d, positioningStrategy), context)
|
||||
}
|
||||
|
||||
private fun requireSourceNotNull(source: AbstractKtSourceElement?): AbstractKtSourceElement =
|
||||
requireNotNull(source) { "source must not be null" }
|
||||
|
||||
fun DiagnosticReporter.reportOn(
|
||||
source: AbstractKtSourceElement?,
|
||||
factory: KtDiagnosticFactoryForDeprecation0,
|
||||
@@ -125,4 +128,4 @@ fun <F : AbstractKtDiagnosticFactory> KtDiagnosticFactoryForDeprecation<F>.choos
|
||||
} else {
|
||||
warningFactory
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user