[PL] Fix: Use stable order of return targets in 'illegalNonLocalReturn' case
This commit is contained in:
committed by
Space Team
parent
1536bca1bb
commit
650a3c467d
+11
-9
@@ -277,6 +277,12 @@ private fun Appendable.declarationKindName(symbol: IrSymbol, capitalized: Boolea
|
|||||||
return append(" ").declarationName(symbol)
|
return append(" ").declarationName(symbol)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note: All items are rendered lower-case.
|
||||||
|
private fun Appendable.sortedDeclarationsKindName(symbols: Set<IrSymbol>): Appendable {
|
||||||
|
symbols.map { symbol -> buildString inner@ { this@inner.declarationKindName(symbol, capitalized = false) } }.sorted().joinTo(this)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
private fun Appendable.sortedDeclarationsName(symbols: Set<IrSymbol>): Appendable {
|
private fun Appendable.sortedDeclarationsName(symbols: Set<IrSymbol>): Appendable {
|
||||||
symbols.map { symbol -> buildString inner@ { this@inner.declarationName(symbol) } }.sorted().joinTo(this)
|
symbols.map { symbol -> buildString inner@ { this@inner.declarationName(symbol) } }.sorted().joinTo(this)
|
||||||
return this
|
return this
|
||||||
@@ -547,15 +553,11 @@ private fun Appendable.invalidSamConversion(
|
|||||||
private fun Appendable.suspendableCallWithoutCoroutine(): Appendable =
|
private fun Appendable.suspendableCallWithoutCoroutine(): Appendable =
|
||||||
append("Suspend function can be called only from a coroutine or another suspend function")
|
append("Suspend function can be called only from a coroutine or another suspend function")
|
||||||
|
|
||||||
private fun Appendable.illegalNonLocalReturn(expression: IrReturn, validReturnTargets: Set<IrReturnTargetSymbol>): Appendable {
|
private fun Appendable.illegalNonLocalReturn(expression: IrReturn, validReturnTargets: Set<IrReturnTargetSymbol>): Appendable =
|
||||||
append("Illegal non-local return: The return target is ").declarationKindName(expression.returnTargetSymbol, capitalized = false)
|
append("Illegal non-local return: The return target is ")
|
||||||
append(" while only the following return targets are allowed: ")
|
.declarationKindName(expression.returnTargetSymbol, capitalized = false)
|
||||||
validReturnTargets.forEachIndexed { index, returnTarget ->
|
.append(" while only the following return targets are allowed: ")
|
||||||
if (index > 0) append(", ")
|
.sortedDeclarationsKindName(validReturnTargets)
|
||||||
declarationKindName(returnTarget, capitalized = false)
|
|
||||||
}
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun Appendable.inaccessibleDeclaration(
|
private fun Appendable.inaccessibleDeclaration(
|
||||||
referencedDeclarationSymbol: IrSymbol,
|
referencedDeclarationSymbol: IrSymbol,
|
||||||
|
|||||||
Reference in New Issue
Block a user