Erase non-reified type parameters by-default when inlining.

Substitution of type arguments to non-reified type parameters may lead
to accidental reification, which should not be done (see ^KT-60174 for
examples). So, we should erase them, except the few cases.

^KT-60174: Fixed
^KT-60175: Fixed
This commit is contained in:
vladislav.grechko
2023-07-27 18:30:50 +02:00
committed by Space Team
parent 29ecc4d987
commit f318b5969d
89 changed files with 2369 additions and 280 deletions
@@ -2081,6 +2081,76 @@ public class FirWasmJsCodegenBoxInlineTestGenerated extends AbstractFirWasmJsCod
}
}
@Nested
@TestMetadata("compiler/testData/codegen/boxInline/dontReify")
@TestDataPath("$PROJECT_ROOT")
public class DontReify {
@Test
public void testAllFilesPresentInDontReify() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/dontReify"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.WASM, true);
}
@Test
@TestMetadata("arrayRead.kt")
public void testArrayRead() throws Exception {
runTest("compiler/testData/codegen/boxInline/dontReify/arrayRead.kt");
}
@Test
@TestMetadata("arrayWrite.kt")
public void testArrayWrite() throws Exception {
runTest("compiler/testData/codegen/boxInline/dontReify/arrayWrite.kt");
}
@Test
@TestMetadata("dispatchReceiver.kt")
public void testDispatchReceiver() throws Exception {
runTest("compiler/testData/codegen/boxInline/dontReify/dispatchReceiver.kt");
}
@Test
@TestMetadata("extensionReceiver.kt")
public void testExtensionReceiver() throws Exception {
runTest("compiler/testData/codegen/boxInline/dontReify/extensionReceiver.kt");
}
@Test
@TestMetadata("lambdaParameter.kt")
public void testLambdaParameter() throws Exception {
runTest("compiler/testData/codegen/boxInline/dontReify/lambdaParameter.kt");
}
@Test
@TestMetadata("localDelegatedProperty.kt")
public void testLocalDelegatedProperty() throws Exception {
runTest("compiler/testData/codegen/boxInline/dontReify/localDelegatedProperty.kt");
}
@Test
@TestMetadata("localObjectProperty.kt")
public void testLocalObjectProperty() throws Exception {
runTest("compiler/testData/codegen/boxInline/dontReify/localObjectProperty.kt");
}
@Test
@TestMetadata("localVariable.kt")
public void testLocalVariable() throws Exception {
runTest("compiler/testData/codegen/boxInline/dontReify/localVariable.kt");
}
@Test
@TestMetadata("methodReturnType.kt")
public void testMethodReturnType() throws Exception {
runTest("compiler/testData/codegen/boxInline/dontReify/methodReturnType.kt");
}
@Test
@TestMetadata("parameterInLocalObject.kt")
public void testParameterInLocalObject() throws Exception {
runTest("compiler/testData/codegen/boxInline/dontReify/parameterInLocalObject.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/boxInline/enclosingInfo")
@TestDataPath("$PROJECT_ROOT")
@@ -4288,6 +4358,12 @@ public class FirWasmJsCodegenBoxInlineTestGenerated extends AbstractFirWasmJsCod
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/special"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.WASM, true);
}
@Test
@TestMetadata("blockReturnsNullableUnit.kt")
public void testBlockReturnsNullableUnit() throws Exception {
runTest("compiler/testData/codegen/boxInline/special/blockReturnsNullableUnit.kt");
}
@Test
@TestMetadata("identityCheck.kt")
public void testIdentityCheck() throws Exception {
@@ -2081,6 +2081,76 @@ public class K1WasmCodegenBoxInlineTestGenerated extends AbstractK1WasmCodegenBo
}
}
@Nested
@TestMetadata("compiler/testData/codegen/boxInline/dontReify")
@TestDataPath("$PROJECT_ROOT")
public class DontReify {
@Test
public void testAllFilesPresentInDontReify() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/dontReify"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.WASM, true);
}
@Test
@TestMetadata("arrayRead.kt")
public void testArrayRead() throws Exception {
runTest("compiler/testData/codegen/boxInline/dontReify/arrayRead.kt");
}
@Test
@TestMetadata("arrayWrite.kt")
public void testArrayWrite() throws Exception {
runTest("compiler/testData/codegen/boxInline/dontReify/arrayWrite.kt");
}
@Test
@TestMetadata("dispatchReceiver.kt")
public void testDispatchReceiver() throws Exception {
runTest("compiler/testData/codegen/boxInline/dontReify/dispatchReceiver.kt");
}
@Test
@TestMetadata("extensionReceiver.kt")
public void testExtensionReceiver() throws Exception {
runTest("compiler/testData/codegen/boxInline/dontReify/extensionReceiver.kt");
}
@Test
@TestMetadata("lambdaParameter.kt")
public void testLambdaParameter() throws Exception {
runTest("compiler/testData/codegen/boxInline/dontReify/lambdaParameter.kt");
}
@Test
@TestMetadata("localDelegatedProperty.kt")
public void testLocalDelegatedProperty() throws Exception {
runTest("compiler/testData/codegen/boxInline/dontReify/localDelegatedProperty.kt");
}
@Test
@TestMetadata("localObjectProperty.kt")
public void testLocalObjectProperty() throws Exception {
runTest("compiler/testData/codegen/boxInline/dontReify/localObjectProperty.kt");
}
@Test
@TestMetadata("localVariable.kt")
public void testLocalVariable() throws Exception {
runTest("compiler/testData/codegen/boxInline/dontReify/localVariable.kt");
}
@Test
@TestMetadata("methodReturnType.kt")
public void testMethodReturnType() throws Exception {
runTest("compiler/testData/codegen/boxInline/dontReify/methodReturnType.kt");
}
@Test
@TestMetadata("parameterInLocalObject.kt")
public void testParameterInLocalObject() throws Exception {
runTest("compiler/testData/codegen/boxInline/dontReify/parameterInLocalObject.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/boxInline/enclosingInfo")
@TestDataPath("$PROJECT_ROOT")
@@ -4288,6 +4358,12 @@ public class K1WasmCodegenBoxInlineTestGenerated extends AbstractK1WasmCodegenBo
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/special"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.WASM, true);
}
@Test
@TestMetadata("blockReturnsNullableUnit.kt")
public void testBlockReturnsNullableUnit() throws Exception {
runTest("compiler/testData/codegen/boxInline/special/blockReturnsNullableUnit.kt");
}
@Test
@TestMetadata("identityCheck.kt")
public void testIdentityCheck() throws Exception {