[FE 1.0] Don't mark type variable as READY_FOR_FIXATION_DECLARED_UPPER_BOUND_WITH_SELF_TYPES if it has complex dependency to other type variables
^KT-49838 Fixed
This commit is contained in:
+6
@@ -18702,6 +18702,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/inference/kt47316.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49838.kt")
|
||||
public void testKt49838() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/kt49838.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaWithStarReturn.kt")
|
||||
public void testLambdaWithStarReturn() throws Exception {
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ class VariableFixationFinder(
|
||||
): TypeVariableFixationReadiness = when {
|
||||
!notFixedTypeVariables.contains(variable) ||
|
||||
dependencyProvider.isVariableRelatedToTopLevelType(variable) -> TypeVariableFixationReadiness.FORBIDDEN
|
||||
isTypeInferenceForSelfTypesSupported && hasOnlyDeclaredUpperBoundSelfTypes(variable) ->
|
||||
isTypeInferenceForSelfTypesSupported && hasOnlyDeclaredUpperBoundSelfTypes(variable) && !hasDependencyToOtherTypeVariables(variable) ->
|
||||
TypeVariableFixationReadiness.READY_FOR_FIXATION_DECLARED_UPPER_BOUND_WITH_SELF_TYPES
|
||||
!variableHasProperArgumentConstraints(variable) -> TypeVariableFixationReadiness.WITHOUT_PROPER_ARGUMENT_CONSTRAINT
|
||||
hasDependencyToOtherTypeVariables(variable) -> TypeVariableFixationReadiness.WITH_COMPLEX_DEPENDENCY
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
inline fun <
|
||||
reified TService : Service<TService, TEvent>,
|
||||
reified TEvent : Event<TService>> event(
|
||||
noinline handler: suspend (TEvent) -> Unit
|
||||
) {
|
||||
val serviceKlass = TService::class
|
||||
val eventKlass = TEvent::class
|
||||
}
|
||||
|
||||
interface Service<
|
||||
Self : Service<Self, TEvent>,
|
||||
in TEvent : Event<Self>
|
||||
>
|
||||
|
||||
interface Event<out T : Service<out T, *>>
|
||||
|
||||
class SomeService : Service<SomeService, SomeService.SomeEvent> {
|
||||
class SomeEvent : Event<SomeService>
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
event { someEvent: SomeService.SomeEvent -> } // REIFIED_TYPE_FORBIDDEN_SUBSTITUTION
|
||||
return "OK"
|
||||
}
|
||||
+6
@@ -18348,6 +18348,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/inference/kt47316.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49838.kt")
|
||||
public void testKt49838() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/kt49838.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaWithStarReturn.kt")
|
||||
public void testLambdaWithStarReturn() throws Exception {
|
||||
|
||||
+6
@@ -18702,6 +18702,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/inference/kt47316.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49838.kt")
|
||||
public void testKt49838() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/kt49838.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaWithStarReturn.kt")
|
||||
public void testLambdaWithStarReturn() throws Exception {
|
||||
|
||||
+5
@@ -15109,6 +15109,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Inference extends AbstractLightAnalysisModeTest {
|
||||
@TestMetadata("kt49838.kt")
|
||||
public void ignoreKt49838() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/kt49838.kt");
|
||||
}
|
||||
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
+6
@@ -14366,6 +14366,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inference/kt45118.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49838.kt")
|
||||
public void testKt49838() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/kt49838.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaWithStarReturn.kt")
|
||||
public void testLambdaWithStarReturn() throws Exception {
|
||||
|
||||
+6
@@ -14330,6 +14330,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inference/kt45118.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49838.kt")
|
||||
public void testKt49838() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/kt49838.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaWithStarReturn.kt")
|
||||
public void testLambdaWithStarReturn() throws Exception {
|
||||
|
||||
+5
@@ -12069,6 +12069,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
runTest("compiler/testData/codegen/box/inference/kt45118.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt49838.kt")
|
||||
public void testKt49838() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/kt49838.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaWithStarReturn.kt")
|
||||
public void testLambdaWithStarReturn() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/lambdaWithStarReturn.kt");
|
||||
|
||||
+12
@@ -15227,6 +15227,12 @@ public class NativeExtBlackBoxTestGenerated extends AbstractNativeBlackBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inference/kt45118.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49838.kt")
|
||||
public void testKt49838() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/kt49838.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaWithStarReturn.kt")
|
||||
public void testLambdaWithStarReturn() throws Exception {
|
||||
@@ -30946,6 +30952,12 @@ public class NativeExtBlackBoxTestGenerated extends AbstractNativeBlackBoxTest {
|
||||
runTest("compiler/testData/codegen/box/sealed/delegatingConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt49752.kt")
|
||||
public void testKt49752() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/sealed/kt49752.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("multipleFiles_enabled.kt")
|
||||
public void testMultipleFiles_enabled() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user