diff --git a/idea/testData/slicer/inflow/extensionLambdaReceiver.leafGroups.txt b/idea/testData/slicer/inflow/extensionLambdaReceiver.leafGroups.txt
index 34b9a6d1a62..ca3caa174f3 100644
--- a/idea/testData/slicer/inflow/extensionLambdaReceiver.leafGroups.txt
+++ b/idea/testData/slicer/inflow/extensionLambdaReceiver.leafGroups.txt
@@ -2,8 +2,8 @@
6 val v = this
6 val v = this
5 [LAMBDA CALLS RECEIVER] with("A") {
-66 (INLINE CALL with) [LAMBDA CALLS RECEIVER] public inline fun with(receiver: T, block: T.() -> R): R {
-70 (INLINE CALL with) return receiver.block()
-66 (INLINE CALL with) public inline fun with(receiver: T, block: T.() -> R): R {
+LIB (INLINE CALL with) [LAMBDA CALLS RECEIVER] public inline fun with(receiver: T, block: T.() -> R): R {
+LIB (INLINE CALL with) return receiver.block()
+LIB (INLINE CALL with) public inline fun with(receiver: T, block: T.() -> R): R {
5 with("A") {
diff --git a/idea/testData/slicer/inflow/extensionLambdaReceiver.results.txt b/idea/testData/slicer/inflow/extensionLambdaReceiver.results.txt
index e1603d8eec8..220ad91e7de 100644
--- a/idea/testData/slicer/inflow/extensionLambdaReceiver.results.txt
+++ b/idea/testData/slicer/inflow/extensionLambdaReceiver.results.txt
@@ -1,7 +1,7 @@
6 val v = this
6 val v = this
5 [LAMBDA CALLS RECEIVER] with("A") {
-66 (INLINE CALL with) [LAMBDA CALLS RECEIVER] public inline fun with(receiver: T, block: T.() -> R): R {
-70 (INLINE CALL with) return receiver.block()
-66 (INLINE CALL with) public inline fun with(receiver: T, block: T.() -> R): R {
+LIB (INLINE CALL with) [LAMBDA CALLS RECEIVER] public inline fun with(receiver: T, block: T.() -> R): R {
+LIB (INLINE CALL with) return receiver.block()
+LIB (INLINE CALL with) public inline fun with(receiver: T, block: T.() -> R): R {
5 with("A") {
diff --git a/idea/testData/slicer/inflow/inlineExtensionImplicitReceiver.leafGroups.txt b/idea/testData/slicer/inflow/inlineExtensionImplicitReceiver.leafGroups.txt
index 82245569686..9eb412f1de6 100644
--- a/idea/testData/slicer/inflow/inlineExtensionImplicitReceiver.leafGroups.txt
+++ b/idea/testData/slicer/inflow/inlineExtensionImplicitReceiver.leafGroups.txt
@@ -1,8 +1,8 @@
4 class C
12 fun C.extensionFun() {}
7 [LAMBDA CALLS RECEIVER] val c = C().apply {
-79 (INLINE CALL apply) [LAMBDA CALLS RECEIVER] public inline fun T.apply(block: T.() -> Unit): T {
-79 (INLINE CALL apply) public inline fun T.apply(block: T.() -> Unit): T {
+LIB (INLINE CALL apply) [LAMBDA CALLS RECEIVER] public inline fun T.apply(block: T.() -> Unit): T {
+LIB (INLINE CALL apply) public inline fun T.apply(block: T.() -> Unit): T {
7 val c = C().apply {
4 class C
diff --git a/idea/testData/slicer/inflow/inlineExtensionImplicitReceiver.nullnessGroups.txt b/idea/testData/slicer/inflow/inlineExtensionImplicitReceiver.nullnessGroups.txt
index fd275aab3fd..f70a5275444 100644
--- a/idea/testData/slicer/inflow/inlineExtensionImplicitReceiver.nullnessGroups.txt
+++ b/idea/testData/slicer/inflow/inlineExtensionImplicitReceiver.nullnessGroups.txt
@@ -2,7 +2,7 @@
7 val c = C().apply {
12 fun C.extensionFun() {}
7 [LAMBDA CALLS RECEIVER] val c = C().apply {
-79 (INLINE CALL apply) [LAMBDA CALLS RECEIVER] public inline fun T.apply(block: T.() -> Unit): T {
-79 (INLINE CALL apply) public inline fun T.apply(block: T.() -> Unit): T {
+LIB (INLINE CALL apply) [LAMBDA CALLS RECEIVER] public inline fun T.apply(block: T.() -> Unit): T {
+LIB (INLINE CALL apply) public inline fun T.apply(block: T.() -> Unit): T {
7 val c = C().apply {
diff --git a/idea/testData/slicer/inflow/inlineExtensionImplicitReceiver.results.txt b/idea/testData/slicer/inflow/inlineExtensionImplicitReceiver.results.txt
index c60eb0744a0..55cfc2d7bbb 100644
--- a/idea/testData/slicer/inflow/inlineExtensionImplicitReceiver.results.txt
+++ b/idea/testData/slicer/inflow/inlineExtensionImplicitReceiver.results.txt
@@ -1,6 +1,6 @@
12 fun C.extensionFun() {}
7 [LAMBDA CALLS RECEIVER] val c = C().apply {
-79 (INLINE CALL apply) [LAMBDA CALLS RECEIVER] public inline fun T.apply(block: T.() -> Unit): T {
-79 (INLINE CALL apply) public inline fun T.apply(block: T.() -> Unit): T {
+LIB (INLINE CALL apply) [LAMBDA CALLS RECEIVER] public inline fun T.apply(block: T.() -> Unit): T {
+LIB (INLINE CALL apply) public inline fun T.apply(block: T.() -> Unit): T {
7 val c = C().apply {
4 class C
diff --git a/idea/testData/slicer/inflow/inlineFunctionManyCalls.leafGroups.txt b/idea/testData/slicer/inflow/inlineFunctionManyCalls.leafGroups.txt
index 6564e404225..834abfd14e4 100644
--- a/idea/testData/slicer/inflow/inlineFunctionManyCalls.leafGroups.txt
+++ b/idea/testData/slicer/inflow/inlineFunctionManyCalls.leafGroups.txt
@@ -20,9 +20,9 @@
4 fun Any.extensionFun() {
29 it.extensionFun()
28 [LAMBDA CALLS ARGUMENT #0] "A".let {
-108 (INLINE CALL let) [LAMBDA CALLS ARGUMENT #0] public inline fun T.let(block: (T) -> R): R {
-112 (INLINE CALL let) return block(this)
-108 (INLINE CALL let) public inline fun T.let(block: (T) -> R): R {
+LIB (INLINE CALL let) [LAMBDA CALLS ARGUMENT #0] public inline fun T.let(block: (T) -> R): R {
+LIB (INLINE CALL let) return block(this)
+LIB (INLINE CALL let) public inline fun T.let(block: (T) -> R): R {
28 "A".let {
20 withNoInline(1) {
diff --git a/idea/testData/slicer/inflow/inlineFunctionManyCalls.nullnessGroups.txt b/idea/testData/slicer/inflow/inlineFunctionManyCalls.nullnessGroups.txt
index f0ad1987167..b0019448f72 100644
--- a/idea/testData/slicer/inflow/inlineFunctionManyCalls.nullnessGroups.txt
+++ b/idea/testData/slicer/inflow/inlineFunctionManyCalls.nullnessGroups.txt
@@ -23,7 +23,7 @@
51 val result = receiver.block()
50 fun withNoInline(receiver: T, block: T.() -> R): R {
24 withNoInline(2) {
-37 it.extensionFun()
+29 it.extensionFun()
4 fun Any.extensionFun() {
29 it.extensionFun()
37 it.extensionFun()
diff --git a/idea/testData/slicer/inflow/inlineFunctionManyCalls.results.txt b/idea/testData/slicer/inflow/inlineFunctionManyCalls.results.txt
index 530943222a2..aabb51d35cc 100644
--- a/idea/testData/slicer/inflow/inlineFunctionManyCalls.results.txt
+++ b/idea/testData/slicer/inflow/inlineFunctionManyCalls.results.txt
@@ -18,9 +18,9 @@
24 withNoInline(2) {
29 it.extensionFun()
28 [LAMBDA CALLS ARGUMENT #0] "A".let {
-108 (INLINE CALL let) [LAMBDA CALLS ARGUMENT #0] public inline fun T.let(block: (T) -> R): R {
-112 (INLINE CALL let) return block(this)
-108 (INLINE CALL let) public inline fun T.let(block: (T) -> R): R {
+LIB (INLINE CALL let) [LAMBDA CALLS ARGUMENT #0] public inline fun T.let(block: (T) -> R): R {
+LIB (INLINE CALL let) return block(this)
+LIB (INLINE CALL let) public inline fun T.let(block: (T) -> R): R {
28 "A".let {
37 it.extensionFun()
36 [LAMBDA CALLS ARGUMENT #0] "D".letNoInline {
diff --git a/idea/testData/slicer/inflow/onFunctionReceiverType.leafGroups.txt b/idea/testData/slicer/inflow/onFunctionReceiverType.leafGroups.txt
index 250d10e08a9..06bdfcd36f5 100644
--- a/idea/testData/slicer/inflow/onFunctionReceiverType.leafGroups.txt
+++ b/idea/testData/slicer/inflow/onFunctionReceiverType.leafGroups.txt
@@ -18,8 +18,8 @@
18 with(123) {
8 fun Any.extensionFun() {
18 [LAMBDA CALLS RECEIVER] with(123) {
-66 (INLINE CALL with) [LAMBDA CALLS RECEIVER] public inline fun with(receiver: T, block: T.() -> R): R {
-70 (INLINE CALL with) return receiver.block()
-66 (INLINE CALL with) public inline fun with(receiver: T, block: T.() -> R): R {
+LIB (INLINE CALL with) [LAMBDA CALLS RECEIVER] public inline fun with(receiver: T, block: T.() -> R): R {
+LIB (INLINE CALL with) return receiver.block()
+LIB (INLINE CALL with) public inline fun with(receiver: T, block: T.() -> R): R {
18 with(123) {
diff --git a/idea/testData/slicer/inflow/onFunctionReceiverType.nullnessGroups.txt b/idea/testData/slicer/inflow/onFunctionReceiverType.nullnessGroups.txt
index d3f670b006a..8b0a64b9f08 100644
--- a/idea/testData/slicer/inflow/onFunctionReceiverType.nullnessGroups.txt
+++ b/idea/testData/slicer/inflow/onFunctionReceiverType.nullnessGroups.txt
@@ -8,9 +8,9 @@
18 with(123) {
8 fun Any.extensionFun() {
18 [LAMBDA CALLS RECEIVER] with(123) {
-66 (INLINE CALL with) [LAMBDA CALLS RECEIVER] public inline fun with(receiver: T, block: T.() -> R): R {
-70 (INLINE CALL with) return receiver.block()
-66 (INLINE CALL with) public inline fun with(receiver: T, block: T.() -> R): R {
+LIB (INLINE CALL with) [LAMBDA CALLS RECEIVER] public inline fun with(receiver: T, block: T.() -> R): R {
+LIB (INLINE CALL with) return receiver.block()
+LIB (INLINE CALL with) public inline fun with(receiver: T, block: T.() -> R): R {
18 with(123) {
24 "A".foo()
8 fun Any.extensionFun() {
diff --git a/idea/testData/slicer/inflow/onFunctionReceiverType.results.txt b/idea/testData/slicer/inflow/onFunctionReceiverType.results.txt
index 6b1ccc0b80a..c27db30a17a 100644
--- a/idea/testData/slicer/inflow/onFunctionReceiverType.results.txt
+++ b/idea/testData/slicer/inflow/onFunctionReceiverType.results.txt
@@ -5,7 +5,7 @@
12 "".extensionFun()
14 1.extensionFun()
18 [LAMBDA CALLS RECEIVER] with(123) {
-66 (INLINE CALL with) [LAMBDA CALLS RECEIVER] public inline fun with(receiver: T, block: T.() -> R): R {
-70 (INLINE CALL with) return receiver.block()
-66 (INLINE CALL with) public inline fun with(receiver: T, block: T.() -> R): R {
+LIB (INLINE CALL with) [LAMBDA CALLS RECEIVER] public inline fun with(receiver: T, block: T.() -> R): R {
+LIB (INLINE CALL with) return receiver.block()
+LIB (INLINE CALL with) public inline fun with(receiver: T, block: T.() -> R): R {
18 with(123) {
diff --git a/idea/testData/slicer/outflow/letResult.results.txt b/idea/testData/slicer/outflow/letResult.results.txt
index a20ab5fe832..2c332ba0158 100644
--- a/idea/testData/slicer/outflow/letResult.results.txt
+++ b/idea/testData/slicer/outflow/letResult.results.txt
@@ -1,8 +1,8 @@
4 fun foo(p: String) {
5 val v1 = p.let { value -> bar(value) }
-108 (INLINE CALL let) public inline fun T.let(block: (T) -> R): R {
-112 (INLINE CALL let) return block(this)
-108 (INLINE CALL let) [LAMBDA PARAMETER #0] public inline fun T.let(block: (T) -> R): R {
+LIB (INLINE CALL let) public inline fun T.let(block: (T) -> R): R {
+LIB (INLINE CALL let) return block(this)
+LIB (INLINE CALL let) [LAMBDA PARAMETER #0] public inline fun T.let(block: (T) -> R): R {
5 [LAMBDA PARAMETER #0] val v1 = p.let { value -> bar(value) }
5 val v1 = p.let { value -> bar(value) }
5 val v1 = p.let { value -> bar(value) }
@@ -12,37 +12,37 @@
5 val v1 = p.let { value -> bar(value) }
5 val v1 = p.let { value -> bar(value) }
5 [LAMBDA CALLS] val v1 = p.let { value -> bar(value) }
-108 (INLINE CALL let) [LAMBDA CALLS] public inline fun T.let(block: (T) -> R): R {
-112 (INLINE CALL let) return block(this)
+LIB (INLINE CALL let) [LAMBDA CALLS] public inline fun T.let(block: (T) -> R): R {
+LIB (INLINE CALL let) return block(this)
5 val v1 = p.let { value -> bar(value) }
5 val v1 = p.let { value -> bar(value) }
7 val v2 = p.let { it }
-108 (INLINE CALL let) public inline fun T.let(block: (T) -> R): R {
-112 (INLINE CALL let) return block(this)
-108 (INLINE CALL let) [LAMBDA PARAMETER #0] public inline fun T.let(block: (T) -> R): R {
+LIB (INLINE CALL let) public inline fun T.let(block: (T) -> R): R {
+LIB (INLINE CALL let) return block(this)
+LIB (INLINE CALL let) [LAMBDA PARAMETER #0] public inline fun T.let(block: (T) -> R): R {
7 [LAMBDA PARAMETER #0] val v2 = p.let { it }
7 val v2 = p.let { it }
7 val v2 = p.let { it }
7 [LAMBDA CALLS] val v2 = p.let { it }
-108 (INLINE CALL let) [LAMBDA CALLS] public inline fun T.let(block: (T) -> R): R {
-112 (INLINE CALL let) return block(this)
+LIB (INLINE CALL let) [LAMBDA CALLS] public inline fun T.let(block: (T) -> R): R {
+LIB (INLINE CALL let) return block(this)
7 val v2 = p.let { it }
7 val v2 = p.let { it }
9 val v3 = p.let {
-108 (INLINE CALL let) public inline fun T.let(block: (T) -> R): R {
-112 (INLINE CALL let) return block(this)
-108 (INLINE CALL let) [LAMBDA PARAMETER #0] public inline fun T.let(block: (T) -> R): R {
+LIB (INLINE CALL let) public inline fun T.let(block: (T) -> R): R {
+LIB (INLINE CALL let) return block(this)
+LIB (INLINE CALL let) [LAMBDA PARAMETER #0] public inline fun T.let(block: (T) -> R): R {
9 [LAMBDA PARAMETER #0] val v3 = p.let {
14 val v4 = p.let(::zoo)
-108 (INLINE CALL let) public inline fun T.let(block: (T) -> R): R {
-112 (INLINE CALL let) return block(this)
-108 (INLINE CALL let) [LAMBDA PARAMETER #0] public inline fun T.let(block: (T) -> R): R {
+LIB (INLINE CALL let) public inline fun T.let(block: (T) -> R): R {
+LIB (INLINE CALL let) return block(this)
+LIB (INLINE CALL let) [LAMBDA PARAMETER #0] public inline fun T.let(block: (T) -> R): R {
14 [LAMBDA PARAMETER #0] val v4 = p.let(::zoo)
18 fun zoo(s: String) = s
18 fun zoo(s: String) = s
18 fun zoo(s: String) = s
14 [LAMBDA CALLS] val v4 = p.let(::zoo)
-108 (INLINE CALL let) [LAMBDA CALLS] public inline fun T.let(block: (T) -> R): R {
-112 (INLINE CALL let) return block(this)
+LIB (INLINE CALL let) [LAMBDA CALLS] public inline fun T.let(block: (T) -> R): R {
+LIB (INLINE CALL let) return block(this)
14 val v4 = p.let(::zoo)
14 val v4 = p.let(::zoo)
diff --git a/idea/testData/slicer/outflow/withResult.results.txt b/idea/testData/slicer/outflow/withResult.results.txt
index 1a2f96cbdd0..29170a8fcf5 100644
--- a/idea/testData/slicer/outflow/withResult.results.txt
+++ b/idea/testData/slicer/outflow/withResult.results.txt
@@ -1,20 +1,20 @@
4 fun String.foo(p: String) {
5 val v1 = with(p) { this }
-66 (INLINE CALL with) public inline fun with(receiver: T, block: T.() -> R): R {
-70 (INLINE CALL with) return receiver.block()
-66 (INLINE CALL with) [LAMBDA RECEIVER] public inline fun with(receiver: T, block: T.() -> R): R {
+LIB (INLINE CALL with) public inline fun with(receiver: T, block: T.() -> R): R {
+LIB (INLINE CALL with) return receiver.block()
+LIB (INLINE CALL with) [LAMBDA RECEIVER] public inline fun with(receiver: T, block: T.() -> R): R {
5 [LAMBDA RECEIVER] val v1 = with(p) { this }
5 val v1 = with(p) { this }
5 val v1 = with(p) { this }
5 [LAMBDA CALLS] val v1 = with(p) { this }
-66 (INLINE CALL with) [LAMBDA CALLS] public inline fun with(receiver: T, block: T.() -> R): R {
-70 (INLINE CALL with) return receiver.block()
+LIB (INLINE CALL with) [LAMBDA CALLS] public inline fun with(receiver: T, block: T.() -> R): R {
+LIB (INLINE CALL with) return receiver.block()
5 val v1 = with(p) { this }
5 val v1 = with(p) { this }
7 val v2 = with(p) { bar(this) }
-66 (INLINE CALL with) public inline fun with(receiver: T, block: T.() -> R): R {
-70 (INLINE CALL with) return receiver.block()
-66 (INLINE CALL with) [LAMBDA RECEIVER] public inline fun with(receiver: T, block: T.() -> R): R {
+LIB (INLINE CALL with) public inline fun with(receiver: T, block: T.() -> R): R {
+LIB (INLINE CALL with) return receiver.block()
+LIB (INLINE CALL with) [LAMBDA RECEIVER] public inline fun with(receiver: T, block: T.() -> R): R {
7 [LAMBDA RECEIVER] val v2 = with(p) { bar(this) }
7 val v2 = with(p) { bar(this) }
14 fun bar(s: String) = s
@@ -23,25 +23,25 @@
7 val v2 = with(p) { bar(this) }
7 val v2 = with(p) { bar(this) }
7 [LAMBDA CALLS] val v2 = with(p) { bar(this) }
-66 (INLINE CALL with) [LAMBDA CALLS] public inline fun with(receiver: T, block: T.() -> R): R {
-70 (INLINE CALL with) return receiver.block()
+LIB (INLINE CALL with) [LAMBDA CALLS] public inline fun with(receiver: T, block: T.() -> R): R {
+LIB (INLINE CALL with) return receiver.block()
7 val v2 = with(p) { bar(this) }
7 val v2 = with(p) { bar(this) }
9 val v3 = with(p) { this@foo }
-66 (INLINE CALL with) public inline fun with(receiver: T, block: T.() -> R): R {
-70 (INLINE CALL with) return receiver.block()
-66 (INLINE CALL with) [LAMBDA RECEIVER] public inline fun with(receiver: T, block: T.() -> R): R {
+LIB (INLINE CALL with) public inline fun with(receiver: T, block: T.() -> R): R {
+LIB (INLINE CALL with) return receiver.block()
+LIB (INLINE CALL with) [LAMBDA RECEIVER] public inline fun with(receiver: T, block: T.() -> R): R {
9 [LAMBDA RECEIVER] val v3 = with(p) { this@foo }
11 val v4 = with(p, ::zoo)
-66 (INLINE CALL with) public inline fun with(receiver: T, block: T.() -> R): R {
-70 (INLINE CALL with) return receiver.block()
-66 (INLINE CALL with) [LAMBDA RECEIVER] public inline fun with(receiver: T, block: T.() -> R): R {
+LIB (INLINE CALL with) public inline fun with(receiver: T, block: T.() -> R): R {
+LIB (INLINE CALL with) return receiver.block()
+LIB (INLINE CALL with) [LAMBDA RECEIVER] public inline fun with(receiver: T, block: T.() -> R): R {
11 [LAMBDA RECEIVER] val v4 = with(p, ::zoo)
15 fun zoo(s: String) = s
15 fun zoo(s: String) = s
15 fun zoo(s: String) = s
11 [LAMBDA CALLS] val v4 = with(p, ::zoo)
-66 (INLINE CALL with) [LAMBDA CALLS] public inline fun with(receiver: T, block: T.() -> R): R {
-70 (INLINE CALL with) return receiver.block()
+LIB (INLINE CALL with) [LAMBDA CALLS] public inline fun with(receiver: T, block: T.() -> R): R {
+LIB (INLINE CALL with) return receiver.block()
11 val v4 = with(p, ::zoo)
11 val v4 = with(p, ::zoo)
diff --git a/idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTestUtil.kt b/idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTestUtil.kt
index 1d5647de516..d9c1bb9fe3e 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTestUtil.kt
+++ b/idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTestUtil.kt
@@ -8,12 +8,14 @@ package org.jetbrains.kotlin.idea.slicer
import com.intellij.analysis.AnalysisScope
import com.intellij.ide.projectView.TreeStructureProvider
import com.intellij.ide.util.treeView.AbstractTreeStructureBase
+import com.intellij.psi.search.GlobalSearchScope
import com.intellij.slicer.DuplicateMap
import com.intellij.slicer.SliceAnalysisParams
import com.intellij.slicer.SliceNode
import com.intellij.slicer.SliceRootNode
import com.intellij.usages.TextChunk
import org.jetbrains.kotlin.psi.KtFile
+import org.jetbrains.kotlin.psi.psiUtil.contains
import org.jetbrains.kotlin.psi.psiUtil.startOffset
import org.jetbrains.kotlin.test.InTextDirectivesUtils
import java.awt.Font
@@ -30,6 +32,9 @@ internal class TestSliceTreeStructure(private val rootNode: SliceNode) : Abstrac
}
internal fun buildTreeRepresentation(rootNode: SliceNode): String {
+ val project = rootNode.element!!.project!!
+ val projectScope = GlobalSearchScope.projectScope(project)
+
fun TextChunk.render(): String {
var text = text
if (attributes.fontType == Font.BOLD) {
@@ -58,7 +63,11 @@ internal fun buildTreeRepresentation(rootNode: SliceNode): String {
else -> {
val chunks = usage.text
- append(chunks.first().render() + " ")
+ if (!projectScope.contains(usage.element)) {
+ append("LIB ")
+ } else {
+ append(chunks.first().render() + " ")
+ }
append("\t".repeat(indent))
if (usage is KotlinSliceDereferenceUsage) {
append("DEREFERENCE: ")