[FIR2IR] Properly calculate the type of delegated function call

```
interface A {
    fun <T> foo(): T
}

class B(val a: A) : A by A {
    generated fun <T'> foo(): T' {
        return a.foo() // <------
    }
}
```

There was a problem that type of generated delegated call used
  an unsubstituted type of the original delegated declaration, which led
  to a situation when (see example) type of call `a.foo()` was not `T'`
  but `T`, which led to incorrect IR and further exceptions on backend

^KT-64257 Fixed
^KT-64284 Obsolete
This commit is contained in:
Dmitriy Novozhilov
2023-12-14 17:39:41 +02:00
committed by Space Team
parent c48753900c
commit 94c46d384a
28 changed files with 206 additions and 148 deletions
@@ -12681,6 +12681,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/delegation/delegationWithPrivateConstructor.kt");
}
@Test
@TestMetadata("genericFunctionInGenericInterface.kt")
public void testGenericFunctionInGenericInterface() throws Exception {
runTest("compiler/testData/codegen/box/delegation/genericFunctionInGenericInterface.kt");
}
@Test
@TestMetadata("genericProperty.kt")
public void testGenericProperty() throws Exception {
@@ -12681,6 +12681,12 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT
runTest("compiler/testData/codegen/box/delegation/delegationWithPrivateConstructor.kt");
}
@Test
@TestMetadata("genericFunctionInGenericInterface.kt")
public void testGenericFunctionInGenericInterface() throws Exception {
runTest("compiler/testData/codegen/box/delegation/genericFunctionInGenericInterface.kt");
}
@Test
@TestMetadata("genericProperty.kt")
public void testGenericProperty() throws Exception {
@@ -12681,6 +12681,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/delegation/delegationWithPrivateConstructor.kt");
}
@Test
@TestMetadata("genericFunctionInGenericInterface.kt")
public void testGenericFunctionInGenericInterface() throws Exception {
runTest("compiler/testData/codegen/box/delegation/genericFunctionInGenericInterface.kt");
}
@Test
@TestMetadata("genericProperty.kt")
public void testGenericProperty() throws Exception {
@@ -12681,6 +12681,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
runTest("compiler/testData/codegen/box/delegation/delegationWithPrivateConstructor.kt");
}
@Test
@TestMetadata("genericFunctionInGenericInterface.kt")
public void testGenericFunctionInGenericInterface() throws Exception {
runTest("compiler/testData/codegen/box/delegation/genericFunctionInGenericInterface.kt");
}
@Test
@TestMetadata("genericProperty.kt")
public void testGenericProperty() throws Exception {