[FIR] Explicitly resolve synthetic property return type if necessary
During implicit body resolve phase, we can encounter a reference to a not yet resolved Kotlin class that inherits a synthetic property from a Java class. In that case, resolve the return type in FirSyntheticPropertiesScope. #KT-57166 Fixed
This commit is contained in:
committed by
Space Team
parent
6aef11704b
commit
9b89759755
+22
@@ -0,0 +1,22 @@
|
||||
// FIR_IDENTICAL
|
||||
// ISSUE: KT-57166
|
||||
// File order is important.
|
||||
|
||||
// FILE: InstanceObject.java
|
||||
public interface InstanceObject {
|
||||
long getDeallocTime();
|
||||
void setDeallocTime(long deallocTime);
|
||||
}
|
||||
|
||||
// FILE: LiveAllocationCaptureObject.kt
|
||||
class LiveAllocationCaptureObject {
|
||||
private fun queryJavaInstanceDelta() = run {
|
||||
LiveAllocationInstanceObject().deallocTime = 42L
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: LiveAllocationInstanceObject.kt
|
||||
class LiveAllocationInstanceObject: InstanceObject {
|
||||
override fun getDeallocTime() = 42L
|
||||
override fun setDeallocTime(deallocTime: Long) {}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// FIR_IDENTICAL
|
||||
// ISSUE: KT-57166
|
||||
|
||||
// FILE: PsiType.java
|
||||
|
||||
public abstract class PsiType {
|
||||
}
|
||||
|
||||
// FILE: JavaCodeFragment.java
|
||||
|
||||
public interface JavaCodeFragment {
|
||||
PsiType getThisType();
|
||||
void setThisType(PsiType psiType);
|
||||
}
|
||||
|
||||
// FILE: KtCodeFragment.kt
|
||||
|
||||
abstract class KtCodeFragment : JavaCodeFragment {
|
||||
private var thisType: PsiType? = null
|
||||
|
||||
override fun getThisType() = thisType
|
||||
|
||||
override fun setThisType(psiType: PsiType?) {
|
||||
thisType = psiType
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// ISSUE: KT-57166
|
||||
|
||||
// FILE: Modality.kt
|
||||
enum class Modality {
|
||||
FINAL
|
||||
}
|
||||
|
||||
// FILE: ClassDescriptor.java
|
||||
|
||||
public interface ClassDescriptor {
|
||||
@NotNull
|
||||
Modality getModality();
|
||||
}
|
||||
|
||||
// FILE: DeserializedClassDescriptor.kt
|
||||
|
||||
object ProtoEnumFlags {
|
||||
fun modality(): Modality = Modality.FINAL
|
||||
}
|
||||
|
||||
class DeserializedClassDescriptor : ClassDescriptor {
|
||||
private val modality = ProtoEnumFlags.modality()
|
||||
|
||||
override fun getModality() = modality
|
||||
}
|
||||
|
||||
fun modality(): Modality = Modality.FINAL
|
||||
|
||||
class DeserializedClassDescriptor2 : ClassDescriptor {
|
||||
private val modality = modality()
|
||||
|
||||
override fun getModality() = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>modality<!>
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// ISSUE: KT-57166
|
||||
|
||||
// FILE: Modality.kt
|
||||
enum class Modality {
|
||||
FINAL
|
||||
}
|
||||
|
||||
// FILE: ClassDescriptor.java
|
||||
|
||||
public interface ClassDescriptor {
|
||||
@NotNull
|
||||
Modality getModality();
|
||||
}
|
||||
|
||||
// FILE: DeserializedClassDescriptor.kt
|
||||
|
||||
object ProtoEnumFlags {
|
||||
fun modality(): Modality = Modality.FINAL
|
||||
}
|
||||
|
||||
class DeserializedClassDescriptor : ClassDescriptor {
|
||||
private val modality = ProtoEnumFlags.modality()
|
||||
|
||||
override fun getModality() = modality
|
||||
}
|
||||
|
||||
fun modality(): Modality = Modality.FINAL
|
||||
|
||||
class DeserializedClassDescriptor2 : ClassDescriptor {
|
||||
private val modality = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR!><!DEBUG_INFO_MISSING_UNRESOLVED!>modality<!>()<!>
|
||||
|
||||
override fun getModality() = <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>modality<!>
|
||||
}
|
||||
Reference in New Issue
Block a user