FIR. Refactor smart-cast representation in FIR tree
Make smart-casts non-transparent expression without delegation to underlying FirQualifiedAccessExpression, as children delegation in fir tree has unclear semantics Remove two different kinds of tree nodes for smart-casts
This commit is contained in:
committed by
teamcity
parent
bc9db58b3c
commit
513af2dfbc
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
fun test(obj: Any): String {
|
||||
return when {
|
||||
obj !is Iterable<*> -> "not iterable"
|
||||
<expr>obj</expr> !is Collection<*> -> "not collection"
|
||||
else -> "unknown"
|
||||
}
|
||||
}
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
KtSuccessCallInfo:
|
||||
call = KtSimpleVariableAccessCall:
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = null
|
||||
signature = KtVariableLikeSignature:
|
||||
name = obj
|
||||
receiverType = null
|
||||
returnType = kotlin.Any
|
||||
symbol = obj: kotlin.Any
|
||||
callableIdIfNonLocal = null
|
||||
simpleAccess = Read:
|
||||
|
||||
typeArgumentsMapping = {}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
interface Foo {
|
||||
fun Bar.foo()
|
||||
}
|
||||
|
||||
interface Bar {}
|
||||
|
||||
inline fun <T, R> myWith(argument: T, lambda: T.() -> R): R {
|
||||
argument.lambda()
|
||||
}
|
||||
|
||||
fun Any.action(other: Any) {
|
||||
if (this is Foo) {
|
||||
with(other) {
|
||||
this as Bar
|
||||
<expr>foo</expr>()
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
expression: foo
|
||||
isStable: null
|
||||
smartCastType: null
|
||||
receiver: DISPATCH
|
||||
smartCastType: Foo
|
||||
receiver: EXTENSION
|
||||
smartCastType: Bar
|
||||
@@ -0,0 +1,9 @@
|
||||
interface Foo {
|
||||
fun function()
|
||||
}
|
||||
|
||||
fun foo(parameter: Any) {
|
||||
if (parameter is Foo) {
|
||||
<caret>parameter.function()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: parameter: kotlin.Any
|
||||
@@ -0,0 +1,9 @@
|
||||
interface WithInvoke {
|
||||
operator fun invoke() {}
|
||||
}
|
||||
|
||||
fun foo(parameter: Any) {
|
||||
if (parameter is WithInvoke) {
|
||||
<caret>parameter()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: parameter: kotlin.Any
|
||||
Reference in New Issue
Block a user