From fe95e37c88bfed6006f07849d9a2e5cf4c45ff4d Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Fri, 13 Mar 2020 13:09:08 +0300 Subject: [PATCH] [FIR] Add equality to Unit constraint for lambda without return expressions --- .../resolve/inference/PostponedArgumentsAnalyzer.kt | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/PostponedArgumentsAnalyzer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/PostponedArgumentsAnalyzer.kt index 4da0e4eaf6b..c14b8c084d3 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/PostponedArgumentsAnalyzer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/PostponedArgumentsAnalyzer.kt @@ -152,16 +152,8 @@ class PostponedArgumentsAnalyzer( if (!hasExpressionInReturnArguments) { val lambdaReturnType = lambda.returnType.let(::substitute) - c.getBuilder().addSubtypeConstraint( - lambdaReturnType, - unitType, /*LambdaArgumentConstraintPosition(lambda)*/ - SimpleConstraintSystemConstraintPosition - ) - c.getBuilder().addSubtypeConstraint( - unitType, - lambdaReturnType, /*LambdaArgumentConstraintPosition(lambda)*/ - SimpleConstraintSystemConstraintPosition - ) + /*LambdaArgumentConstraintPosition(lambda)*/ + c.getBuilder().addEqualityConstraint(lambdaReturnType, unitType, SimpleConstraintSystemConstraintPosition) } lambda.analyzed = true