[LL API] Handle smart casts correctly on 'FirCodeFragment' analysis
This commit is contained in:
+6
@@ -0,0 +1,6 @@
|
||||
ExtensionReceiver[name: dumbWith; isMutated: false; displayText: this@dumbWith]
|
||||
dumbWith@fun R|kotlin/Any?|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN>
|
||||
R|kotlin/Any?|
|
||||
ExtensionReceiver[name: dumbWith; isMutated: false; displayText: this@dumbWith]
|
||||
dumbWith@fun R|kotlin/Any?|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=UNKNOWN>
|
||||
R|kotlin/Any?|
|
||||
+1
@@ -0,0 +1 @@
|
||||
length + foo.length
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
MODULE_FRAGMENT
|
||||
FILE fqName:<root> fileName:fragment.kt
|
||||
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
FUN name:run visibility:public modality:FINAL <> (p0:kotlin.Any?, p1:kotlin.Any?) returnType:kotlin.Int
|
||||
VALUE_PARAMETER name:p0 index:0 type:kotlin.Any?
|
||||
VALUE_PARAMETER name:p1 index:1 type:kotlin.Any?
|
||||
EXPRESSION_BODY
|
||||
BLOCK type=kotlin.Int origin=null
|
||||
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PLUS
|
||||
$this: CALL 'public open fun <get-length> (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String
|
||||
GET_VAR 'p0: kotlin.Any? declared in <root>.CodeFragment.run' type=kotlin.Any? origin=null
|
||||
other: CALL 'public open fun <get-length> (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: CALL 'public final fun <get-foo> (): kotlin.String declared in <root>.Foo' type=kotlin.String origin=GET_PROPERTY
|
||||
$this: TYPE_OP type=<root>.Foo origin=IMPLICIT_CAST typeOperand=<root>.Foo
|
||||
GET_VAR 'p1: kotlin.Any? declared in <root>.CodeFragment.run' type=kotlin.Any? origin=null
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
fun test() {
|
||||
dumbWith("Hello, world!") {
|
||||
if (this is String) {
|
||||
dumbWith(Foo()) {
|
||||
if (this is Foo) {
|
||||
<caret>val x = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline fun dumbWith(obj: Any?, block: Any?.() -> Unit) {
|
||||
obj.block()
|
||||
}
|
||||
|
||||
class Foo {
|
||||
val foo: String = "foo"
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
public final class CodeFragment {
|
||||
// source: 'fragment.kt'
|
||||
public method <init>(): void
|
||||
public final static method run(p0: java.lang.Object, p1: java.lang.Object): int
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
Local[name: foo; isMutated: false; displayText: foo]
|
||||
foo: R|kotlin/Any?|
|
||||
R|kotlin/Any?|
|
||||
+1
@@ -0,0 +1 @@
|
||||
foo.call()
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
MODULE_FRAGMENT
|
||||
FILE fqName:<root> fileName:fragment.kt
|
||||
CLASS CLASS name:CodeFragment modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.CodeFragment
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.CodeFragment [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
FUN name:run visibility:public modality:FINAL <> (p0:kotlin.Any?) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:p0 index:0 type:kotlin.Any?
|
||||
EXPRESSION_BODY
|
||||
BLOCK type=kotlin.Unit origin=null
|
||||
CALL 'public final fun call (): kotlin.Unit declared in <root>.Foo' type=kotlin.Unit origin=null
|
||||
$this: TYPE_OP type=<root>.Foo origin=IMPLICIT_CAST typeOperand=<root>.Foo
|
||||
GET_VAR 'p0: kotlin.Any? declared in <root>.CodeFragment.run' type=kotlin.Any? origin=null
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fun test(foo: Any?) {
|
||||
if (foo is Foo) {
|
||||
<caret>val x = 0
|
||||
}
|
||||
}
|
||||
|
||||
class Foo {
|
||||
fun call() {}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
public final class CodeFragment {
|
||||
// source: 'fragment.kt'
|
||||
public method <init>(): void
|
||||
public final static method run(p0: java.lang.Object): void
|
||||
}
|
||||
Reference in New Issue
Block a user