FIR2IR: introduce implicit casts for extension receivers

This commit is contained in:
Jinseong Jeon
2020-12-10 22:16:31 -08:00
committed by TeamCityServer
parent 6e9ac6b333
commit f7ade2b0b8
9 changed files with 24 additions and 12 deletions
@@ -9,5 +9,5 @@ private operator fun J.component2(): Int {
fun test() {
val <destruct>: J? = j()
val a: Int = <destruct>.component1()
val b: Int = <destruct>.component2()
val b: Int = <destruct> /*!! J */.component2()
}
@@ -18,4 +18,5 @@ FILE fqName:<root> fileName:/implicitNotNullInDestructuringAssignment.kt
$receiver: GET_VAR 'val tmp_0: <root>.J? [val] declared in <root>.test' type=<root>.J? origin=null
VAR name:b type:kotlin.Int [val]
CALL 'private final fun component2 (): kotlin.Int [operator] declared in <root>' type=kotlin.Int origin=null
$receiver: GET_VAR 'val tmp_0: <root>.J? [val] declared in <root>.test' type=<root>.J? origin=null
$receiver: TYPE_OP type=<root>.J origin=IMPLICIT_NOTNULL typeOperand=<root>.J
GET_VAR 'val tmp_0: <root>.J? [val] declared in <root>.test' type=<root>.J? origin=null
@@ -80,7 +80,7 @@ fun test3() {
}
fun test4() {
val <destruct>: IndexedValue<P?> = listOfNotNull().withIndex<P?>().first<IndexedValue<P?>>()
val <destruct>: IndexedValue<P?> = listOfNotNull() /*!! List<P?> */.withIndex<P?>().first<IndexedValue<P?>>()
val x: Int = <destruct>.component1()
val y: P? = <destruct>.component2()
use(x = x, y = y /*!! P */)
@@ -179,7 +179,8 @@ FILE fqName:<root> fileName:/enhancedNullabilityInDestructuringAssignment.kt
<T>: kotlin.collections.IndexedValue<<root>.P?>
$receiver: CALL 'public final fun withIndex <T> (): kotlin.collections.Iterable<kotlin.collections.IndexedValue<T of kotlin.collections.withIndex>> declared in kotlin.collections' type=kotlin.collections.Iterable<kotlin.collections.IndexedValue<<root>.P?>> origin=null
<T>: <root>.P?
$receiver: CALL 'public open fun listOfNotNull (): kotlin.collections.List<<root>.P?>? declared in <root>.J' type=kotlin.collections.List<<root>.P?>? origin=null
$receiver: TYPE_OP type=kotlin.collections.List<<root>.P?> origin=IMPLICIT_NOTNULL typeOperand=kotlin.collections.List<<root>.P?>
CALL 'public open fun listOfNotNull (): kotlin.collections.List<<root>.P?>? declared in <root>.J' type=kotlin.collections.List<<root>.P?>? origin=null
VAR name:x type:kotlin.Int [val]
CALL 'public final fun component1 (): kotlin.Int [operator] declared in kotlin.collections.IndexedValue' type=kotlin.Int origin=null
$this: GET_VAR 'val tmp_3: kotlin.collections.IndexedValue<<root>.P?> [val] declared in <root>.test4' type=kotlin.collections.IndexedValue<<root>.P?> origin=null
@@ -14,9 +14,9 @@ class C {
}
fun testExt() {
s().extension()
s() /*!! String */.extension()
}
fun C.testMemberExt() {
(<this>, s()).memberExtension()
(<this>, s() /*!! String */).memberExtension()
}
@@ -28,10 +28,12 @@ FILE fqName:<root> fileName:/nullabilityAssertionOnExtensionReceiver.kt
FUN name:testExt visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
CALL 'public final fun extension (): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
$receiver: CALL 'public open fun s (): kotlin.String? declared in <root>.J' type=kotlin.String? origin=null
$receiver: TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
CALL 'public open fun s (): kotlin.String? declared in <root>.J' type=kotlin.String? origin=null
FUN name:testMemberExt visibility:public modality:FINAL <> ($receiver:<root>.C) returnType:kotlin.Unit
$receiver: VALUE_PARAMETER name:<this> type:<root>.C
BLOCK_BODY
CALL 'public final fun memberExtension (): kotlin.Unit declared in <root>.C' type=kotlin.Unit origin=null
$this: GET_VAR '<this>: <root>.C declared in <root>.testMemberExt' type=<root>.C origin=null
$receiver: CALL 'public open fun s (): kotlin.String? declared in <root>.J' type=kotlin.String? origin=null
$receiver: TYPE_OP type=kotlin.String origin=IMPLICIT_NOTNULL typeOperand=kotlin.String
CALL 'public open fun s (): kotlin.String? declared in <root>.J' type=kotlin.String? origin=null