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 functionSymbol: FirFunctionSymbol<*>
|
||||||
val isAnonymousFunction = identifier == null && isLocal
|
val isAnonymousFunction = identifier == null && isLocal
|
||||||
val functionBuilder = if (isAnonymousFunction) {
|
val functionBuilder = if (isAnonymousFunction) {
|
||||||
val labelName = functionDeclaration.getLabelName() ?: context.calleeNamesForLambda.lastOrNull()?.identifier
|
|
||||||
target = FirFunctionTarget(labelName = labelName, isLambda = false)
|
|
||||||
functionSymbol = FirAnonymousFunctionSymbol()
|
functionSymbol = FirAnonymousFunctionSymbol()
|
||||||
FirAnonymousFunctionBuilder().apply {
|
FirAnonymousFunctionBuilder().apply {
|
||||||
source = functionSource
|
source = functionSource
|
||||||
receiverTypeRef = receiverType
|
receiverTypeRef = receiverType
|
||||||
symbol = functionSymbol
|
symbol = functionSymbol
|
||||||
isLambda = false
|
isLambda = false
|
||||||
|
label = context.getLastLabel(functionDeclaration)
|
||||||
|
val labelName = label?.name ?: context.calleeNamesForLambda.lastOrNull()?.identifier
|
||||||
|
target = FirFunctionTarget(labelName = labelName, isLambda = false)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val functionName = identifier.nameAsSafeName()
|
val functionName = identifier.nameAsSafeName()
|
||||||
|
|||||||
@@ -1174,7 +1174,8 @@ open class RawFirBuilder(
|
|||||||
receiverTypeRef = receiverType
|
receiverTypeRef = receiverType
|
||||||
symbol = FirAnonymousFunctionSymbol()
|
symbol = FirAnonymousFunctionSymbol()
|
||||||
isLambda = false
|
isLambda = false
|
||||||
labelName = function.getLabelName() ?: context.calleeNamesForLambda.lastOrNull()?.identifier
|
label = context.getLastLabel(function)
|
||||||
|
labelName = label?.name ?: context.calleeNamesForLambda.lastOrNull()?.identifier
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
FirSimpleFunctionBuilder().apply {
|
FirSimpleFunctionBuilder().apply {
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||||
|
|
||||||
val funLit = lambda@ fun String.() {
|
val funLit = lambda@ fun String.() {
|
||||||
val d1 = this<!UNRESOLVED_LABEL!>@lambda<!>
|
val d1 = this@lambda
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val funLit = lambda@ fun String.(): <!UNRESOLVED_LABEL!>String<!> {
|
val funLit = lambda@ fun String.(): String {
|
||||||
return this<!UNRESOLVED_LABEL!>@lambda<!>
|
return this@lambda
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun lambda() {
|
fun lambda() {
|
||||||
val funLit = lambda@ fun String.(): <!UNRESOLVED_LABEL!>String<!> {
|
val funLit = lambda@ fun String.(): String {
|
||||||
return this<!UNRESOLVED_LABEL!>@lambda<!>
|
return this@lambda
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user