[Analysis API] Support non-JVM platforms in code fragments

The 'evalJs' test is not available, as there is no proper support for
klib loading in non-standalone Analysis API yet.

^KT-64197 Fixed
This commit is contained in:
Yan Zhulanow
2023-12-22 15:49:10 +09:00
committed by Space Team
parent 75abae23d8
commit 5179462632
20 changed files with 212 additions and 23 deletions
@@ -0,0 +1,13 @@
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:test.Foo) returnType:kotlin.Unit
VALUE_PARAMETER name:p0 index:0 type:test.Foo
EXPRESSION_BODY
BLOCK type=kotlin.Unit origin=null
CALL 'public final fun call (): kotlin.Unit [expect] declared in test.Foo' type=kotlin.Unit origin=null
$this: GET_VAR 'p0: test.Foo declared in <root>.CodeFragment.run' type=test.Foo origin=null
@@ -0,0 +1,23 @@
// !LANGUAGE: +MultiPlatformProjects
// MODULE: common
// TARGET_PLATFORM: Common
// FILE: Common.kt
package test
fun test(foo: Foo) {
<caret>foo.call()
}
expect class Foo {
fun call()
}
// MODULE: main()()(common)
// TARGET_PLATFORM: JVM
// FILE: Jvm.kt
package test
actual class Foo {
fun call() {}
}
@@ -0,0 +1,5 @@
public final class CodeFragment {
// source: 'fragment.kt'
public method <init>(): void
public final static method run(p0: test.Foo): void
}
@@ -0,0 +1,6 @@
// WITH_STDLIB
// TARGET_PLATFORM: JVM
fun foo(node: kotlinx.dom.Node) {
<caret>check(node.isElement)
}
@@ -0,0 +1,4 @@
Diagnostics from elements:
for PSI element of type KtNameReferenceExpression at (1,1-5)
UNRESOLVED_REFERENCE text ranges: [(0,4)]
PSI: KtNameReferenceExpression at (1,1-5)
@@ -0,0 +1,6 @@
// WITH_STDLIB
// TARGET_PLATFORM: JVM, JS
fun foo(node: kotlinx.dom.Node) {
<caret>check(node.isElement)
}
@@ -0,0 +1,4 @@
Diagnostics from elements:
for PSI element of type KtNameReferenceExpression at (1,1-5)
UNRESOLVED_REFERENCE text ranges: [(0,4)]
PSI: KtNameReferenceExpression at (1,1-5)