[FIR] Render full declaration header in diagnostic messages
This commit is contained in:
committed by
teamcity
parent
2fa6425965
commit
23af5510a6
+1
-1
@@ -70,4 +70,4 @@ KtErrorCallInfo:
|
||||
symbol = c: kotlin.String)
|
||||
}
|
||||
]
|
||||
diagnostic = ERROR<NONE_APPLICABLE: None of the following functions are applicable: [/function, /function, /function]>
|
||||
diagnostic = ERROR<NONE_APPLICABLE: None of the following functions are applicable: [public final fun function(a: R|kotlin/Char|): R|kotlin/Unit|, public final fun function(b: R|kotlin/Boolean|): R|kotlin/Unit|, public final fun function(c: R|kotlin/String|): R|kotlin/Unit|]>
|
||||
|
||||
Vendored
+1
-1
@@ -39,4 +39,4 @@ KtErrorCallInfo:
|
||||
]
|
||||
argumentMapping = {}
|
||||
]
|
||||
diagnostic = ERROR<NONE_APPLICABLE: None of the following functions are applicable: [<local>/invoke, <local>/invoke]>
|
||||
diagnostic = ERROR<NONE_APPLICABLE: None of the following functions are applicable: [local final operator fun R|kotlin/Int|.invoke(a: R|kotlin/String|): R|kotlin/Unit|, local final operator fun R|kotlin/Int|.invoke(b: R|kotlin/Boolean|): R|kotlin/Unit|]>
|
||||
|
||||
+1
-1
@@ -85,4 +85,4 @@ KtErrorCallInfo:
|
||||
symbol = v: V)
|
||||
}
|
||||
]
|
||||
diagnostic = ERROR<NONE_APPLICABLE: None of the following functions are applicable: [/function, /function, /function]>
|
||||
diagnostic = ERROR<NONE_APPLICABLE: None of the following functions are applicable: [public final fun <T> function(t: R|T|, a: R|kotlin/Char|): R|kotlin/Unit|, public final fun <U> function(u: R|U|, b: R|kotlin/Boolean|): R|kotlin/Unit|, public final fun <V> function(v: R|V|, c: R|kotlin/String|): R|kotlin/Unit|]>
|
||||
|
||||
+1
-1
@@ -85,4 +85,4 @@ KtErrorCallInfo:
|
||||
symbol = v: V)
|
||||
}
|
||||
]
|
||||
diagnostic = ERROR<NONE_APPLICABLE: None of the following functions are applicable: [/function, /function, /function]>
|
||||
diagnostic = ERROR<NONE_APPLICABLE: None of the following functions are applicable: [public final fun <T> function(t: R|T|, a: R|kotlin/Char|): R|kotlin/Unit|, public final fun <U> function(u: R|U|, b: R|kotlin/Boolean|): R|kotlin/Unit|, public final fun <V> function(v: R|V|, c: R|kotlin/String|): R|kotlin/Unit|]>
|
||||
|
||||
+1
-1
@@ -40,4 +40,4 @@ KtErrorCallInfo:
|
||||
]
|
||||
argumentMapping = {}
|
||||
]
|
||||
diagnostic = ERROR<NONE_APPLICABLE: None of the following functions are applicable: [/Sub.Sub, /Sub.Sub]>
|
||||
diagnostic = ERROR<NONE_APPLICABLE: None of the following functions are applicable: [public constructor(p: R|kotlin/Int|): R|Sub|, public constructor(i: R|kotlin/Int|, j: R|kotlin/Int|): R|Sub|]>
|
||||
|
||||
+1
-1
@@ -12,4 +12,4 @@ KtErrorCallInfo:
|
||||
valueParameters = []
|
||||
argumentMapping = {}
|
||||
]
|
||||
diagnostic = ERROR<INVISIBLE_REFERENCE: Symbol /Obj.Obj is invisible>
|
||||
diagnostic = ERROR<INVISIBLE_REFERENCE: Symbol private constructor(): R|Obj| is invisible>
|
||||
|
||||
+1
-1
@@ -14,4 +14,4 @@ KtErrorCallInfo:
|
||||
valueParameters = []
|
||||
argumentMapping = {}
|
||||
]
|
||||
diagnostic = ERROR<INVISIBLE_REFERENCE: Symbol /A.foo is invisible>
|
||||
diagnostic = ERROR<INVISIBLE_REFERENCE: Symbol private final fun foo(): R|kotlin/Unit| is invisible>
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [/invoke]>
|
||||
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [public final operator fun R|kotlin/Double|.invoke(): R|kotlin/Unit|]>
|
||||
candidate = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = true
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
@@ -32,7 +32,7 @@ KtApplicableCallCandidateInfo:
|
||||
isInBestCandidates = true
|
||||
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [/invoke]>
|
||||
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [public final operator fun R|kotlin/Long|.invoke(): R|kotlin/Double|]>
|
||||
candidate = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = true
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [/invoke]>
|
||||
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [public final operator fun R|kotlin/Double|.invoke(): R|kotlin/Unit|]>
|
||||
candidate = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = true
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
@@ -16,7 +16,7 @@ KtInapplicableCallCandidateInfo:
|
||||
isInBestCandidates = false
|
||||
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [/invoke]>
|
||||
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [public final operator fun R|kotlin/Int|.invoke(): R|kotlin/Long|]>
|
||||
candidate = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = true
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@ KtApplicableCallCandidateInfo:
|
||||
isInBestCandidates = true
|
||||
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [/invoke]>
|
||||
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [public final operator fun R|kotlin/Int|.invoke(): R|kotlin/Long|]>
|
||||
candidate = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = true
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
@@ -32,7 +32,7 @@ KtInapplicableCallCandidateInfo:
|
||||
isInBestCandidates = false
|
||||
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [/invoke]>
|
||||
diagnostic = ERROR<UNRESOLVED_REFERENCE_WRONG_RECEIVER: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: [public final operator fun R|kotlin/Long|.invoke(): R|kotlin/Double|]>
|
||||
candidate = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = true
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<INVISIBLE_REFERENCE: Symbol /Obj.Obj is invisible>
|
||||
diagnostic = ERROR<INVISIBLE_REFERENCE: Symbol private constructor(): R|Obj| is invisible>
|
||||
candidate = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<INVISIBLE_REFERENCE: Symbol /A.foo is invisible>
|
||||
diagnostic = ERROR<INVISIBLE_REFERENCE: Symbol private final fun foo(): R|kotlin/Unit| is invisible>
|
||||
candidate = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
|
||||
+3
-2
@@ -23,10 +23,11 @@ import org.jetbrains.kotlin.fir.types.render
|
||||
import org.jetbrains.kotlin.name.CallableId
|
||||
|
||||
object FirDiagnosticRenderers {
|
||||
@OptIn(SymbolInternals::class)
|
||||
val SYMBOL = Renderer { symbol: FirBasedSymbol<*> ->
|
||||
when (symbol) {
|
||||
is FirClassLikeSymbol<*> -> symbol.classId.asString()
|
||||
is FirCallableSymbol<*> -> symbol.callableId.toString()
|
||||
is FirClassLikeSymbol<*>,
|
||||
is FirCallableSymbol<*> -> symbol.fir.render(FirRenderer.RenderMode.DeclarationHeader)
|
||||
is FirTypeParameterSymbol -> symbol.name.asString()
|
||||
else -> "???"
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ open class FirRenderer(builder: StringBuilder, protected val mode: RenderMode =
|
||||
val renderDeclarationAttributes: Boolean = false,
|
||||
val renderDeclarationOrigin: Boolean = false,
|
||||
val renderPackageDirective: Boolean = false,
|
||||
val renderNestedDeclarations: Boolean = true,
|
||||
val renderDefaultParameterValues: Boolean = true,
|
||||
) {
|
||||
companion object {
|
||||
val Normal = RenderMode(
|
||||
@@ -109,6 +111,21 @@ open class FirRenderer(builder: StringBuilder, protected val mode: RenderMode =
|
||||
renderPropertyAccessors = false,
|
||||
)
|
||||
|
||||
val DeclarationHeader = RenderMode(
|
||||
renderLambdaBodies = false,
|
||||
renderCallArguments = false,
|
||||
renderCallableFqNames = false,
|
||||
renderDeclarationResolvePhase = false,
|
||||
renderAnnotation = true,
|
||||
renderBodies = false,
|
||||
renderPropertyAccessors = false,
|
||||
renderDeclarationAttributes = false,
|
||||
renderDeclarationOrigin = false,
|
||||
renderPackageDirective = false,
|
||||
renderNestedDeclarations = false,
|
||||
renderDefaultParameterValues = false,
|
||||
)
|
||||
|
||||
val WithDeclarationAttributes = RenderMode(
|
||||
renderLambdaBodies = true,
|
||||
renderCallArguments = true,
|
||||
@@ -477,7 +494,9 @@ open class FirRenderer(builder: StringBuilder, protected val mode: RenderMode =
|
||||
}
|
||||
|
||||
protected open fun renderClassDeclarations(regularClass: FirRegularClass) {
|
||||
regularClass.declarations.renderDeclarations()
|
||||
if (mode.renderNestedDeclarations) {
|
||||
regularClass.declarations.renderDeclarations()
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitEnumEntry(enumEntry: FirEnumEntry) {
|
||||
@@ -584,7 +603,7 @@ open class FirRenderer(builder: StringBuilder, protected val mode: RenderMode =
|
||||
constructor.returnTypeRef.accept(this)
|
||||
val body = constructor.body
|
||||
val delegatedConstructor = constructor.delegatedConstructor
|
||||
if (body == null) {
|
||||
if (body == null && mode.renderBodies) {
|
||||
if (delegatedConstructor != null) {
|
||||
renderInBraces {
|
||||
delegatedConstructor.accept(this)
|
||||
@@ -740,7 +759,11 @@ open class FirRenderer(builder: StringBuilder, protected val mode: RenderMode =
|
||||
valueParameter.returnTypeRef.accept(this)
|
||||
valueParameter.defaultValue?.let {
|
||||
print(" = ")
|
||||
it.accept(this)
|
||||
if (mode.renderDefaultParameterValues) {
|
||||
it.accept(this)
|
||||
} else {
|
||||
print("...")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,10 @@ compiler or generated code. Use it at your own risk!
|
||||
warning: ATTENTION!
|
||||
This build uses in-dev FIR:
|
||||
-Xuse-fir
|
||||
compiler/testData/cli/jvm/firMultiplatformCompilationWithError/jvm.kt:1:18: error: actual class 'A' has no corresponding members for expected class members:
|
||||
compiler/testData/cli/jvm/firMultiplatformCompilationWithError/jvm.kt:1:18: error: actual class 'public abstract actual interface A : R|kotlin/Any|' has no corresponding members for expected class members:
|
||||
|
||||
public abstract expect fun foo(): R|kotlin/Unit|
|
||||
|
||||
/A.foo
|
||||
|
||||
actual interface A
|
||||
^
|
||||
|
||||
Reference in New Issue
Block a user