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 {
|
dependencies {
|
||||||
implementation(project(":generators"))
|
implementation(project(":generators"))
|
||||||
implementation(project(":compiler:fir:tree"))
|
implementation(project(":compiler:fir:tree"))
|
||||||
|
implementation(project(":generators:tree-generator-common"))
|
||||||
implementation(project(":compiler:fir:tree:tree-generator"))
|
implementation(project(":compiler:fir:tree:tree-generator"))
|
||||||
implementation(project(":compiler:resolution.common"))
|
implementation(project(":compiler:resolution.common"))
|
||||||
implementation(commonDependency("org.jetbrains.kotlin:kotlin-reflect")) { isTransitive = false }
|
implementation(commonDependency("org.jetbrains.kotlin:kotlin-reflect")) { isTransitive = false }
|
||||||
|
|||||||
+11
@@ -14,6 +14,9 @@ import kotlin.reflect.KType
|
|||||||
import kotlin.reflect.typeOf
|
import kotlin.reflect.typeOf
|
||||||
|
|
||||||
abstract class DiagnosticList(internal val objectName: String) {
|
abstract class DiagnosticList(internal val objectName: String) {
|
||||||
|
|
||||||
|
val diagnosticListDefinitionFQN = this::class.qualifiedName
|
||||||
|
|
||||||
@Suppress("PropertyName")
|
@Suppress("PropertyName")
|
||||||
@PrivateForInline
|
@PrivateForInline
|
||||||
val _groups = mutableListOf<AbstractDiagnosticGroup>()
|
val _groups = mutableListOf<AbstractDiagnosticGroup>()
|
||||||
@@ -135,3 +138,11 @@ sealed class DiagnosticBuilder(
|
|||||||
const val MAX_DIAGNOSTIC_PARAMETER_COUNT = 4
|
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.*
|
||||||
import org.jetbrains.kotlin.fir.checkers.generator.printCopyright
|
import org.jetbrains.kotlin.fir.checkers.generator.printCopyright
|
||||||
import org.jetbrains.kotlin.fir.tree.generator.util.writeToFileUsingSmartPrinterIfFileContentChanged
|
import org.jetbrains.kotlin.fir.tree.generator.util.writeToFileUsingSmartPrinterIfFileContentChanged
|
||||||
|
import org.jetbrains.kotlin.generators.tree.printer.printKDoc
|
||||||
import org.jetbrains.kotlin.utils.SmartPrinter
|
import org.jetbrains.kotlin.utils.SmartPrinter
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
@@ -39,7 +40,7 @@ object ErrorListDiagnosticListRenderer : DiagnosticListRenderer() {
|
|||||||
println("package $packageName")
|
println("package $packageName")
|
||||||
println()
|
println()
|
||||||
collectAndPrintImports(diagnosticList, packageName, starImportsToAdd)
|
collectAndPrintImports(diagnosticList, packageName, starImportsToAdd)
|
||||||
printGeneratedMessage()
|
printKDoc(diagnosticList.extendedKDoc())
|
||||||
printErrorsObject(diagnosticList)
|
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.KtExpression
|
||||||
import org.jetbrains.kotlin.psi.KtParameter
|
import org.jetbrains.kotlin.psi.KtParameter
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* This file was generated automatically
|
* Generated from: [org.jetbrains.kotlin.fir.checkers.generator.diagnostics.JS_DIAGNOSTICS_LIST]
|
||||||
* DO NOT MODIFY IT MANUALLY
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
object FirJsErrors {
|
object FirJsErrors {
|
||||||
// Annotations
|
// Annotations
|
||||||
val WRONG_JS_QUALIFIER by error0<KtElement>()
|
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.KtElement
|
||||||
import org.jetbrains.kotlin.psi.KtExpression
|
import org.jetbrains.kotlin.psi.KtExpression
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* This file was generated automatically
|
* Generated from: [org.jetbrains.kotlin.fir.checkers.generator.diagnostics.JVM_DIAGNOSTICS_LIST]
|
||||||
* DO NOT MODIFY IT MANUALLY
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
object FirJvmErrors {
|
object FirJvmErrors {
|
||||||
// Declarations
|
// Declarations
|
||||||
val OVERRIDE_CANNOT_BE_STATIC by error0<PsiElement>()
|
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.KtDeclaration
|
||||||
import org.jetbrains.kotlin.psi.KtElement
|
import org.jetbrains.kotlin.psi.KtElement
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* This file was generated automatically
|
* Generated from: [org.jetbrains.kotlin.fir.checkers.generator.diagnostics.NATIVE_DIAGNOSTICS_LIST]
|
||||||
* DO NOT MODIFY IT MANUALLY
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
object FirNativeErrors {
|
object FirNativeErrors {
|
||||||
// All
|
// All
|
||||||
val THROWS_LIST_EMPTY by error0<KtElement>()
|
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.fir.types.ConeKotlinType
|
||||||
import org.jetbrains.kotlin.psi.KtElement
|
import org.jetbrains.kotlin.psi.KtElement
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* This file was generated automatically
|
* Generated from: [org.jetbrains.kotlin.fir.checkers.generator.diagnostics.WASM_DIAGNOSTICS_LIST]
|
||||||
* DO NOT MODIFY IT MANUALLY
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
object FirWasmErrors {
|
object FirWasmErrors {
|
||||||
// Externals
|
// Externals
|
||||||
val NON_EXTERNAL_TYPE_EXTENDS_EXTERNAL_TYPE by error1<KtElement, ConeKotlinType>(SourceElementPositioningStrategies.DECLARATION_SIGNATURE_OR_DEFAULT)
|
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.serialization.deserialization.IncompatibleVersionErrorData
|
||||||
import org.jetbrains.kotlin.types.Variance
|
import org.jetbrains.kotlin.types.Variance
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* This file was generated automatically
|
* Generated from: [org.jetbrains.kotlin.fir.checkers.generator.diagnostics.DIAGNOSTICS_LIST]
|
||||||
* DO NOT MODIFY IT MANUALLY
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
object FirErrors {
|
object FirErrors {
|
||||||
// Meta-errors
|
// Meta-errors
|
||||||
val UNSUPPORTED by error1<PsiElement, String>()
|
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.*
|
||||||
import org.jetbrains.kotlin.diagnostics.rendering.RootDiagnosticRendererFactory
|
import org.jetbrains.kotlin.diagnostics.rendering.RootDiagnosticRendererFactory
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* This file was generated automatically
|
* Generated from: [org.jetbrains.kotlin.fir.builder.SYNTAX_DIAGNOSTIC_LIST]
|
||||||
* DO NOT MODIFY IT MANUALLY
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
object FirSyntaxErrors {
|
object FirSyntaxErrors {
|
||||||
// Syntax
|
// Syntax
|
||||||
val SYNTAX by error1<PsiElement, String>()
|
val SYNTAX by error1<PsiElement, String>()
|
||||||
|
|||||||
Reference in New Issue
Block a user