[FIR] Forbid multiple labels per statement

^KT-53629: Fixed
This commit is contained in:
vladislav.grechko
2024-01-25 17:24:27 +01:00
committed by Space Team
parent cd5b38b958
commit d27adf6677
29 changed files with 201 additions and 34 deletions
@@ -27,6 +27,10 @@ class ConeUnderscoreIsReserved(source: KtSourceElement) : ConeDiagnosticWithSour
override val reason: String get() = "Names _, __, ___, ..., are reserved in Kotlin"
}
class ConeMultipleLabelsAreForbidden(source: KtSourceElement) : ConeDiagnosticWithSource(source) {
override val reason: String get() = "Multiple labels per statement are forbidden"
}
class ConeCannotInferTypeParameterType(
val typeParameter: FirTypeParameterSymbol,
override val reason: String = "Cannot infer type for parameter ${typeParameter.name}"
@@ -102,7 +102,7 @@ fun <T : FirStatement> FirBlock.replaceFirstStatement(factory: (T) -> FirStateme
}
fun FirExpression.unwrapErrorExpression(): FirExpression? =
if (this is FirErrorExpression) expression?.run { unwrapErrorExpression() } else this
if (this is FirErrorExpression) expression?.unwrapErrorExpression() else this
fun FirExpression.unwrapArgument(): FirExpression = (this as? FirWrappedArgumentExpression)?.expression ?: this