Revert "[FIR] Do not smartcast class delegation implemented properties"
This reverts commit bb6f466162.
Reverting the fix for KT-57417 as it causes failures in IntelliJ and
Space projects. May reintroduce fix after failures are investigated and
resolved.
This commit is contained in:
-6
@@ -36991,12 +36991,6 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/varnotnull/capturedInlineModifiedBefore.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classDelegation.kt")
|
||||
public void testClassDelegation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/varnotnull/classDelegation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("doWhileWithBreak.kt")
|
||||
public void testDoWhileWithBreak() throws Exception {
|
||||
|
||||
-6
@@ -36991,12 +36991,6 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/varnotnull/capturedInlineModifiedBefore.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classDelegation.kt")
|
||||
public void testClassDelegation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/varnotnull/classDelegation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("doWhileWithBreak.kt")
|
||||
public void testDoWhileWithBreak() throws Exception {
|
||||
|
||||
-6
@@ -34635,12 +34635,6 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/varnotnull/capturedInlineModifiedBefore.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classDelegation.kt")
|
||||
public void testClassDelegation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/varnotnull/classDelegation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("doWhileWithBreak.kt")
|
||||
public void testDoWhileWithBreak() throws Exception {
|
||||
|
||||
-6
@@ -34761,12 +34761,6 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/varnotnull/capturedInlineModifiedBefore.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classDelegation.kt")
|
||||
public void testClassDelegation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/varnotnull/classDelegation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("doWhileWithBreak.kt")
|
||||
public void testDoWhileWithBreak() throws Exception {
|
||||
|
||||
+5
-2
@@ -7,7 +7,8 @@ package org.jetbrains.kotlin.fir.resolve.dfa
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
import org.jetbrains.kotlin.fir.*
|
||||
import org.jetbrains.kotlin.fir.FirElement
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.declarations.FirAnonymousObject
|
||||
import org.jetbrains.kotlin.fir.declarations.FirProperty
|
||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||
@@ -17,6 +18,8 @@ import org.jetbrains.kotlin.fir.declarations.utils.isFinal
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.modality
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.visibility
|
||||
import org.jetbrains.kotlin.fir.expressions.*
|
||||
import org.jetbrains.kotlin.fir.moduleData
|
||||
import org.jetbrains.kotlin.fir.originalOrSelf
|
||||
import org.jetbrains.kotlin.fir.references.FirThisReference
|
||||
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
|
||||
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
||||
@@ -170,7 +173,7 @@ class VariableStorageImpl(private val session: FirSession) : VariableStorage() {
|
||||
val property = this.fir as? FirProperty ?: return PropertyStability.STABLE_VALUE
|
||||
|
||||
return when {
|
||||
property.delegate != null || property.isDelegated -> PropertyStability.DELEGATED_PROPERTY
|
||||
property.delegate != null -> PropertyStability.DELEGATED_PROPERTY
|
||||
property.isLocal -> if (property.isVal) PropertyStability.STABLE_VALUE else PropertyStability.LOCAL_VAR
|
||||
property.isVar -> PropertyStability.MUTABLE_PROPERTY
|
||||
property.receiverParameter != null -> PropertyStability.PROPERTY_WITH_GETTER
|
||||
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
// ISSUE: KT-57417
|
||||
|
||||
interface HasProperty {
|
||||
val property: Int?
|
||||
}
|
||||
|
||||
class Test(delegate: HasProperty) : HasProperty by delegate
|
||||
|
||||
fun test(a: Test) {
|
||||
if (a.property != null) <!SMARTCAST_IMPOSSIBLE!>a.property<!> + 1
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
// ISSUE: KT-57417
|
||||
|
||||
interface HasProperty {
|
||||
val property: Int?
|
||||
}
|
||||
|
||||
class Test(delegate: HasProperty) : HasProperty by delegate
|
||||
|
||||
fun test(a: Test) {
|
||||
if (a.property != null) <!DEBUG_INFO_SMARTCAST!>a.property<!> + 1
|
||||
}
|
||||
Generated
-6
@@ -36991,12 +36991,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/varnotnull/capturedInlineModifiedBefore.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classDelegation.kt")
|
||||
public void testClassDelegation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/varnotnull/classDelegation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("doWhileWithBreak.kt")
|
||||
public void testDoWhileWithBreak() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user