FIR: fix label on non-lambda anonymous function
This commit is contained in:
committed by
TeamCityServer
parent
d3b9419837
commit
c1754ad427
+3
-2
@@ -1507,14 +1507,15 @@ class DeclarationsConverter(
|
||||
val functionSymbol: FirFunctionSymbol<*>
|
||||
val isAnonymousFunction = identifier == null && isLocal
|
||||
val functionBuilder = if (isAnonymousFunction) {
|
||||
val labelName = functionDeclaration.getLabelName() ?: context.calleeNamesForLambda.lastOrNull()?.identifier
|
||||
target = FirFunctionTarget(labelName = labelName, isLambda = false)
|
||||
functionSymbol = FirAnonymousFunctionSymbol()
|
||||
FirAnonymousFunctionBuilder().apply {
|
||||
source = functionSource
|
||||
receiverTypeRef = receiverType
|
||||
symbol = functionSymbol
|
||||
isLambda = false
|
||||
label = context.getLastLabel(functionDeclaration)
|
||||
val labelName = label?.name ?: context.calleeNamesForLambda.lastOrNull()?.identifier
|
||||
target = FirFunctionTarget(labelName = labelName, isLambda = false)
|
||||
}
|
||||
} else {
|
||||
val functionName = identifier.nameAsSafeName()
|
||||
|
||||
@@ -1174,7 +1174,8 @@ open class RawFirBuilder(
|
||||
receiverTypeRef = receiverType
|
||||
symbol = FirAnonymousFunctionSymbol()
|
||||
isLambda = false
|
||||
labelName = function.getLabelName() ?: context.calleeNamesForLambda.lastOrNull()?.identifier
|
||||
label = context.getLastLabel(function)
|
||||
labelName = label?.name ?: context.calleeNamesForLambda.lastOrNull()?.identifier
|
||||
}
|
||||
} else {
|
||||
FirSimpleFunctionBuilder().apply {
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
val funLit = lambda@ fun String.() {
|
||||
val d1 = this<!UNRESOLVED_LABEL!>@lambda<!>
|
||||
val d1 = this@lambda
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val funLit = lambda@ fun String.(): <!UNRESOLVED_LABEL!>String<!> {
|
||||
return this<!UNRESOLVED_LABEL!>@lambda<!>
|
||||
val funLit = lambda@ fun String.(): String {
|
||||
return this@lambda
|
||||
}
|
||||
}
|
||||
|
||||
fun lambda() {
|
||||
val funLit = lambda@ fun String.(): <!UNRESOLVED_LABEL!>String<!> {
|
||||
return this<!UNRESOLVED_LABEL!>@lambda<!>
|
||||
val funLit = lambda@ fun String.(): String {
|
||||
return this@lambda
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user