Psi2Ir: Bind unbound type parameters

This commit is contained in:
Steven Schäfer
2020-04-15 13:51:30 +02:00
committed by Georgy Bronnikov
parent 8c4fdd1edd
commit fc7d667282
7 changed files with 45 additions and 0 deletions
@@ -14356,6 +14356,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/javaInterop/lambdaInstanceOf.kt"); runTest("compiler/testData/codegen/box/javaInterop/lambdaInstanceOf.kt");
} }
@TestMetadata("samUnboundTypeParameter.kt")
public void testSamUnboundTypeParameter() throws Exception {
runTest("compiler/testData/codegen/box/javaInterop/samUnboundTypeParameter.kt");
}
@TestMetadata("compiler/testData/codegen/box/javaInterop/generics") @TestMetadata("compiler/testData/codegen/box/javaInterop/generics")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) @RunWith(JUnit3RunnerWithInners.class)
@@ -120,6 +120,8 @@ class DeclarationStubGenerator(
generatePropertyStub(descriptor) generatePropertyStub(descriptor)
is TypeAliasDescriptor -> is TypeAliasDescriptor ->
generateTypeAliasStub(descriptor) generateTypeAliasStub(descriptor)
is TypeParameterDescriptor ->
generateOrGetTypeParameterStub(descriptor)
else -> else ->
throw AssertionError("Unexpected member descriptor: $descriptor") throw AssertionError("Unexpected member descriptor: $descriptor")
} }
@@ -65,6 +65,7 @@ private val SymbolTable.allUnbound: List<IrSymbol>
r.addAll(unboundSimpleFunctions) r.addAll(unboundSimpleFunctions)
r.addAll(unboundProperties) r.addAll(unboundProperties)
r.addAll(unboundTypeAliases) r.addAll(unboundTypeAliases)
r.addAll(unboundTypeParameters)
return r return r
} }
@@ -0,0 +1,22 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND_FIR: JVM_IR
// !LANGUAGE: -NewInference
// WITH_RUNTIME
// FILE: Base.java
import java.lang.Runnable;
import java.lang.IllegalStateException;
public class Base<T> {
public <S> S add(Base<S> value, Runnable block) { return null; }
}
// FILE: Derived.kt
class Derived<T>(val value: T) : Base<T>() {
init {
add(this) {}
}
}
fun box(): String {
return Derived("OK").value
}
@@ -15571,6 +15571,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/javaInterop/lambdaInstanceOf.kt"); runTest("compiler/testData/codegen/box/javaInterop/lambdaInstanceOf.kt");
} }
@TestMetadata("samUnboundTypeParameter.kt")
public void testSamUnboundTypeParameter() throws Exception {
runTest("compiler/testData/codegen/box/javaInterop/samUnboundTypeParameter.kt");
}
@TestMetadata("compiler/testData/codegen/box/javaInterop/generics") @TestMetadata("compiler/testData/codegen/box/javaInterop/generics")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) @RunWith(JUnit3RunnerWithInners.class)
@@ -15571,6 +15571,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/javaInterop/lambdaInstanceOf.kt"); runTest("compiler/testData/codegen/box/javaInterop/lambdaInstanceOf.kt");
} }
@TestMetadata("samUnboundTypeParameter.kt")
public void testSamUnboundTypeParameter() throws Exception {
runTest("compiler/testData/codegen/box/javaInterop/samUnboundTypeParameter.kt");
}
@TestMetadata("compiler/testData/codegen/box/javaInterop/generics") @TestMetadata("compiler/testData/codegen/box/javaInterop/generics")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) @RunWith(JUnit3RunnerWithInners.class)
@@ -14356,6 +14356,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/javaInterop/lambdaInstanceOf.kt"); runTest("compiler/testData/codegen/box/javaInterop/lambdaInstanceOf.kt");
} }
@TestMetadata("samUnboundTypeParameter.kt")
public void testSamUnboundTypeParameter() throws Exception {
runTest("compiler/testData/codegen/box/javaInterop/samUnboundTypeParameter.kt");
}
@TestMetadata("compiler/testData/codegen/box/javaInterop/generics") @TestMetadata("compiler/testData/codegen/box/javaInterop/generics")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) @RunWith(JUnit3RunnerWithInners.class)