PSI2IR test for coercion to unit in lambda

This commit is contained in:
Dmitry Petrov
2020-02-13 13:51:59 +03:00
parent 5760c0be9c
commit 1e7f8ea037
5 changed files with 41 additions and 0 deletions
@@ -1827,6 +1827,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
runTest("compiler/testData/ir/irText/types/asOnPlatformType.kt");
}
@TestMetadata("coercionToUnitInLambdaReturnValue.kt")
public void testCoercionToUnitInLambdaReturnValue() throws Exception {
runTest("compiler/testData/ir/irText/types/coercionToUnitInLambdaReturnValue.kt");
}
@TestMetadata("genericPropertyReferenceType.kt")
public void testGenericPropertyReferenceType() throws Exception {
runTest("compiler/testData/ir/irText/types/genericPropertyReferenceType.kt");
@@ -0,0 +1,12 @@
FILE fqName:<root> fileName:/coercionToUnitInLambdaReturnValue.kt
FUN name:use visibility:public modality:FINAL <> (fn:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:fn index:0 type:kotlin.Function0<kotlin.Unit>
BLOCK_BODY
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CALL 'public final fun use (fn: kotlin.Function0<kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
fn: FUN_EXPR type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Unit declared in <root>.test'
CONST Int type=kotlin.Int value=42
@@ -0,0 +1,7 @@
// !LANGUAGE: +NewInference
fun use(fn: () -> Unit) {}
fun test() {
use { 42 }
}
@@ -0,0 +1,12 @@
FILE fqName:<root> fileName:/coercionToUnitInLambdaReturnValue.kt
FUN name:use visibility:public modality:FINAL <> (fn:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:fn index:0 type:kotlin.Function0<kotlin.Unit>
BLOCK_BODY
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CALL 'public final fun use (fn: kotlin.Function0<kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
fn: FUN_EXPR type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CONST Int type=kotlin.Int value=42
@@ -1826,6 +1826,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
runTest("compiler/testData/ir/irText/types/asOnPlatformType.kt");
}
@TestMetadata("coercionToUnitInLambdaReturnValue.kt")
public void testCoercionToUnitInLambdaReturnValue() throws Exception {
runTest("compiler/testData/ir/irText/types/coercionToUnitInLambdaReturnValue.kt");
}
@TestMetadata("genericPropertyReferenceType.kt")
public void testGenericPropertyReferenceType() throws Exception {
runTest("compiler/testData/ir/irText/types/genericPropertyReferenceType.kt");