[FIR] Print operator keyword and token to unresolved diagnostic message
#KT-55672 Fixed
This commit is contained in:
committed by
Space Team
parent
85bb7faf10
commit
c30ce4aabe
+1
@@ -296,6 +296,7 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
add(FirErrors.UNRESOLVED_REFERENCE) { firDiagnostic ->
|
||||
UnresolvedReferenceImpl(
|
||||
firDiagnostic.a,
|
||||
firDiagnostic.b,
|
||||
firDiagnostic as KtPsiDiagnostic,
|
||||
token,
|
||||
)
|
||||
|
||||
+1
@@ -251,6 +251,7 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
interface UnresolvedReference : KtFirDiagnostic<PsiElement> {
|
||||
override val diagnosticClass get() = UnresolvedReference::class
|
||||
val reference: String
|
||||
val operator: String?
|
||||
}
|
||||
|
||||
interface UnresolvedLabel : KtFirDiagnostic<PsiElement> {
|
||||
|
||||
+1
@@ -285,6 +285,7 @@ internal class InvisibleReferenceImpl(
|
||||
|
||||
internal class UnresolvedReferenceImpl(
|
||||
override val reference: String,
|
||||
override val operator: String?,
|
||||
firDiagnostic: KtPsiDiagnostic,
|
||||
token: KtLifetimeToken,
|
||||
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.UnresolvedReference
|
||||
|
||||
+1
-1
@@ -13,6 +13,6 @@ FILE: [ResolvedTo(IMPORTS)] arrayIndexExpressionWithInc.kt
|
||||
[ResolvedTo(BODY_RESOLVE)] lval <array>: <ERROR TYPE REF: Unresolved name: ArrayList> = R|<local>/a|
|
||||
[ResolvedTo(BODY_RESOLVE)] lval <index_0>: R|kotlin/Int| = Int(0)
|
||||
[ResolvedTo(BODY_RESOLVE)] lval <unary>: <ERROR TYPE REF: Unresolved name: get> = R|<local>/<array>|.<Unresolved name: get>#(R|<local>/<index_0>|)
|
||||
R|<local>/<array>|.<Unresolved name: set>#(R|<local>/<index_0>|, R|<local>/<unary>|.<Unresolved name: inc>#())
|
||||
R|<local>/<array>|.<Unresolved name: set>#(R|<local>/<index_0>|, R|<local>/<unary>|.<Unresolved name: inc (++)>#())
|
||||
R|<local>/<unary>|
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -13,6 +13,6 @@ FILE: [ResolvedTo(IMPORTS)] arrayIndexExpressionWithInc.kt
|
||||
[ResolvedTo(BODY_RESOLVE)] lval <array>: R|java/util/ArrayList<kotlin/String>| = R|<local>/a|
|
||||
[ResolvedTo(BODY_RESOLVE)] lval <index_0>: R|kotlin/Int| = Int(0)
|
||||
[ResolvedTo(BODY_RESOLVE)] lval <unary>: R|kotlin/String| = R|<local>/<array>|.R|SubstitutionOverride<java/util/ArrayList.get: R|@EnhancedNullability kotlin/String|>|(R|<local>/<index_0>|)
|
||||
R|<local>/<array>|.R|SubstitutionOverride<java/util/ArrayList.set: R|@EnhancedNullability kotlin/String|>|(R|<local>/<index_0>|, R|<local>/<unary>|.<Unresolved name: inc>#())
|
||||
R|<local>/<array>|.R|SubstitutionOverride<java/util/ArrayList.set: R|@EnhancedNullability kotlin/String|>|(R|<local>/<index_0>|, R|<local>/<unary>|.<Unresolved name: inc (++)>#())
|
||||
R|<local>/<unary>|
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -17,6 +17,6 @@ FILE: [ResolvedTo(IMPORTS)] arrayIndexExpressionWithIncScript.kts
|
||||
[ResolvedTo(BODY_RESOLVE)] lval <array>: R|java/util/ArrayList<kotlin/String>| = R|<local>/a|
|
||||
[ResolvedTo(BODY_RESOLVE)] lval <index_0>: R|kotlin/Int| = Int(0)
|
||||
[ResolvedTo(BODY_RESOLVE)] lval <unary>: R|kotlin/String| = R|<local>/<array>|.R|SubstitutionOverride<java/util/ArrayList.get: R|@EnhancedNullability kotlin/String|>|(R|<local>/<index_0>|)
|
||||
R|<local>/<array>|.R|SubstitutionOverride<java/util/ArrayList.set: R|@EnhancedNullability kotlin/String|>|(R|<local>/<index_0>|, R|<local>/<unary>|.<Unresolved name: inc>#())
|
||||
R|<local>/<array>|.R|SubstitutionOverride<java/util/ArrayList.set: R|@EnhancedNullability kotlin/String|>|(R|<local>/<index_0>|, R|<local>/<unary>|.<Unresolved name: inc (++)>#())
|
||||
R|<local>/<unary>|
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ FILE: [ResolvedTo(IMPORTS)] qualifiedPartOfQualifiedCallUnresolved.kt
|
||||
{
|
||||
[ResolvedTo(BODY_RESOLVE)] lval <receiver>: R|ERROR CLASS: Unresolved name: peek| = <Unresolved name: peek>#()
|
||||
[ResolvedTo(BODY_RESOLVE)] lval <unary>: <ERROR TYPE REF: Unresolved name: braceBalance> = R|<local>/<receiver>|.<Unresolved name: braceBalance>#
|
||||
R|<local>/<receiver>|.<Unresolved name: braceBalance># = R|<local>/<unary>|.<Unresolved name: inc>#()
|
||||
R|<local>/<receiver>|.<Unresolved name: braceBalance># = R|<local>/<unary>|.<Unresolved name: inc (++)>#()
|
||||
R|<local>/<unary>|
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -20,10 +20,10 @@ FILE: [ResolvedTo(IMPORTS)] qualifiedPartOfQualifiedCallUnresolvedScript.kts
|
||||
{
|
||||
[ResolvedTo(BODY_RESOLVE)] lval <receiver>: R|ERROR CLASS: Unresolved name: peek| = <Unresolved name: peek>#()
|
||||
[ResolvedTo(BODY_RESOLVE)] lval <unary>: <ERROR TYPE REF: Unresolved name: braceBalance> = R|<local>/<receiver>|.<Unresolved name: braceBalance>#
|
||||
R|<local>/<receiver>|.<Unresolved name: braceBalance># = R|<local>/<unary>|.<Unresolved name: inc>#()
|
||||
R|<local>/<receiver>|.<Unresolved name: braceBalance># = R|<local>/<unary>|.<Unresolved name: inc (++)>#()
|
||||
R|<local>/<unary>|
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -23958,6 +23958,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/operatorsOverloading/plusAssignOnVarAndCollections.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unresolvedOperator.kt")
|
||||
public void testUnresolvedOperator() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/operatorsOverloading/unresolvedOperator.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/operatorsOverloading/until")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+6
@@ -23958,6 +23958,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/operatorsOverloading/plusAssignOnVarAndCollections.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unresolvedOperator.kt")
|
||||
public void testUnresolvedOperator() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/operatorsOverloading/unresolvedOperator.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/operatorsOverloading/until")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
Reference in New Issue
Block a user