Add tests for type inference for items in the chain
This commit is contained in:
committed by
Yan Zhulanow
parent
b7e99a75ad
commit
9d69b701c1
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
<caret> listOf("abc").asSequence().count()
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
<caret> listOf("abc", 12).asSequence().map { 10 }.count()
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
bool<caret>eanArrayOf(true, true, false).asSequence().count()
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
setOf(1.toB<caret>yte(), 20.toByte()).asSequence().forEach { }
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
charArrayOf('a', 'b', 'c').asSe<caret>quence().count()
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
Doub<caret>leArray(10).asSequence().count()
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fun main(args: Array<String>) {
|
||||
byteArray<caret>Of(10, 20).asSequence()
|
||||
.map { it.toString() }
|
||||
.map { if (it == "10") null else 10 }
|
||||
.map { 10 }
|
||||
.contains(200)
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
fun main(args: Array<String>) {
|
||||
"jetBrains".asS<caret>equence().map { it.isLowerCase() }
|
||||
.flatMap { linkedSetOf(1.2, 3.0).asSequence() }
|
||||
.map { it.toString() }
|
||||
.count()
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
listOf(1.<caret>0f).asSequence().contains(2.0f)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
intArrayOf(10).asSequence(<caret>).any()
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
longArrayOf(1L, 2L<caret>).asSequence().count { it < 2 }
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
sortedSetOf(10.0).asSequence().m<caret>ap { null }.count()
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
lis<caret>tOf(Any(), null).asSequence().contains(10)
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
lis<caret>tOf(Any(), null).asSequence().map { true }.contains(false)
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
listOf(true, nul<caret>l, false).asSequence().count()
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
listOf(1.to<caret>Byte(), null).asSequence().forEach { }
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
listOf(',', '.', nu<caret>ll).asSequence().singleOrNull()
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
val elem<caret>ent = listOf(0.4, null).asSequence().elementAt(2)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
listOf(0.4f, null).asSequence().indexOf(0<caret>.3f)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
<caret> listOf(5, null).asSequence().lastIndexOf(null)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
listOf(10L, null).asSequence().no<caret>ne()
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
listOf(6.toShort<caret>(), null).asSequence().last()
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
listOf(0.4, null).asSequence().<caret>map { 10 }.count()
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
listOf(20, 30).asSequence().m<caret>ap { Any() }.contains(Any())
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
listO<caret>f(20, 30).asSequence().map { if(it == 20) null else it }.count()
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main(args: Array<String>) {
|
||||
shortArrayOf(1.toShor<caret>t(), 2.toShort()).asSequence().singleOrNull()
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.debugger.streams.kotlin.psi.sequence
|
||||
|
||||
import com.intellij.debugger.streams.kotlin.lib.sequence.KotlinSequenceSupportProvider
|
||||
import com.intellij.debugger.streams.kotlin.psi.TypedChainTestCase
|
||||
import com.intellij.debugger.streams.kotlin.trace.dsl.KotlinTypes
|
||||
import com.intellij.debugger.streams.wrapper.StreamChainBuilder
|
||||
|
||||
/**
|
||||
* @author Vitaliy.Bibaev
|
||||
*/
|
||||
class TypedSequenceChain : TypedChainTestCase("sequence/positive/types") {
|
||||
override val kotlinChainBuilder: StreamChainBuilder = KotlinSequenceSupportProvider().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.INT)
|
||||
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)
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user