KT-1436 Nicer compiler errors when the feature isn't supported

This commit is contained in:
Pavel Mikhailovskii
2022-10-14 09:42:56 +02:00
committed by teamcity
parent e6900ec0f2
commit 1215ae0fe7
11 changed files with 103 additions and 24 deletions
@@ -938,7 +938,13 @@ class ControlFlowProcessor(
// See generateInitializersForClassOrObject && generateDeclarationForLocalClassOrObjectIfNeeded
labelExprEnclosingFunc is ConstructorDescriptor && !labelExprEnclosingFunc.isPrimary
) {
trace.report(BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY.on(jumpExpression))
val dependsOnInlineLambdas = !skipInlineFunctions &&
getEnclosingFunctionDescriptor(bindingContext, jumpExpression, true) == getEnclosingFunctionDescriptor(bindingContext, jumpTarget, true)
if (dependsOnInlineLambdas) {
trace.report(UNSUPPORTED_FEATURE.on(jumpExpression, BreakContinueInInlineLambdas to languageVersionSettings))
} else {
trace.report(BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY.on(jumpExpression))
}
}
false
} else {