[Analysis API] render extra debug information for nested symbols if renders for outers
This commit is contained in:
+1
-1
@@ -28,7 +28,7 @@ abstract class AbstractAnalysisApiAnnotationsOnTypesTest : AbstractAnalysisApiSi
|
||||
appendLine("KtTypeReference: ${ktTypeReference.text}")
|
||||
appendLine("annotations: [")
|
||||
for (annotation in annotations) {
|
||||
appendLine(DebugSymbolRenderer.renderAnnotationApplication(annotation).indented(indent = 2))
|
||||
appendLine(DebugSymbolRenderer().renderAnnotationApplication(annotation).indented(indent = 2))
|
||||
}
|
||||
appendLine("]")
|
||||
}
|
||||
|
||||
+3
-1
@@ -5,15 +5,17 @@
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.impl.base.test.cases.annotations
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.annotations.KtAnnotationsList
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.DebugSymbolRenderer
|
||||
import org.jetbrains.kotlin.analysis.test.framework.utils.indented
|
||||
|
||||
object TestAnnotationRenderer {
|
||||
context (KtAnalysisSession)
|
||||
fun renderAnnotations(annotations: KtAnnotationsList) = buildString {
|
||||
appendLine("annotations: [")
|
||||
for (annotation in annotations.annotations) {
|
||||
appendLine(DebugSymbolRenderer.renderAnnotationApplication(annotation).indented(indent = 2))
|
||||
appendLine(DebugSymbolRenderer().renderAnnotationApplication(annotation).indented(indent = 2))
|
||||
}
|
||||
appendLine("]")
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ abstract class AbstractExpectedExpressionTypeTest : AbstractAnalysisApiSingleFil
|
||||
val actualExpectedTypeText: String? = executeOnPooledThreadInReadAction {
|
||||
analyseForTest(expressionAtCaret) {
|
||||
val expectedType = expressionAtCaret.getExpectedType() ?: return@analyseForTest null
|
||||
DebugSymbolRenderer.renderType(expectedType)
|
||||
DebugSymbolRenderer().renderType(expectedType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ internal fun KtAnalysisSession.stringRepresentation(any: Any): String = with(any
|
||||
is KtValueParameterSymbol -> "${if (isVararg) "vararg " else ""}$name: ${returnType.render()}"
|
||||
is KtTypeParameterSymbol -> this.nameOrAnonymous.asString()
|
||||
is KtVariableSymbol -> "${if (isVal) "val" else "var"} $name: ${returnType.render()}"
|
||||
is KtSymbol -> DebugSymbolRenderer.render(this)
|
||||
is KtSymbol -> DebugSymbolRenderer().render(this)
|
||||
is Boolean -> toString()
|
||||
is Map<*, *> -> if (isEmpty()) "{}" else entries.joinToString(
|
||||
separator = ",\n ",
|
||||
|
||||
+4
-4
@@ -19,12 +19,12 @@ abstract class AbstractFileScopeTest : AbstractAnalysisApiSingleFileTest() {
|
||||
analyseForTest(ktFile) {
|
||||
val symbol = ktFile.getFileSymbol()
|
||||
val scope = symbol.getFileScope()
|
||||
with(DebugSymbolRenderer) {
|
||||
val renderedSymbol = renderExtra(symbol)
|
||||
with(DebugSymbolRenderer(renderExtra = true)) {
|
||||
val renderedSymbol = render(symbol)
|
||||
val callableNames = scope.getPossibleCallableNames()
|
||||
val renderedCallables = scope.getCallableSymbols().map { renderExtra(it) }
|
||||
val renderedCallables = scope.getCallableSymbols().map { render(it) }
|
||||
val classifierNames = scope.getPossibleClassifierNames()
|
||||
val renderedClassifiers = scope.getClassifierSymbols().map { renderExtra(it) }
|
||||
val renderedClassifiers = scope.getClassifierSymbols().map { render(it) }
|
||||
|
||||
"FILE SYMBOL:\n" + renderedSymbol + "\n" +
|
||||
"\nCALLABLE NAMES:\n" + callableNames.joinToString(prefix = "[", postfix = "]\n", separator = ", ") +
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ abstract class AbstractSubstitutionOverridesUnwrappingTest : AbstractSymbolTest(
|
||||
}
|
||||
|
||||
override fun KtAnalysisSession.renderSymbolForComparison(symbol: KtSymbol): String {
|
||||
return with(DebugSymbolRenderer) { renderForSubstitutionOverrideUnwrappingTest(symbol) }
|
||||
return with(DebugSymbolRenderer()) { renderForSubstitutionOverrideUnwrappingTest(symbol) }
|
||||
}
|
||||
|
||||
override fun configureTest(builder: TestConfigurationBuilder) {
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ abstract class AbstractTypeScopeTest : AbstractAnalysisApiSingleFileTest() {
|
||||
val callables = scope.getCallableSymbols().toList()
|
||||
return prettyPrint {
|
||||
callables.forEach {
|
||||
appendLine(DebugSymbolRenderer.render(it))
|
||||
appendLine(DebugSymbolRenderer().render(it))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -79,7 +79,7 @@ abstract class AbstractSymbolTest : AbstractAnalysisApiSingleFileTest() {
|
||||
}
|
||||
}
|
||||
|
||||
is KtReceiverParameterSymbol -> DebugSymbolRenderer.render(symbol)
|
||||
is KtReceiverParameterSymbol -> DebugSymbolRenderer().render(symbol)
|
||||
else -> error(symbol::class.toString())
|
||||
}
|
||||
)
|
||||
@@ -147,7 +147,7 @@ abstract class AbstractSymbolTest : AbstractAnalysisApiSingleFileTest() {
|
||||
}
|
||||
|
||||
protected open fun KtAnalysisSession.renderSymbolForComparison(symbol: KtSymbol): String {
|
||||
return with(DebugSymbolRenderer) { renderExtra(symbol) }
|
||||
return with(DebugSymbolRenderer(renderExtra = true)) { render(symbol) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user