[FIR2IR] Generate IR for unbound symbols in allowNonCachedDeclarations mode

`allowNonCachedDeclarations` mode allows referring source declaration which
  does not belong to the set of sources passed to fir2ir (e.g. for debugger
  support). So if code refers to such declaration, fir2ir creates symbol
  for it but not the IR declaration itself
This commit is contained in:
Dmitriy Novozhilov
2023-11-15 14:08:11 +02:00
committed by Space Team
parent c9ff0c41fc
commit 3dff232710
19 changed files with 208 additions and 27 deletions
@@ -0,0 +1,3 @@
LocalDelegate[name: x; isMutated: true; displayText: x$delegate]
lvar x: R|kotlin/String|
R|kotlin/String|
@@ -0,0 +1,16 @@
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.String) returnType:kotlin.String
VALUE_PARAMETER SHARED_VARIABLE_IN_EVALUATOR_FRAGMENT name:p0 index:0 type:kotlin.String [assignable]
EXPRESSION_BODY
BLOCK type=kotlin.String origin=null
SET_VAR 'p0: kotlin.String [assignable] declared in <root>.CodeFragment.run' type=kotlin.Unit origin=null
CONST String type=kotlin.String value="O"
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS
$this: GET_VAR 'p0: kotlin.String [assignable] declared in <root>.CodeFragment.run' type=kotlin.String origin=null
other: CONST String type=kotlin.String value="K"
@@ -0,0 +1,16 @@
import kotlin.reflect.KProperty
class Delegate(private var value: String) {
operator fun getValue(thisRef: Any?, property: KProperty<*>): String {
return value
}
operator fun setValue(thisRef: Any?, property: KProperty<*>, value: String) {
this.value = value
}
}
fun test() {
var x by Delegate("a")
<caret>x
}
@@ -0,0 +1,5 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(p0: java.lang.String): java.lang.String
}
@@ -0,0 +1,3 @@
Local[name: x; isMutated: true; displayText: x]
lvar x: R|kotlin/String|
R|kotlin/String|
@@ -0,0 +1,16 @@
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.String) returnType:kotlin.String
VALUE_PARAMETER SHARED_VARIABLE_IN_EVALUATOR_FRAGMENT name:p0 index:0 type:kotlin.String [assignable]
EXPRESSION_BODY
BLOCK type=kotlin.String origin=null
SET_VAR 'p0: kotlin.String [assignable] declared in <root>.CodeFragment.run' type=kotlin.Unit origin=null
CONST String type=kotlin.String value="O"
CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS
$this: GET_VAR 'p0: kotlin.String [assignable] declared in <root>.CodeFragment.run' type=kotlin.String origin=null
other: CONST String type=kotlin.String value="K"
@@ -0,0 +1,4 @@
fun test() {
var x = "a"
<caret>x
}
@@ -0,0 +1,5 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(p0: java.lang.String): java.lang.String
}