Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,14 @@ internal object FirToKtConversionCreator {
"org.jetbrains.kotlin.KtPsiSourceElement"
)
),
ConeKotlinType::class to HLFunctionCallConversion(
"{0}?.let { firSymbolBuilder.typeBuilder.buildKtType(it) }",
KaType::class.createType(nullable = true)
),
FirTypeRef::class to HLFunctionCallConversion(
"{0}?.let { firSymbolBuilder.typeBuilder.buildKtType(it) }",
KaType::class.createType(nullable = true)
),
)

private val typeMapping: Map<KClass<*>, HLFunctionCallConversion> = mapOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4507,6 +4507,7 @@ private fun KaDiagnosticConverterBuilder.addConversions102() {
UnresolvedReferenceImpl(
firDiagnostic.a,
firDiagnostic.b,
firDiagnostic.c?.let { firSymbolBuilder.typeBuilder.buildKtType(it) },
firDiagnostic as KtPsiDiagnostic,
token,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ sealed interface KaFirDiagnostic<PSI : PsiElement> : KaDiagnosticWithPsi<PSI> {
override val diagnosticClass get() = UnresolvedReference::class
val reference: String
val operator: String?
val receiverType: KaType?
}

interface UnresolvedReferenceWrongReceiver : KaFirDiagnostic<PsiElement> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ internal class UnsupportedArrayLiteralOutsideOfAnnotationWarningImpl(
internal class UnresolvedReferenceImpl(
override val reference: String,
override val operator: String?,
override val receiverType: KaType?,
firDiagnostic: KtPsiDiagnostic,
token: KaLifetimeToken,
) : KaAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KaFirDiagnostic.UnresolvedReference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ KtNameReferenceExpression(944,960): 'topLevelVariable'
KtDotQualifiedExpression(966,993): '::lateinitVar.isInitialized'
KaCallResolutionError:
candidateCalls = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'isInitialized'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'isInitialized' on receiver of type 'KMutableProperty0<MyClass>'.>

KtCallableReferenceExpression(966,979): '::lateinitVar'
KaCallResolutionSuccess:
Expand All @@ -1250,7 +1250,7 @@ KtNameReferenceExpression(968,979): 'lateinitVar'
KtNameReferenceExpression(980,993): 'isInitialized'
KaCallResolutionError:
candidateCalls = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'isInitialized'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'isInitialized' on receiver of type 'KMutableProperty0<MyClass>'.>

KtNamedFunction(997,1223): 'fun <T : Number> typeClass(classWithType: ClassWithType<T>) {'
null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ KtNameReferenceExpression(980,993): 'isInitialized'
isImplicitReferenceToCompanion: false
usesContextSensitiveResolution: false
attempt: KaSymbolResolutionError
diagnostic: ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'isInitialized'.>
diagnostic: ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'isInitialized' on receiver of type 'KMutableProperty0<MyClass>'.>
symbols:
Nothing (Unresolved reference)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ KtNameReferenceExpression(944,960): 'topLevelVariable'
KtDotQualifiedExpression(966,993): '::lateinitVar.isInitialized'
KaSymbolResolutionError:
candidateSymbols = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'isInitialized'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'isInitialized' on receiver of type 'KMutableProperty0<MyClass>'.>

KtCallableReferenceExpression(966,979): '::lateinitVar'
KaSymbolResolutionSuccess:
Expand All @@ -702,7 +702,7 @@ KtNameReferenceExpression(968,979): 'lateinitVar'
KtNameReferenceExpression(980,993): 'isInitialized'
KaSymbolResolutionError:
candidateSymbols = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'isInitialized'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'isInitialized' on receiver of type 'KMutableProperty0<MyClass>'.>

KtNamedFunction(997,1223): 'fun <T : Number> typeClass(classWithType: ClassWithType<T>) {'
null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,15 @@ KtValueArgument(199,210): 'WrongEnum.X'
KtDotQualifiedExpression(199,210): 'WrongEnum.X'
KaCallResolutionError:
candidateCalls = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'X'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'X' on receiver of type 'Unit'.>

KtNameReferenceExpression(199,208): 'WrongEnum'
null

KtNameReferenceExpression(209,210): 'X'
KaCallResolutionError:
candidateCalls = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'X'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'X' on receiver of type 'Unit'.>

KtClass(215,248): '@DslMarker'
null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ KtNameReferenceExpression(209,210): 'X'
isImplicitReferenceToCompanion: false
usesContextSensitiveResolution: false
attempt: KaSymbolResolutionError
diagnostic: ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'X'.>
diagnostic: ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'X' on receiver of type 'Unit'.>
symbols:
Nothing (Unresolved reference)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ KtValueArgument(199,210): 'WrongEnum.X'
KtDotQualifiedExpression(199,210): 'WrongEnum.X'
KaSymbolResolutionError:
candidateSymbols = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'X'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'X' on receiver of type 'Unit'.>

KtNameReferenceExpression(199,208): 'WrongEnum'
KaSymbolResolutionSuccess:
Expand All @@ -123,7 +123,7 @@ KtNameReferenceExpression(199,208): 'WrongEnum'
KtNameReferenceExpression(209,210): 'X'
KaSymbolResolutionError:
candidateSymbols = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'X'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'X' on receiver of type 'Unit'.>

KtClass(215,248): '@DslMarker'
null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ KtNameReferenceExpression(764,798): 'IndirectSealedInheritorOfOpenClass'
KtDotQualifiedExpression(802,815): 'instance.prop'
KaCallResolutionError:
candidateCalls = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop' on receiver of type 'OpenClass'.>

KtNameReferenceExpression(802,810): 'instance'
KaCallResolutionSuccess:
Expand All @@ -632,7 +632,7 @@ KtNameReferenceExpression(802,810): 'instance'
KtNameReferenceExpression(811,815): 'prop'
KaCallResolutionError:
candidateCalls = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop' on receiver of type 'OpenClass'.>

KtWhenEntry(824,837): 'else -> "100"'
null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,6 @@ KtNameReferenceExpression(811,815): 'prop'
isImplicitReferenceToCompanion: false
usesContextSensitiveResolution: false
attempt: KaSymbolResolutionError
diagnostic: ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop'.>
diagnostic: ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop' on receiver of type 'OpenClass'.>
symbols:
Nothing (Unresolved reference)
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ KtNameReferenceExpression(764,798): 'IndirectSealedInheritorOfOpenClass'
KtDotQualifiedExpression(802,815): 'instance.prop'
KaSymbolResolutionError:
candidateSymbols = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop' on receiver of type 'OpenClass'.>

KtNameReferenceExpression(802,810): 'instance'
KaSymbolResolutionSuccess:
Expand All @@ -412,7 +412,7 @@ KtNameReferenceExpression(802,810): 'instance'
KtNameReferenceExpression(811,815): 'prop'
KaSymbolResolutionError:
candidateSymbols = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop' on receiver of type 'OpenClass'.>

KtWhenEntry(824,837): 'else -> "100"'
null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ KtNameReferenceExpression(118,127): 'JCOption1'
KtDotQualifiedExpression(131,145): 'instance.prop1'
KaCallResolutionError:
candidateCalls = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop1'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop1' on receiver of type 'JClass'.>

KtNameReferenceExpression(131,139): 'instance'
KaCallResolutionSuccess:
Expand All @@ -96,7 +96,7 @@ KtNameReferenceExpression(131,139): 'instance'
KtNameReferenceExpression(140,145): 'prop1'
KaCallResolutionError:
candidateCalls = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop1'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop1' on receiver of type 'JClass'.>

KtWhenEntry(151,181): 'is JCOption2 -> instance.prop2'
null
Expand All @@ -118,7 +118,7 @@ KtNameReferenceExpression(154,163): 'JCOption2'
KtDotQualifiedExpression(167,181): 'instance.prop2'
KaCallResolutionError:
candidateCalls = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop2'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop2' on receiver of type 'JClass'.>

KtNameReferenceExpression(167,175): 'instance'
KaCallResolutionSuccess:
Expand All @@ -140,7 +140,7 @@ KtNameReferenceExpression(167,175): 'instance'
KtNameReferenceExpression(176,181): 'prop2'
KaCallResolutionError:
candidateCalls = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop2'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop2' on receiver of type 'JClass'.>

KtWhenEntry(187,213): 'is Nested -> instance.prop'
null
Expand All @@ -162,7 +162,7 @@ KtNameReferenceExpression(190,196): 'Nested'
KtDotQualifiedExpression(200,213): 'instance.prop'
KaCallResolutionError:
candidateCalls = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop' on receiver of type 'JClass'.>

KtNameReferenceExpression(200,208): 'instance'
KaCallResolutionSuccess:
Expand All @@ -184,7 +184,7 @@ KtNameReferenceExpression(200,208): 'instance'
KtNameReferenceExpression(209,213): 'prop'
KaCallResolutionError:
candidateCalls = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop' on receiver of type 'JClass'.>

KtNamedFunction(218,426): 'fun testSealedJClassInIf(instance: SealedJClass): Int {'
null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ KtNameReferenceExpression(140,145): 'prop1'
isImplicitReferenceToCompanion: false
usesContextSensitiveResolution: false
attempt: KaSymbolResolutionError
diagnostic: ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop1'.>
diagnostic: ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop1' on receiver of type 'JClass'.>
symbols:
Nothing (Unresolved reference)

Expand All @@ -74,7 +74,7 @@ KtNameReferenceExpression(176,181): 'prop2'
isImplicitReferenceToCompanion: false
usesContextSensitiveResolution: false
attempt: KaSymbolResolutionError
diagnostic: ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop2'.>
diagnostic: ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop2' on receiver of type 'JClass'.>
symbols:
Nothing (Unresolved reference)

Expand All @@ -100,7 +100,7 @@ KtNameReferenceExpression(209,213): 'prop'
isImplicitReferenceToCompanion: false
usesContextSensitiveResolution: false
attempt: KaSymbolResolutionError
diagnostic: ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop'.>
diagnostic: ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop' on receiver of type 'JClass'.>
symbols:
Nothing (Unresolved reference)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ KtNameReferenceExpression(118,127): 'JCOption1'
KtDotQualifiedExpression(131,145): 'instance.prop1'
KaSymbolResolutionError:
candidateSymbols = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop1'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop1' on receiver of type 'JClass'.>

KtNameReferenceExpression(131,139): 'instance'
KaSymbolResolutionSuccess:
Expand All @@ -74,7 +74,7 @@ KtNameReferenceExpression(131,139): 'instance'
KtNameReferenceExpression(140,145): 'prop1'
KaSymbolResolutionError:
candidateSymbols = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop1'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop1' on receiver of type 'JClass'.>

KtWhenEntry(151,181): 'is JCOption2 -> instance.prop2'
null
Expand All @@ -96,7 +96,7 @@ KtNameReferenceExpression(154,163): 'JCOption2'
KtDotQualifiedExpression(167,181): 'instance.prop2'
KaSymbolResolutionError:
candidateSymbols = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop2'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop2' on receiver of type 'JClass'.>

KtNameReferenceExpression(167,175): 'instance'
KaSymbolResolutionSuccess:
Expand All @@ -107,7 +107,7 @@ KtNameReferenceExpression(167,175): 'instance'
KtNameReferenceExpression(176,181): 'prop2'
KaSymbolResolutionError:
candidateSymbols = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop2'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop2' on receiver of type 'JClass'.>

KtWhenEntry(187,213): 'is Nested -> instance.prop'
null
Expand All @@ -129,7 +129,7 @@ KtNameReferenceExpression(190,196): 'Nested'
KtDotQualifiedExpression(200,213): 'instance.prop'
KaSymbolResolutionError:
candidateSymbols = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop' on receiver of type 'JClass'.>

KtNameReferenceExpression(200,208): 'instance'
KaSymbolResolutionSuccess:
Expand All @@ -140,7 +140,7 @@ KtNameReferenceExpression(200,208): 'instance'
KtNameReferenceExpression(209,213): 'prop'
KaSymbolResolutionError:
candidateSymbols = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'prop' on receiver of type 'JClass'.>

KtNamedFunction(218,426): 'fun testSealedJClassInIf(instance: SealedJClass): Int {'
null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ KtNameReferenceExpression(861,865): 'Left'
KtDotQualifiedExpression(869,873): 'cs.x'
KaCallResolutionError:
candidateCalls = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'x'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'x' on receiver of type 'MyGenericSealed<String> & CharSequence'.>

KtNameReferenceExpression(869,871): 'cs'
KaCallResolutionSuccess:
Expand All @@ -847,7 +847,7 @@ KtNameReferenceExpression(869,871): 'cs'
KtNameReferenceExpression(872,873): 'x'
KaCallResolutionError:
candidateCalls = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'x'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'x' on receiver of type 'MyGenericSealed<String> & CharSequence'.>

KtWhenEntry(882,898): 'is Right -> cs.y'
null
Expand All @@ -869,7 +869,7 @@ KtNameReferenceExpression(885,890): 'Right'
KtDotQualifiedExpression(894,898): 'cs.y'
KaCallResolutionError:
candidateCalls = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'y'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'y' on receiver of type 'MyGenericSealed<String> & CharSequence'.>

KtNameReferenceExpression(894,896): 'cs'
KaCallResolutionSuccess:
Expand All @@ -891,4 +891,4 @@ KtNameReferenceExpression(894,896): 'cs'
KtNameReferenceExpression(897,898): 'y'
KaCallResolutionError:
candidateCalls = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'y'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'y' on receiver of type 'MyGenericSealed<String> & CharSequence'.>
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ KtNameReferenceExpression(872,873): 'x'
isImplicitReferenceToCompanion: false
usesContextSensitiveResolution: false
attempt: KaSymbolResolutionError
diagnostic: ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'x'.>
diagnostic: ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'x' on receiver of type 'MyGenericSealed<String> & CharSequence'.>
symbols:
Nothing (Unresolved reference)

Expand All @@ -412,6 +412,6 @@ KtNameReferenceExpression(897,898): 'y'
isImplicitReferenceToCompanion: false
usesContextSensitiveResolution: false
attempt: KaSymbolResolutionError
diagnostic: ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'y'.>
diagnostic: ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'y' on receiver of type 'MyGenericSealed<String> & CharSequence'.>
symbols:
Nothing (Unresolved reference)
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ KtNameReferenceExpression(861,865): 'Left'
KtDotQualifiedExpression(869,873): 'cs.x'
KaSymbolResolutionError:
candidateSymbols = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'x'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'x' on receiver of type 'MyGenericSealed<String> & CharSequence'.>

KtNameReferenceExpression(869,871): 'cs'
KaSymbolResolutionSuccess:
Expand All @@ -581,7 +581,7 @@ KtNameReferenceExpression(869,871): 'cs'
KtNameReferenceExpression(872,873): 'x'
KaSymbolResolutionError:
candidateSymbols = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'x'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'x' on receiver of type 'MyGenericSealed<String> & CharSequence'.>

KtWhenEntry(882,898): 'is Right -> cs.y'
null
Expand All @@ -603,7 +603,7 @@ KtNameReferenceExpression(885,890): 'Right'
KtDotQualifiedExpression(894,898): 'cs.y'
KaSymbolResolutionError:
candidateSymbols = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'y'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'y' on receiver of type 'MyGenericSealed<String> & CharSequence'.>

KtNameReferenceExpression(894,896): 'cs'
KaSymbolResolutionSuccess:
Expand All @@ -614,4 +614,4 @@ KtNameReferenceExpression(894,896): 'cs'
KtNameReferenceExpression(897,898): 'y'
KaSymbolResolutionError:
candidateSymbols = []
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'y'.>
diagnostic = ERROR<UNRESOLVED_REFERENCE: Unresolved reference 'y' on receiver of type 'MyGenericSealed<String> & CharSequence'.>
Loading