FIR. Fix smart-cast expression unwrapping in plus with assign resolve
This commit is contained in:
committed by
teamcity
parent
f946496979
commit
8f51c51eee
+6
@@ -2117,6 +2117,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
|||||||
runTest("compiler/fir/analysis-tests/testData/resolve/expresssions/overriddenJavaGetter.kt");
|
runTest("compiler/fir/analysis-tests/testData/resolve/expresssions/overriddenJavaGetter.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("plusWithAssignSmartCast.kt")
|
||||||
|
public void testPlusWithAssignSmartCast() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolve/expresssions/plusWithAssignSmartCast.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("privateObjectLiteral.kt")
|
@TestMetadata("privateObjectLiteral.kt")
|
||||||
public void testPrivateObjectLiteral() throws Exception {
|
public void testPrivateObjectLiteral() throws Exception {
|
||||||
|
|||||||
+5
@@ -1846,6 +1846,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
|||||||
runTest("compiler/fir/analysis-tests/testData/resolve/expresssions/overriddenJavaGetter.kt");
|
runTest("compiler/fir/analysis-tests/testData/resolve/expresssions/overriddenJavaGetter.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("plusWithAssignSmartCast.kt")
|
||||||
|
public void testPlusWithAssignSmartCast() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolve/expresssions/plusWithAssignSmartCast.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("privateObjectLiteral.kt")
|
@TestMetadata("privateObjectLiteral.kt")
|
||||||
public void testPrivateObjectLiteral() throws Exception {
|
public void testPrivateObjectLiteral() throws Exception {
|
||||||
runTest("compiler/fir/analysis-tests/testData/resolve/expresssions/privateObjectLiteral.kt");
|
runTest("compiler/fir/analysis-tests/testData/resolve/expresssions/privateObjectLiteral.kt");
|
||||||
|
|||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
FILE: plusWithAssignSmartCast.kt
|
||||||
|
public final class Foo : R|kotlin/Any| {
|
||||||
|
public constructor(): R|Foo| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final var bar: R|kotlin/String?| = Null(null)
|
||||||
|
public get(): R|kotlin/String?|
|
||||||
|
public set(value: R|kotlin/String?|): R|kotlin/Unit|
|
||||||
|
|
||||||
|
public final fun addToBar(other: R|kotlin/String|): R|kotlin/Unit| {
|
||||||
|
when () {
|
||||||
|
==(this@R|/Foo|.R|/Foo.bar|, Null(null)) -> {
|
||||||
|
this@R|/Foo|.R|/Foo.bar| = R|<local>/other|
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
this@R|/Foo|.R|/Foo.bar| = this@R|/Foo|.R|/Foo.bar|.R|kotlin/plus|(<strcat>(String( ), R|<local>/other|))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
class Foo {
|
||||||
|
var bar: String? = null
|
||||||
|
|
||||||
|
fun addToBar(other: String) {
|
||||||
|
if (bar == null) {
|
||||||
|
bar = other
|
||||||
|
} else {
|
||||||
|
bar += " $other"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
@@ -2117,6 +2117,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
|
|||||||
runTest("compiler/fir/analysis-tests/testData/resolve/expresssions/overriddenJavaGetter.kt");
|
runTest("compiler/fir/analysis-tests/testData/resolve/expresssions/overriddenJavaGetter.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("plusWithAssignSmartCast.kt")
|
||||||
|
public void testPlusWithAssignSmartCast() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolve/expresssions/plusWithAssignSmartCast.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("privateObjectLiteral.kt")
|
@TestMetadata("privateObjectLiteral.kt")
|
||||||
public void testPrivateObjectLiteral() throws Exception {
|
public void testPrivateObjectLiteral() throws Exception {
|
||||||
|
|||||||
+6
@@ -2117,6 +2117,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
|||||||
runTest("compiler/fir/analysis-tests/testData/resolve/expresssions/overriddenJavaGetter.kt");
|
runTest("compiler/fir/analysis-tests/testData/resolve/expresssions/overriddenJavaGetter.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("plusWithAssignSmartCast.kt")
|
||||||
|
public void testPlusWithAssignSmartCast() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolve/expresssions/plusWithAssignSmartCast.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("privateObjectLiteral.kt")
|
@TestMetadata("privateObjectLiteral.kt")
|
||||||
public void testPrivateObjectLiteral() throws Exception {
|
public void testPrivateObjectLiteral() throws Exception {
|
||||||
|
|||||||
+1
-1
@@ -605,7 +605,7 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(leftArgument as? FirQualifiedAccess)?.let {
|
(leftArgument.unwrapSmartcastExpression() as? FirQualifiedAccess)?.let {
|
||||||
dispatchReceiver = it.dispatchReceiver
|
dispatchReceiver = it.dispatchReceiver
|
||||||
extensionReceiver = it.extensionReceiver
|
extensionReceiver = it.extensionReceiver
|
||||||
contextReceiverArguments.addAll(it.contextReceiverArguments)
|
contextReceiverArguments.addAll(it.contextReceiverArguments)
|
||||||
|
|||||||
Reference in New Issue
Block a user