diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/Any.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/Any.kt new file mode 100644 index 00000000000..507cf50b1da --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/Any.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + listOf("abc").count() +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/AnyToPrimitive.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/AnyToPrimitive.kt new file mode 100644 index 00000000000..85c6110a66a --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/AnyToPrimitive.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + listOf("abc", null).count() +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/Boolean.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/Boolean.kt new file mode 100644 index 00000000000..b10424bd03c --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/Boolean.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + booleanArrayOf(true, true, false).count() +} diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/Byte.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/Byte.kt new file mode 100644 index 00000000000..cae261d85e8 --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/Byte.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + setOf(1.toByte(), 20.toByte()).forEach { } +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/Char.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/Char.kt new file mode 100644 index 00000000000..678db74b2e7 --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/Char.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + charArrayOf('a', 'b', 'c').count() +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/Double.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/Double.kt new file mode 100644 index 00000000000..c1b73aaa2b6 --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/Double.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + DoubleArray(10).count() +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/FewTransitions1.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/FewTransitions1.kt new file mode 100644 index 00000000000..540cfb4b779 --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/FewTransitions1.kt @@ -0,0 +1,7 @@ +fun main(args: Array) { + byteArrayOf(10, 20) + .map { it.toString() } + .map { if (it == "10") null else 10 } + .map { 10 } + .contains(200) +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/FewTransitions2.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/FewTransitions2.kt new file mode 100644 index 00000000000..79ed0fa448a --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/FewTransitions2.kt @@ -0,0 +1,6 @@ +fun main(args: Array) { + "jetBrains".map { it.isLowerCase() } + .flatMap { linkedSetOf(1.2, 3.0) } + .map { it.toString() } + .count() +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/Float.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/Float.kt new file mode 100644 index 00000000000..78fcd2c3786 --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/Float.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + listOf(1.0f).contains(2.0f) +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/Int.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/Int.kt new file mode 100644 index 00000000000..0c3f217b916 --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/Int.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + intArrayOf(10).get(0) +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/Long.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/Long.kt new file mode 100644 index 00000000000..e804f75eb51 --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/Long.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + longArrayOf(1L, 2L).count { it < 2 } +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/NotNullToNullable.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/NotNullToNullable.kt new file mode 100644 index 00000000000..24a971a3390 --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/NotNullToNullable.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + sortedSetOf(10.0).map { null }.count() +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/NullableAny.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableAny.kt new file mode 100644 index 00000000000..0650a9f8c8f --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableAny.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + listOf(Any(), null).contains(10) +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/NullableAnyToPrimitive.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableAnyToPrimitive.kt new file mode 100644 index 00000000000..13f0f18c13b --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableAnyToPrimitive.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + listOf(Any(), null).map { 10 }.contains(10) +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/NullableBoolean.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableBoolean.kt new file mode 100644 index 00000000000..fdda65b9510 --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableBoolean.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + listOf(true, null, false).count() +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/NullableByte.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableByte.kt new file mode 100644 index 00000000000..bfaf0d9f4aa --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableByte.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + listOf(1.toByte(), null).forEach { } +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/NullableChar.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableChar.kt new file mode 100644 index 00000000000..9d131e49363 --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableChar.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + listOf(',', '.', null).component1() +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/NullableDouble.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableDouble.kt new file mode 100644 index 00000000000..ac84a7f55e6 --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableDouble.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + listOf(0.4, null).component2() +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/NullableFloat.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableFloat.kt new file mode 100644 index 00000000000..5393f35fa28 --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableFloat.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + listOf(0.4f, null).indexOf(0.3f) +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/NullableInt.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableInt.kt new file mode 100644 index 00000000000..90f4b007038 --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableInt.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + listOf(5, null).lastIndexOf(null) +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/NullableLong.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableLong.kt new file mode 100644 index 00000000000..d656f6f9f43 --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableLong.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + listOf(10L, null).isNotEmpty() +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/NullableShort.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableShort.kt new file mode 100644 index 00000000000..5214d31525c --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableShort.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + listOf(6.toShort(), null).last() +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/NullableToNotNull.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableToNotNull.kt new file mode 100644 index 00000000000..9ea14074f62 --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/NullableToNotNull.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + listOf(0.4, null).map { 10 }.count() +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/PrimitiveToAny.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/PrimitiveToAny.kt new file mode 100644 index 00000000000..6a87003c5b7 --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/PrimitiveToAny.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + listOf(20, 30).map { Any() }.contains(Any()) +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/PrimitiveToNullableAny.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/PrimitiveToNullableAny.kt new file mode 100644 index 00000000000..b966130d1ed --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/PrimitiveToNullableAny.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + listOf(20, 30).map { it.toString().toByteOrNull() }.count() +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/psi/collection/positive/types/Short.kt b/idea/testData/debugger/sequence/psi/collection/positive/types/Short.kt new file mode 100644 index 00000000000..db7168fe159 --- /dev/null +++ b/idea/testData/debugger/sequence/psi/collection/positive/types/Short.kt @@ -0,0 +1,3 @@ +fun main(args: Array) { + shortArrayOf(1.toShort(), 2.toShort()).single() +} \ No newline at end of file diff --git a/idea/tests/com/intellij/debugger/streams/kotlin/psi/collection/TypedCollectionChainTest.kt b/idea/tests/com/intellij/debugger/streams/kotlin/psi/collection/TypedCollectionChainTest.kt index e82b5f30e50..745d66c905f 100644 --- a/idea/tests/com/intellij/debugger/streams/kotlin/psi/collection/TypedCollectionChainTest.kt +++ b/idea/tests/com/intellij/debugger/streams/kotlin/psi/collection/TypedCollectionChainTest.kt @@ -2,6 +2,7 @@ package com.intellij.debugger.streams.kotlin.psi.collection import com.intellij.debugger.streams.kotlin.lib.KotlinCollectionSupportProvider import com.intellij.debugger.streams.kotlin.psi.TypedChainTestCase +import com.intellij.debugger.streams.kotlin.trace.dsl.KotlinTypes import com.intellij.debugger.streams.wrapper.StreamChainBuilder /** @@ -9,4 +10,43 @@ import com.intellij.debugger.streams.wrapper.StreamChainBuilder */ class TypedCollectionChainTest : TypedChainTestCase("collection/positive/types") { override val kotlinChainBuilder: StreamChainBuilder = KotlinCollectionSupportProvider().chainBuilder + + fun testAny() = doTest(KotlinTypes.ANY) + fun testNullableAny() = doTest(KotlinTypes.NULLABLE_ANY) + + fun testBoolean() = doTest(KotlinTypes.BOOLEAN) + fun testNullableBoolean() = doTest(KotlinTypes.NULLABLE_ANY) + + fun testByte() = doTest(KotlinTypes.BYTE) + fun testNullableByte() = doTest(KotlinTypes.NULLABLE_ANY) + + fun testShort() = doTest(KotlinTypes.SHORT) + fun testNullableShort() = doTest(KotlinTypes.NULLABLE_ANY) + + fun testInt() = doTest(KotlinTypes.INT) + fun testNullableInt() = doTest(KotlinTypes.NULLABLE_ANY) + + fun testLong() = doTest(KotlinTypes.LONG) + fun testNullableLong() = doTest(KotlinTypes.NULLABLE_ANY) + + fun testFloat() = doTest(KotlinTypes.FLOAT) + fun testNullableFloat() = doTest(KotlinTypes.NULLABLE_ANY) + + fun testDouble() = doTest(KotlinTypes.DOUBLE) + fun testNullableDouble() = doTest(KotlinTypes.NULLABLE_ANY) + + fun testChar() = doTest(KotlinTypes.CHAR) + fun testNullableChar() = doTest(KotlinTypes.NULLABLE_ANY) + + fun testNullableAnyToPrimitive() = doTest(KotlinTypes.NULLABLE_ANY, KotlinTypes.BOOLEAN) + fun testPrimitiveToNullableAny() = doTest(KotlinTypes.INT, KotlinTypes.NULLABLE_ANY) + + fun testAnyToPrimitive() = doTest(KotlinTypes.ANY, KotlinTypes.BOOLEAN) + fun testPrimitiveToAny() = doTest(KotlinTypes.INT, KotlinTypes.ANY) + + fun testNullableToNotNull() = doTest(KotlinTypes.NULLABLE_ANY, KotlinTypes.INT) + fun testNotNullToNullable() = doTest(KotlinTypes.DOUBLE, KotlinTypes.NULLABLE_ANY) + + fun testFewTransitions1() = doTest(KotlinTypes.BYTE, KotlinTypes.ANY, KotlinTypes.NULLABLE_ANY, KotlinTypes.INT) + fun testFewTransitions2() = doTest(KotlinTypes.CHAR, KotlinTypes.BOOLEAN, KotlinTypes.DOUBLE, KotlinTypes.ANY) } \ No newline at end of file