[FIR] Remove useless type parameters from classes related to diagnostics
Generics removed from: - FirPsiSourceElement - FirDiagnostic - FirDiagnosticRenderer - FirDiagnosticFactory
This commit is contained in:
+2
-3
@@ -42,7 +42,6 @@ import org.jetbrains.kotlin.resolve.AnalyzingUtils
|
||||
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
abstract class AbstractFirBaseDiagnosticsTest : BaseDiagnosticsTest() {
|
||||
override fun analyzeAndCheck(testDataFile: File, files: List<TestFile>) {
|
||||
@@ -219,7 +218,7 @@ abstract class AbstractFirBaseDiagnosticsTest : BaseDiagnosticsTest() {
|
||||
}
|
||||
|
||||
protected fun TestFile.getActualText(
|
||||
firDiagnostics: Iterable<FirDiagnostic<*>>,
|
||||
firDiagnostics: Iterable<FirDiagnostic>,
|
||||
actualText: StringBuilder
|
||||
): Boolean {
|
||||
val ktFile = this.ktFile
|
||||
@@ -331,7 +330,7 @@ abstract class AbstractFirBaseDiagnosticsTest : BaseDiagnosticsTest() {
|
||||
return ok[0]
|
||||
}
|
||||
|
||||
private fun Iterable<FirDiagnostic<*>>.toActualDiagnostic(root: PsiElement): List<ActualDiagnostic> {
|
||||
private fun Iterable<FirDiagnostic>.toActualDiagnostic(root: PsiElement): List<ActualDiagnostic> {
|
||||
val result = mutableListOf<ActualDiagnostic>()
|
||||
filterIsInstance<Diagnostic>().mapTo(result) {
|
||||
ActualDiagnostic(it, null, true)
|
||||
|
||||
@@ -117,7 +117,7 @@ abstract class AbstractFirDiagnosticsTest : AbstractFirBaseDiagnosticsTest() {
|
||||
for (testFile in testFiles) {
|
||||
val firFile = firFiles.firstOrNull { it.psi == testFile.ktFile }
|
||||
if (firFile != null) {
|
||||
val debugInfoDiagnostics: List<FirDiagnostic<*>> =
|
||||
val debugInfoDiagnostics: List<FirDiagnostic> =
|
||||
collectDebugInfoDiagnostics(firFile, testFile.diagnosedRangesToDiagnosticNames)
|
||||
testFile.getActualText(
|
||||
diagnostics.getValue(firFile) + debugInfoDiagnostics,
|
||||
@@ -134,8 +134,8 @@ abstract class AbstractFirDiagnosticsTest : AbstractFirBaseDiagnosticsTest() {
|
||||
protected fun collectDebugInfoDiagnostics(
|
||||
firFile: FirFile,
|
||||
diagnosedRangesToDiagnosticNames: MutableMap<IntRange, MutableSet<String>>
|
||||
): List<FirDiagnostic<*>> {
|
||||
val result = mutableListOf<FirDiagnostic<*>>()
|
||||
): List<FirDiagnostic> {
|
||||
val result = mutableListOf<FirDiagnostic>()
|
||||
|
||||
|
||||
object : FirDefaultVisitorVoid() {
|
||||
@@ -166,7 +166,7 @@ abstract class AbstractFirDiagnosticsTest : AbstractFirBaseDiagnosticsTest() {
|
||||
fun createExpressionTypeDiagnosticIfExpected(
|
||||
element: FirExpression,
|
||||
diagnosedRangesToDiagnosticNames: MutableMap<IntRange, MutableSet<String>>
|
||||
): FirDiagnosticWithParameters1<FirSourceElement, String>? =
|
||||
): FirDiagnosticWithParameters1<String>? =
|
||||
DebugInfoDiagnosticFactory1.EXPRESSION_TYPE.createDebugInfoDiagnostic(element, diagnosedRangesToDiagnosticNames) {
|
||||
element.typeRef.renderAsString((element as? FirExpressionWithSmartcast)?.originalType)
|
||||
}
|
||||
@@ -183,7 +183,7 @@ abstract class AbstractFirDiagnosticsTest : AbstractFirBaseDiagnosticsTest() {
|
||||
element: FirElement,
|
||||
reference: FirNamedReference,
|
||||
diagnosedRangesToDiagnosticNames: MutableMap<IntRange, MutableSet<String>>
|
||||
): FirDiagnosticWithParameters1<FirSourceElement, String>? =
|
||||
): FirDiagnosticWithParameters1<String>? =
|
||||
DebugInfoDiagnosticFactory1.CALL.createDebugInfoDiagnostic(element, diagnosedRangesToDiagnosticNames) {
|
||||
|
||||
val resolvedSymbol = (reference as? FirResolvedNamedReference)?.resolvedSymbol
|
||||
@@ -195,7 +195,7 @@ abstract class AbstractFirDiagnosticsTest : AbstractFirBaseDiagnosticsTest() {
|
||||
element: FirElement,
|
||||
diagnosedRangesToDiagnosticNames: MutableMap<IntRange, MutableSet<String>>,
|
||||
argument: () -> String,
|
||||
): FirDiagnosticWithParameters1<FirSourceElement, String>? {
|
||||
): FirDiagnosticWithParameters1<String>? {
|
||||
val sourceElement = element.source ?: return null
|
||||
val sourceKind = sourceElement.kind
|
||||
if (sourceKind !in allowedKindsForDebugInfo) {
|
||||
@@ -211,7 +211,7 @@ abstract class AbstractFirDiagnosticsTest : AbstractFirBaseDiagnosticsTest() {
|
||||
|
||||
val argumentText = argument()
|
||||
return when (sourceElement) {
|
||||
is FirPsiSourceElement<*> -> FirPsiDiagnosticWithParameters1(
|
||||
is FirPsiSourceElement -> FirPsiDiagnosticWithParameters1(
|
||||
sourceElement,
|
||||
argumentText,
|
||||
severity,
|
||||
@@ -264,9 +264,9 @@ abstract class AbstractFirDiagnosticsTest : AbstractFirBaseDiagnosticsTest() {
|
||||
}
|
||||
|
||||
|
||||
protected fun collectDiagnostics(firFiles: List<FirFile>): Map<FirFile, List<FirDiagnostic<*>>> {
|
||||
protected fun collectDiagnostics(firFiles: List<FirFile>): Map<FirFile, List<FirDiagnostic>> {
|
||||
val collectors = mutableMapOf<FirSession, AbstractDiagnosticCollector>()
|
||||
val result = mutableMapOf<FirFile, List<FirDiagnostic<*>>>()
|
||||
val result = mutableMapOf<FirFile, List<FirDiagnostic>>()
|
||||
for (firFile in firFiles) {
|
||||
val session = firFile.moduleData.session
|
||||
val collector = collectors.computeIfAbsent(session) { createCollector(session) }
|
||||
|
||||
Reference in New Issue
Block a user