FIR. Refactor smart-cast representation in FIR tree
Make smart-casts non-transparent expression without delegation to underlying FirQualifiedAccessExpression, as children delegation in fir tree has unclear semantics Remove two different kinds of tree nodes for smart-casts
This commit is contained in:
committed by
teamcity
parent
bc9db58b3c
commit
513af2dfbc
Generated
+6
-6
@@ -2596,12 +2596,6 @@ public class IrTextTestGenerated extends AbstractIrTextTest {
|
||||
runTest("compiler/testData/ir/irText/firProblems/InnerClassInAnonymous.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("JCTree.kt")
|
||||
public void testJCTree() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/JCTree.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt19251.kt")
|
||||
public void testKt19251() throws Exception {
|
||||
@@ -2638,6 +2632,12 @@ public class IrTextTestGenerated extends AbstractIrTextTest {
|
||||
runTest("compiler/testData/ir/irText/firProblems/MultiList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("OutBox.kt")
|
||||
public void testOutBox() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/OutBox.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("putIfAbsent.kt")
|
||||
public void testPutIfAbsent() throws Exception {
|
||||
|
||||
+3
-2
@@ -54,6 +54,7 @@ class FirDiagnosticsHandler(testServices: TestServices) : FirAnalysisHandler(tes
|
||||
KtRealSourceElementKind,
|
||||
KtFakeSourceElementKind.DesugaredCompoundAssignment,
|
||||
KtFakeSourceElementKind.ReferenceInAtomicQualifiedAccess,
|
||||
KtFakeSourceElementKind.SmartCastExpression
|
||||
)
|
||||
}
|
||||
|
||||
@@ -158,7 +159,7 @@ class FirDiagnosticsHandler(testServices: TestServices) : FirAnalysisHandler(tes
|
||||
)
|
||||
)
|
||||
}
|
||||
if (element is FirExpressionWithSmartcast) {
|
||||
if (element is FirSmartCastExpression) {
|
||||
element.originalExpression.acceptChildren(this)
|
||||
} else {
|
||||
element.acceptChildren(this)
|
||||
@@ -205,7 +206,7 @@ class FirDiagnosticsHandler(testServices: TestServices) : FirAnalysisHandler(tes
|
||||
diagnosedRangesToDiagnosticNames: Map<IntRange, Set<String>>
|
||||
): KtDiagnosticWithParameters1<String>? =
|
||||
DebugInfoDiagnosticFactory1.EXPRESSION_TYPE.createDebugInfoDiagnostic(element, diagnosedRangesToDiagnosticNames) {
|
||||
element.typeRef.renderAsString((element as? FirExpressionWithSmartcast)?.takeIf { it.isStable }?.originalType)
|
||||
element.typeRef.renderAsString((element as? FirSmartCastExpression)?.takeIf { it.isStable }?.originalExpression?.typeRef)
|
||||
}
|
||||
|
||||
private fun FirTypeRef.renderAsString(originalTypeRef: FirTypeRef?): String {
|
||||
|
||||
Reference in New Issue
Block a user