[Analysis API FIR] fix containing declaration for value parameter
now it should also work for non-source declarations
This commit is contained in:
+13
@@ -152,6 +152,7 @@ internal fun KtAnalysisSession.compareCalls(call1: KtCall, call2: KtCall): Int {
|
||||
context(KtAnalysisSession)
|
||||
internal fun renderScopeWithParentDeclarations(scope: KtScope): String = prettyPrint {
|
||||
fun KtSymbol.qualifiedNameString() = when (this) {
|
||||
is KtConstructorSymbol -> "<constructor> ${containingClassIdIfNonLocal?.asString()}"
|
||||
is KtClassLikeSymbol -> classIdIfNonLocal!!.asString()
|
||||
is KtCallableSymbol -> callableIdIfNonLocal!!.toString()
|
||||
else -> error("unknown symbol $this")
|
||||
@@ -179,5 +180,17 @@ internal fun renderScopeWithParentDeclarations(scope: KtScope): String = prettyP
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (symbol is KtFunctionLikeSymbol && symbol.valueParameters.isNotEmpty()) {
|
||||
appendLine()
|
||||
withIndent {
|
||||
printCollection(symbol.valueParameters, separator = "\n") { typeParameter ->
|
||||
val containingDeclarationForValueParameter = typeParameter.getContainingSymbol()
|
||||
append(typeParameter.render(renderingOptions))
|
||||
append(" from ")
|
||||
append(containingDeclarationForValueParameter?.qualifiedNameString())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user