Fir: Print origin of the generated diagnostics
similar to other generated entities by now.
This commit is contained in:
committed by
Space Team
parent
1ad4f19181
commit
879f0eff71
@@ -7,6 +7,7 @@ plugins {
|
||||
dependencies {
|
||||
implementation(project(":generators"))
|
||||
implementation(project(":compiler:fir:tree"))
|
||||
implementation(project(":generators:tree-generator-common"))
|
||||
implementation(project(":compiler:fir:tree:tree-generator"))
|
||||
implementation(project(":compiler:resolution.common"))
|
||||
implementation(commonDependency("org.jetbrains.kotlin:kotlin-reflect")) { isTransitive = false }
|
||||
|
||||
+11
@@ -14,6 +14,9 @@ import kotlin.reflect.KType
|
||||
import kotlin.reflect.typeOf
|
||||
|
||||
abstract class DiagnosticList(internal val objectName: String) {
|
||||
|
||||
val diagnosticListDefinitionFQN = this::class.qualifiedName
|
||||
|
||||
@Suppress("PropertyName")
|
||||
@PrivateForInline
|
||||
val _groups = mutableListOf<AbstractDiagnosticGroup>()
|
||||
@@ -135,3 +138,11 @@ sealed class DiagnosticBuilder(
|
||||
const val MAX_DIAGNOSTIC_PARAMETER_COUNT = 4
|
||||
}
|
||||
}
|
||||
|
||||
fun DiagnosticList.extendedKDoc(defaultKDoc: String? = null): String = buildString {
|
||||
if (defaultKDoc != null) {
|
||||
appendLine(defaultKDoc)
|
||||
appendLine()
|
||||
}
|
||||
append("Generated from: [$diagnosticListDefinitionFQN]")
|
||||
}
|
||||
|
||||
+2
-1
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.checkers.generator.diagnostics.model
|
||||
import org.jetbrains.kotlin.fir.checkers.generator.*
|
||||
import org.jetbrains.kotlin.fir.checkers.generator.printCopyright
|
||||
import org.jetbrains.kotlin.fir.tree.generator.util.writeToFileUsingSmartPrinterIfFileContentChanged
|
||||
import org.jetbrains.kotlin.generators.tree.printer.printKDoc
|
||||
import org.jetbrains.kotlin.utils.SmartPrinter
|
||||
import java.io.File
|
||||
import kotlin.reflect.KClass
|
||||
@@ -39,7 +40,7 @@ object ErrorListDiagnosticListRenderer : DiagnosticListRenderer() {
|
||||
println("package $packageName")
|
||||
println()
|
||||
collectAndPrintImports(diagnosticList, packageName, starImportsToAdd)
|
||||
printGeneratedMessage()
|
||||
printKDoc(diagnosticList.extendedKDoc())
|
||||
printErrorsObject(diagnosticList)
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -22,11 +22,9 @@ import org.jetbrains.kotlin.psi.KtElement
|
||||
import org.jetbrains.kotlin.psi.KtExpression
|
||||
import org.jetbrains.kotlin.psi.KtParameter
|
||||
|
||||
/*
|
||||
* This file was generated automatically
|
||||
* DO NOT MODIFY IT MANUALLY
|
||||
/**
|
||||
* Generated from: [org.jetbrains.kotlin.fir.checkers.generator.diagnostics.JS_DIAGNOSTICS_LIST]
|
||||
*/
|
||||
|
||||
object FirJsErrors {
|
||||
// Annotations
|
||||
val WRONG_JS_QUALIFIER by error0<KtElement>()
|
||||
|
||||
+2
-4
@@ -25,11 +25,9 @@ import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtElement
|
||||
import org.jetbrains.kotlin.psi.KtExpression
|
||||
|
||||
/*
|
||||
* This file was generated automatically
|
||||
* DO NOT MODIFY IT MANUALLY
|
||||
/**
|
||||
* Generated from: [org.jetbrains.kotlin.fir.checkers.generator.diagnostics.JVM_DIAGNOSTICS_LIST]
|
||||
*/
|
||||
|
||||
object FirJvmErrors {
|
||||
// Declarations
|
||||
val OVERRIDE_CANNOT_BE_STATIC by error0<PsiElement>()
|
||||
|
||||
+2
-4
@@ -18,11 +18,9 @@ import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtElement
|
||||
|
||||
/*
|
||||
* This file was generated automatically
|
||||
* DO NOT MODIFY IT MANUALLY
|
||||
/**
|
||||
* Generated from: [org.jetbrains.kotlin.fir.checkers.generator.diagnostics.NATIVE_DIAGNOSTICS_LIST]
|
||||
*/
|
||||
|
||||
object FirNativeErrors {
|
||||
// All
|
||||
val THROWS_LIST_EMPTY by error0<KtElement>()
|
||||
|
||||
+2
-4
@@ -13,11 +13,9 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.*
|
||||
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||
import org.jetbrains.kotlin.psi.KtElement
|
||||
|
||||
/*
|
||||
* This file was generated automatically
|
||||
* DO NOT MODIFY IT MANUALLY
|
||||
/**
|
||||
* Generated from: [org.jetbrains.kotlin.fir.checkers.generator.diagnostics.WASM_DIAGNOSTICS_LIST]
|
||||
*/
|
||||
|
||||
object FirWasmErrors {
|
||||
// Externals
|
||||
val NON_EXTERNAL_TYPE_EXTENDS_EXTERNAL_TYPE by error1<KtElement, ConeKotlinType>(SourceElementPositioningStrategies.DECLARATION_SIGNATURE_OR_DEFAULT)
|
||||
|
||||
+2
-4
@@ -114,11 +114,9 @@ import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualCompatibility.Mism
|
||||
import org.jetbrains.kotlin.serialization.deserialization.IncompatibleVersionErrorData
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
|
||||
/*
|
||||
* This file was generated automatically
|
||||
* DO NOT MODIFY IT MANUALLY
|
||||
/**
|
||||
* Generated from: [org.jetbrains.kotlin.fir.checkers.generator.diagnostics.DIAGNOSTICS_LIST]
|
||||
*/
|
||||
|
||||
object FirErrors {
|
||||
// Meta-errors
|
||||
val UNSUPPORTED by error1<PsiElement, String>()
|
||||
|
||||
+2
-4
@@ -9,11 +9,9 @@ import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.diagnostics.*
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.RootDiagnosticRendererFactory
|
||||
|
||||
/*
|
||||
* This file was generated automatically
|
||||
* DO NOT MODIFY IT MANUALLY
|
||||
/**
|
||||
* Generated from: [org.jetbrains.kotlin.fir.builder.SYNTAX_DIAGNOSTIC_LIST]
|
||||
*/
|
||||
|
||||
object FirSyntaxErrors {
|
||||
// Syntax
|
||||
val SYNTAX by error1<PsiElement, String>()
|
||||
|
||||
Reference in New Issue
Block a user