[Analysis API FIR] fix containing declaration for value parameter
now it should also work for non-source declarations
This commit is contained in:
+1
-2
@@ -54,8 +54,7 @@ internal class KtFirSymbolContainingDeclarationProvider(
|
||||
}
|
||||
|
||||
is KtValueParameterSymbol -> {
|
||||
// todo that does not work for parameters not from source, corresponding info should be added to the fir tree
|
||||
getParentSymbolByPsi()
|
||||
firSymbolBuilder.callableBuilder.buildCallableSymbol(symbol.firSymbol.fir.containingFunctionSymbol)
|
||||
}
|
||||
|
||||
is KtCallableSymbol -> {
|
||||
|
||||
+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())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -4,4 +4,5 @@ fun y() fromClass BB
|
||||
|
||||
val c: Int fromClass BB
|
||||
|
||||
constructor(a: A<Int>) fromClass BB
|
||||
constructor(a: A<Int>) fromClass BB
|
||||
a: A<Int> from <constructor> BB
|
||||
+1
@@ -2,6 +2,7 @@ fun <T> foo() fromClass Y
|
||||
T from /Y.foo
|
||||
|
||||
fun equals(other: Any?): Boolean fromClass kotlin/Any
|
||||
other: Any? from kotlin/Any.equals
|
||||
|
||||
fun hashCode(): Int fromClass kotlin/Any
|
||||
|
||||
|
||||
+3
@@ -1,13 +1,16 @@
|
||||
fun <S> foo1(t: Int): Int fromClass Y
|
||||
S from /Y.foo1
|
||||
t: Int from /Y.foo1
|
||||
|
||||
fun <Q> foo2(t: Int) fromClass Y
|
||||
Q from /Y.foo2
|
||||
t: Int from /Y.foo2
|
||||
|
||||
fun <U> foo3() fromClass X
|
||||
U from /X.foo3
|
||||
|
||||
fun equals(other: Any?): Boolean fromClass kotlin/Any
|
||||
other: Any? from kotlin/Any.equals
|
||||
|
||||
fun hashCode(): Int fromClass kotlin/Any
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -4,4 +4,4 @@ var prop: kotlin.Int
|
||||
@GetAnnotation
|
||||
get()
|
||||
@SetAnnotation
|
||||
set(@setparam:SetparamAnnotation value: kotlin.Int)
|
||||
set(@SetparamAnnotation value: kotlin.Int)
|
||||
Reference in New Issue
Block a user