Analysis API: adapt reference resolve tests to changes in renderer
This commit is contained in:
+15
-3
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.analysis.api.impl.barebone.test.expressionMarkerProv
|
|||||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.test.framework.AbstractHLApiSingleModuleTest
|
import org.jetbrains.kotlin.analysis.api.impl.base.test.test.framework.AbstractHLApiSingleModuleTest
|
||||||
import org.jetbrains.kotlin.analysis.api.symbols.*
|
import org.jetbrains.kotlin.analysis.api.symbols.*
|
||||||
import org.jetbrains.kotlin.analysis.api.symbols.markers.KtNamedSymbol
|
import org.jetbrains.kotlin.analysis.api.symbols.markers.KtNamedSymbol
|
||||||
|
import org.jetbrains.kotlin.analysis.api.symbols.markers.KtPossibleMemberSymbol
|
||||||
import org.jetbrains.kotlin.analysis.api.symbols.markers.KtSymbolWithKind
|
import org.jetbrains.kotlin.analysis.api.symbols.markers.KtSymbolWithKind
|
||||||
import org.jetbrains.kotlin.idea.references.KtReference
|
import org.jetbrains.kotlin.idea.references.KtReference
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
@@ -28,7 +29,8 @@ import org.jetbrains.kotlin.test.model.TestModule
|
|||||||
import org.jetbrains.kotlin.test.services.TestServices
|
import org.jetbrains.kotlin.test.services.TestServices
|
||||||
import org.jetbrains.kotlin.test.services.assertions
|
import org.jetbrains.kotlin.test.services.assertions
|
||||||
|
|
||||||
abstract class AbstractReferenceResolveTest(configurator: FrontendApiTestConfiguratorService) : AbstractHLApiSingleModuleTest(configurator) {
|
abstract class AbstractReferenceResolveTest(configurator: FrontendApiTestConfiguratorService) :
|
||||||
|
AbstractHLApiSingleModuleTest(configurator) {
|
||||||
override fun configureTest(builder: TestConfigurationBuilder) {
|
override fun configureTest(builder: TestConfigurationBuilder) {
|
||||||
super.configureTest(builder)
|
super.configureTest(builder)
|
||||||
with(builder) {
|
with(builder) {
|
||||||
@@ -48,7 +50,9 @@ abstract class AbstractReferenceResolveTest(configurator: FrontendApiTestConfigu
|
|||||||
}
|
}
|
||||||
|
|
||||||
val resolvedTo =
|
val resolvedTo =
|
||||||
analyseForTest(PsiTreeUtil.findElementOfClassAtOffset(mainKtFile, caretPosition, KtDeclaration::class.java, false) ?: mainKtFile) {
|
analyseForTest(
|
||||||
|
PsiTreeUtil.findElementOfClassAtOffset(mainKtFile, caretPosition, KtDeclaration::class.java, false) ?: mainKtFile
|
||||||
|
) {
|
||||||
val symbols = ktReferences.flatMap { it.resolveToSymbols() }
|
val symbols = ktReferences.flatMap { it.resolveToSymbols() }
|
||||||
checkReferenceResultForValidity(module, testServices, symbols)
|
checkReferenceResultForValidity(module, testServices, symbols)
|
||||||
renderResolvedTo(symbols)
|
renderResolvedTo(symbols)
|
||||||
@@ -91,7 +95,15 @@ abstract class AbstractReferenceResolveTest(configurator: FrontendApiTestConfigu
|
|||||||
symbolContainerFqName(symbol)?.let { fqName ->
|
symbolContainerFqName(symbol)?.let { fqName ->
|
||||||
append("(in $fqName) ")
|
append("(in $fqName) ")
|
||||||
}
|
}
|
||||||
append(symbol.render(renderingOptions))
|
when (symbol) {
|
||||||
|
is KtDeclarationSymbol -> append(symbol.render(renderingOptions))
|
||||||
|
is KtPackageSymbol -> append("package ${symbol.fqName}")
|
||||||
|
is KtReceiverParameterSymbol -> {
|
||||||
|
append("extension receiver with type ")
|
||||||
|
append(symbol.type.render(renderingOptions.typeRendererOptions))
|
||||||
|
}
|
||||||
|
else -> error("Unexpected symbol ${symbol::class}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
0: <T>
|
0: T
|
||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
0: <X>
|
0: X
|
||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
0: value-parameter vararg a: test.A
|
0: vararg a: test.A
|
||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
0: value-parameter vararg a: test.A
|
0: vararg a: test.A
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
0: value-parameter x: A
|
0: x: A
|
||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
0: value-parameter a: kotlin.Int
|
0: a: kotlin.Int
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
0: value-parameter a: () -> kotlin.Unit
|
0: a: () -> kotlin.Unit
|
||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
0: value-parameter a: A
|
0: a: A
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
0: value-parameter bb: kotlin.Int
|
0: bb: kotlin.Int
|
||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
0: extension receiver of fun kotlin.String.foo()
|
0: extension receiver with type kotlin.String
|
||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
0: extension receiver of val kotlin.String.foo: kotlin.Any
|
0: extension receiver with type kotlin.String
|
||||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
0: <K>
|
0: K
|
||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
0: <T : kotlin.Int & kotlin.Long>
|
0: T : kotlin.Int
|
||||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
0: <reified T>
|
0: reified T
|
||||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
0: <reified T : kotlin.Any>
|
0: reified T : kotlin.Any
|
||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
0: <reified T>
|
0: reified T
|
||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
0: <reified T>
|
0: reified T
|
||||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Resolved to:
|
Resolved to:
|
||||||
0: <reified T>
|
0: reified T
|
||||||
Reference in New Issue
Block a user