Psi2ir: do not generate default accessor body for expect properties

Because generateDefaultGetterBody/generateDefaultSetterBody reference
the property's backing field, which in case of extension properties
leads to an error "Unbound symbols not allowed" because extension
property cannot have a backing field.

In some way, this check is similar to the `isExpect` check in
`generatePrimaryConstructor`.
This commit is contained in:
Alexander Udalov
2021-03-09 15:35:57 +01:00
parent 5fc9f3bc17
commit bdaeaca5ae
10 changed files with 71 additions and 3 deletions
@@ -16377,6 +16377,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
}
@TestMetadata("expectProperty.kt")
public void testExpectProperty() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/expectProperty.kt");
}
@TestMetadata("optionalExpectation.kt")
public void testOptionalExpectation() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/optionalExpectation.kt");
@@ -15834,6 +15834,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@TestMetadata("expectProperty.kt")
public void testExpectProperty() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/expectProperty.kt");
}
@TestMetadata("optionalExpectation.kt")
public void testOptionalExpectation() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/optionalExpectation.kt");
@@ -15899,6 +15899,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
}
@TestMetadata("expectProperty.kt")
public void testExpectProperty() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/expectProperty.kt");
}
@TestMetadata("optionalExpectation.kt")
public void testOptionalExpectation() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/optionalExpectation.kt");
@@ -9740,6 +9740,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
}
@TestMetadata("expectProperty.kt")
public void testExpectProperty() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/expectProperty.kt");
}
@TestMetadata("optionalExpectation.kt")
public void testOptionalExpectation() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/optionalExpectation.kt");