[NI] fix approximation of not denotable types in lambda's function descriptors
This commit is contained in:
+7
-1
@@ -133,7 +133,13 @@ class ResolvedAtomCompleter(
|
||||
resultSubstitutor.safeSubstitute(lambda.returnType)
|
||||
}
|
||||
|
||||
updateTraceForLambda(lambda, topLevelTrace, returnType)
|
||||
val approximatedReturnType =
|
||||
TypeApproximator().approximateDeclarationType(
|
||||
returnType,
|
||||
local = true,
|
||||
languageVersionSettings = topLevelCallContext.languageVersionSettings
|
||||
)
|
||||
updateTraceForLambda(lambda, topLevelTrace, approximatedReturnType)
|
||||
|
||||
for (lambdaResult in lambda.resultArguments) {
|
||||
val resultValueArgument = lambdaResult as? PSIKotlinCallArgument ?: continue
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Foo<C : Any> {
|
||||
fun test(candidates: Collection<C>): List<C> {
|
||||
return candidates.sortedBy { 1 }
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val foo = Foo<String>()
|
||||
|
||||
val list = listOf("OK")
|
||||
val sorted = foo.test(list)
|
||||
|
||||
return list.first()
|
||||
}
|
||||
+5
@@ -11870,6 +11870,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("integerLiteralTypeInLamdaReturnType.kt")
|
||||
public void testIntegerLiteralTypeInLamdaReturnType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/integerLiteralTypeInLamdaReturnType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt10822.kt")
|
||||
public void testKt10822() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/kt10822.kt");
|
||||
|
||||
+5
@@ -11870,6 +11870,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("integerLiteralTypeInLamdaReturnType.kt")
|
||||
public void testIntegerLiteralTypeInLamdaReturnType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/integerLiteralTypeInLamdaReturnType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt10822.kt")
|
||||
public void testKt10822() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/kt10822.kt");
|
||||
|
||||
+5
@@ -11875,6 +11875,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("integerLiteralTypeInLamdaReturnType.kt")
|
||||
public void testIntegerLiteralTypeInLamdaReturnType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/integerLiteralTypeInLamdaReturnType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt10822.kt")
|
||||
public void testKt10822() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/kt10822.kt");
|
||||
|
||||
Reference in New Issue
Block a user