[kotlin] Support unresloved references in returns when creating CreateLabel fix

KTIJ-29594 K2 IDE: Port CreateLabelFix

GitOrigin-RevId: d070cacdc424de3ca08359924c0f9a882b628e6f
This commit is contained in:
Victoria.Petrakovich
2024-09-02 23:27:10 +00:00
committed by intellij-monorepo-bot
parent dac2430b1a
commit 7d941d5ef5
5 changed files with 2 additions and 13 deletions
@@ -11,7 +11,8 @@ import org.jetbrains.kotlin.psi.*
internal object CreateLabelFixFactories {
val unresolvedLabelFactory = KotlinQuickFixFactory.IntentionBased { diagnostic: KaFirDiagnostic.UnresolvedLabel ->
val labelReferenceExpression = diagnostic.psi as? KtLabelReferenceExpression ?: return@IntentionBased emptyList()
val labelReferenceExpression = diagnostic.psi as? KtLabelReferenceExpression
?: (diagnostic.psi as? KtReturnExpression)?.getTargetLabel() as? KtLabelReferenceExpression ?: return@IntentionBased emptyList()
return@IntentionBased getFixes(labelReferenceExpression)
}
@@ -1,6 +1,3 @@
/* IGNORE_K2 */
// Remove this ignoring after KT-69829 is fixed
// "Create label foo@" "true"
inline fun Int.bar(f: (Int) -> Unit) { }
@@ -1,6 +1,3 @@
/* IGNORE_K2 */
// Remove this ignoring after KT-69829 is fixed
// "Create label foo@" "true"
inline fun Int.bar(f: (Int) -> Unit) { }
@@ -1,6 +1,3 @@
/* IGNORE_K2 */
// Remove this ignoring after KT-69829 is fixed
// "Create label foo@" "true"
inline fun Int.bar(f: (Int) -> Unit) { }
@@ -1,6 +1,3 @@
/* IGNORE_K2 */
// Remove this ignoring after KT-69829 is fixed
// "Create label foo@" "true"
inline fun Int.bar(f: (Int) -> Unit) { }