[FIR IDE] Compare error types consistently in test data

Use the fixed error type description so test data can be shared
across both frontends.
This commit is contained in:
Yan Zhulanow
2021-11-02 01:16:59 +09:00
parent bba53aa967
commit d6b9b8bdd4
4 changed files with 8 additions and 6 deletions
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.analysis.api.impl.base.test.components
import org.jetbrains.kotlin.analysis.api.impl.barebone.test.FrontendApiTestConfiguratorService
import org.jetbrains.kotlin.analysis.api.impl.barebone.test.expressionMarkerProvider
import org.jetbrains.kotlin.analysis.api.impl.base.test.test.framework.AbstractHLApiSingleFileTest
import org.jetbrains.kotlin.analysis.api.symbols.DebugSymbolRenderer
import org.jetbrains.kotlin.psi.KtExpression
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.model.TestModule
@@ -24,7 +25,8 @@ abstract class AbstractExpectedExpressionTypeTest(
val actualExpectedTypeText: String? = executeOnPooledThreadInReadAction {
analyseForTest(expressionAtCaret) {
expressionAtCaret.getExpectedType()?.asStringForDebugging()
val expectedType = expressionAtCaret.getExpectedType() ?: return@analyseForTest null
DebugSymbolRenderer.renderType(expectedType)
}
}
@@ -21,9 +21,9 @@ import kotlin.reflect.full.declaredMemberExtensionProperties
import kotlin.reflect.full.extensionReceiverParameter
public object DebugSymbolRenderer {
public fun render(symbol: KtSymbol): String = Block().apply {
renderSymbol(symbol)
}.toString()
public fun render(symbol: KtSymbol): String = Block().apply { renderSymbol(symbol) }.toString()
public fun renderType(type: KtType): String = Block().apply { renderType(type) }.toString()
public fun KtAnalysisSession.renderExtra(symbol: KtSymbol): String = Block().apply {
renderSymbol(symbol)
@@ -1,2 +1,2 @@
expression: av
expected type: ERROR CLASS: Unresolved name: av
expected type: ERROR_TYPE
@@ -1,2 +1,2 @@
expression: av
expected type: ERROR CLASS: Unresolved name: av
expected type: ERROR_TYPE