Minor: rename KotlinTypes -> KotlinSequenceTypes

This commit is contained in:
Vitaliy.Bibaev
2018-08-17 18:23:30 +03:00
committed by Yan Zhulanow
parent 0ba506c1ec
commit 9b24600b0f
12 changed files with 99 additions and 99 deletions
@@ -5,9 +5,9 @@ import com.intellij.debugger.streams.trace.impl.handler.type.GenericType
import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.diagnostic.Logger
import org.jetbrains.kotlin.idea.debugger.sequence.psi.CallTypeExtractor import org.jetbrains.kotlin.idea.debugger.sequence.psi.CallTypeExtractor
import org.jetbrains.kotlin.idea.debugger.sequence.psi.KotlinPsiUtil import org.jetbrains.kotlin.idea.debugger.sequence.psi.KotlinPsiUtil
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinSequenceTypes
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.ANY import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinSequenceTypes.ANY
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.NULLABLE_ANY import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinSequenceTypes.NULLABLE_ANY
import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.typeUtil.supertypes import org.jetbrains.kotlin.types.typeUtil.supertypes
@@ -24,7 +24,7 @@ class KotlinCollectionsTypeExtractor : CallTypeExtractor.Base() {
override fun getResultType(type: KotlinType): GenericType { override fun getResultType(type: KotlinType): GenericType {
val typeName = KotlinPsiUtil.getTypeWithoutTypeParameters(type) val typeName = KotlinPsiUtil.getTypeWithoutTypeParameters(type)
return KotlinTypes.primitiveTypeByName(typeName) ?: KotlinTypes.primitiveArrayByName(typeName) ?: getAny(type) return KotlinSequenceTypes.primitiveTypeByName(typeName) ?: KotlinSequenceTypes.primitiveArrayByName(typeName) ?: getAny(type)
} }
private fun tryToFindElementType(type: KotlinType): GenericType? { private fun tryToFindElementType(type: KotlinType): GenericType? {
@@ -33,13 +33,13 @@ class KotlinCollectionsTypeExtractor : CallTypeExtractor.Base() {
if (type.arguments.isEmpty()) return NULLABLE_ANY if (type.arguments.isEmpty()) return NULLABLE_ANY
val itemsType = type.arguments.first().type val itemsType = type.arguments.first().type
if (itemsType.isMarkedNullable) return NULLABLE_ANY if (itemsType.isMarkedNullable) return NULLABLE_ANY
val primitiveType = KotlinTypes.primitiveTypeByName(KotlinPsiUtil.getTypeWithoutTypeParameters(itemsType)) val primitiveType = KotlinSequenceTypes.primitiveTypeByName(KotlinPsiUtil.getTypeWithoutTypeParameters(itemsType))
return primitiveType ?: ANY return primitiveType ?: ANY
} }
if (typeName == "kotlin.String" || typeName == "kotlin.CharSequence") return KotlinTypes.CHAR if (typeName == "kotlin.String" || typeName == "kotlin.CharSequence") return KotlinSequenceTypes.CHAR
val primitiveArray = KotlinTypes.primitiveArrayByName(typeName) val primitiveArray = KotlinSequenceTypes.primitiveArrayByName(typeName)
if (primitiveArray != null) return primitiveArray.elementType if (primitiveArray != null) return primitiveArray.elementType
return type.supertypes().asSequence() return type.supertypes().asSequence()
@@ -6,21 +6,21 @@ import com.intellij.debugger.streams.trace.impl.handler.type.GenericType
import com.intellij.psi.CommonClassNames import com.intellij.psi.CommonClassNames
import org.jetbrains.kotlin.idea.debugger.sequence.psi.CallTypeExtractor import org.jetbrains.kotlin.idea.debugger.sequence.psi.CallTypeExtractor
import org.jetbrains.kotlin.idea.debugger.sequence.psi.KotlinPsiUtil import org.jetbrains.kotlin.idea.debugger.sequence.psi.KotlinPsiUtil
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinSequenceTypes
import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.typeUtil.getImmediateSuperclassNotAny import org.jetbrains.kotlin.types.typeUtil.getImmediateSuperclassNotAny
class JavaStreamChainTypeExtractor : CallTypeExtractor.Base() { class JavaStreamChainTypeExtractor : CallTypeExtractor.Base() {
override fun extractItemsType(type: KotlinType?): GenericType { override fun extractItemsType(type: KotlinType?): GenericType {
if (type == null) { if (type == null) {
return KotlinTypes.NULLABLE_ANY return KotlinSequenceTypes.NULLABLE_ANY
} }
return when (KotlinPsiUtil.getTypeWithoutTypeParameters(type)) { return when (KotlinPsiUtil.getTypeWithoutTypeParameters(type)) {
CommonClassNames.JAVA_UTIL_STREAM_INT_STREAM -> KotlinTypes.INT CommonClassNames.JAVA_UTIL_STREAM_INT_STREAM -> KotlinSequenceTypes.INT
CommonClassNames.JAVA_UTIL_STREAM_DOUBLE_STREAM -> KotlinTypes.DOUBLE CommonClassNames.JAVA_UTIL_STREAM_DOUBLE_STREAM -> KotlinSequenceTypes.DOUBLE
CommonClassNames.JAVA_UTIL_STREAM_LONG_STREAM -> KotlinTypes.LONG CommonClassNames.JAVA_UTIL_STREAM_LONG_STREAM -> KotlinSequenceTypes.LONG
CommonClassNames.JAVA_UTIL_STREAM_BASE_STREAM -> KotlinTypes.NULLABLE_ANY CommonClassNames.JAVA_UTIL_STREAM_BASE_STREAM -> KotlinSequenceTypes.NULLABLE_ANY
else -> extractItemsType(type.getImmediateSuperclassNotAny()) else -> extractItemsType(type.getImmediateSuperclassNotAny())
} }
} }
@@ -6,7 +6,7 @@ import com.intellij.debugger.streams.trace.impl.handler.type.GenericType
import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.diagnostic.Logger
import org.jetbrains.kotlin.idea.debugger.sequence.psi.CallTypeExtractor import org.jetbrains.kotlin.idea.debugger.sequence.psi.CallTypeExtractor
import org.jetbrains.kotlin.idea.debugger.sequence.psi.KotlinPsiUtil import org.jetbrains.kotlin.idea.debugger.sequence.psi.KotlinPsiUtil
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinSequenceTypes
import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.typeUtil.supertypes import org.jetbrains.kotlin.types.typeUtil.supertypes
@@ -16,26 +16,26 @@ class SequenceTypeExtractor : CallTypeExtractor.Base() {
} }
override fun extractItemsType(type: KotlinType?): GenericType { override fun extractItemsType(type: KotlinType?): GenericType {
if (type == null) return KotlinTypes.NULLABLE_ANY if (type == null) return KotlinSequenceTypes.NULLABLE_ANY
return tryToFindElementType(type) ?: defaultType(type) return tryToFindElementType(type) ?: defaultType(type)
} }
override fun getResultType(type: KotlinType): GenericType { override fun getResultType(type: KotlinType): GenericType {
val typeName = KotlinPsiUtil.getTypeWithoutTypeParameters(type) val typeName = KotlinPsiUtil.getTypeWithoutTypeParameters(type)
return KotlinTypes.primitiveTypeByName(typeName) return KotlinSequenceTypes.primitiveTypeByName(typeName)
?: KotlinTypes.primitiveArrayByName(typeName) ?: KotlinSequenceTypes.primitiveArrayByName(typeName)
?: ClassTypeImpl(KotlinPsiUtil.getTypeName(type)) ?: ClassTypeImpl(KotlinPsiUtil.getTypeName(type))
} }
private fun tryToFindElementType(type: KotlinType): GenericType? { private fun tryToFindElementType(type: KotlinType): GenericType? {
val typeName = KotlinPsiUtil.getTypeWithoutTypeParameters(type) val typeName = KotlinPsiUtil.getTypeWithoutTypeParameters(type)
if (typeName == "kotlin.sequences.Sequence") { if (typeName == "kotlin.sequences.Sequence") {
if (type.arguments.isEmpty()) return KotlinTypes.NULLABLE_ANY if (type.arguments.isEmpty()) return KotlinSequenceTypes.NULLABLE_ANY
val itemsType = type.arguments.single().type val itemsType = type.arguments.single().type
if (itemsType.isMarkedNullable) return KotlinTypes.NULLABLE_ANY if (itemsType.isMarkedNullable) return KotlinSequenceTypes.NULLABLE_ANY
val primitiveType = KotlinTypes.primitiveTypeByName(KotlinPsiUtil.getTypeWithoutTypeParameters(itemsType)) val primitiveType = KotlinSequenceTypes.primitiveTypeByName(KotlinPsiUtil.getTypeWithoutTypeParameters(itemsType))
return primitiveType ?: KotlinTypes.ANY return primitiveType ?: KotlinSequenceTypes.ANY
} }
return type.supertypes().asSequence() return type.supertypes().asSequence()
@@ -45,6 +45,6 @@ class SequenceTypeExtractor : CallTypeExtractor.Base() {
private fun defaultType(type: KotlinType): GenericType { private fun defaultType(type: KotlinType): GenericType {
LOG.warn("Could not find type of items for type ${KotlinPsiUtil.getTypeName(type)}") LOG.warn("Could not find type of items for type ${KotlinPsiUtil.getTypeName(type)}")
return if (type.isMarkedNullable) KotlinTypes.NULLABLE_ANY else KotlinTypes.ANY return if (type.isMarkedNullable) KotlinSequenceTypes.NULLABLE_ANY else KotlinSequenceTypes.ANY
} }
} }
@@ -5,7 +5,7 @@ import com.intellij.debugger.streams.trace.dsl.Types
import com.intellij.debugger.streams.trace.impl.handler.type.* import com.intellij.debugger.streams.trace.impl.handler.type.*
import org.jetbrains.kotlin.builtins.KotlinBuiltIns.FQ_NAMES import org.jetbrains.kotlin.builtins.KotlinBuiltIns.FQ_NAMES
object KotlinTypes : Types { object KotlinSequenceTypes : Types {
override val ANY: GenericType = ClassTypeImpl(FQ_NAMES.any.asString(), "kotlin.Any()") override val ANY: GenericType = ClassTypeImpl(FQ_NAMES.any.asString(), "kotlin.Any()")
override val BOOLEAN: GenericType = ClassTypeImpl(FQ_NAMES._boolean.asString(), "false") override val BOOLEAN: GenericType = ClassTypeImpl(FQ_NAMES._boolean.asString(), "false")
@@ -17,7 +17,7 @@ class KotlinStatementFactory(private val peekCallFactory: PeekCallFactory) : Sta
override fun not(expression: Expression): Expression = TextExpression("!${expression.toCode()}") override fun not(expression: Expression): Expression = TextExpression("!${expression.toCode()}")
override val types: Types = KotlinTypes override val types: Types = KotlinSequenceTypes
override fun createEmptyCompositeCodeBlock(): CompositeCodeBlock = KotlinCodeBlock(this) override fun createEmptyCompositeCodeBlock(): CompositeCodeBlock = KotlinCodeBlock(this)
@@ -85,12 +85,12 @@ class KotlinStatementFactory(private val peekCallFactory: PeekCallFactory) : Sta
val arguments = args.joinToString { it.toCode() } val arguments = args.joinToString { it.toCode() }
val text = when (elementType) { val text = when (elementType) {
types.BOOLEAN -> "kotlin.booleanArrayOf($arguments)" types.BOOLEAN -> "kotlin.booleanArrayOf($arguments)"
KotlinTypes.BYTE -> "kotlin.byteArrayOf($arguments)" KotlinSequenceTypes.BYTE -> "kotlin.byteArrayOf($arguments)"
KotlinTypes.SHORT -> "kotlin.shortArrayOf($arguments)" KotlinSequenceTypes.SHORT -> "kotlin.shortArrayOf($arguments)"
KotlinTypes.CHAR -> "kotlin.charArrayOf($arguments)" KotlinSequenceTypes.CHAR -> "kotlin.charArrayOf($arguments)"
types.INT -> "kotlin.intArrayOf($arguments)" types.INT -> "kotlin.intArrayOf($arguments)"
types.LONG -> "kotlin.longArrayOf($arguments)" types.LONG -> "kotlin.longArrayOf($arguments)"
KotlinTypes.FLOAT -> "kotlin.floatArrayOf($arguments)" KotlinSequenceTypes.FLOAT -> "kotlin.floatArrayOf($arguments)"
types.DOUBLE -> "kotlin.doubleArrayOf($arguments)" types.DOUBLE -> "kotlin.doubleArrayOf($arguments)"
else -> "kotlin.arrayOf<${types.nullable { elementType }.genericTypeName}>($arguments)" else -> "kotlin.arrayOf<${types.nullable { elementType }.genericTypeName}>($arguments)"
} }
@@ -4,7 +4,7 @@ package org.jetbrains.kotlin.idea.debugger.sequence.trace.impl.handler
import com.intellij.debugger.streams.wrapper.* import com.intellij.debugger.streams.wrapper.*
import com.intellij.debugger.streams.wrapper.impl.IntermediateStreamCallImpl import com.intellij.debugger.streams.wrapper.impl.IntermediateStreamCallImpl
import com.intellij.debugger.streams.wrapper.impl.TerminatorStreamCallImpl import com.intellij.debugger.streams.wrapper.impl.TerminatorStreamCallImpl
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinSequenceTypes
fun IntermediateStreamCall.withArgs(args: List<CallArgument>) = fun IntermediateStreamCall.withArgs(args: List<CallArgument>) =
IntermediateStreamCallImpl(name, args, typeBefore, typeAfter, textRange) IntermediateStreamCallImpl(name, args, typeBefore, typeAfter, textRange)
@@ -13,7 +13,7 @@ fun TerminatorStreamCall.withArgs(args: List<CallArgument>) =
TerminatorStreamCallImpl(name, args, typeBefore, resultType, textRange) TerminatorStreamCallImpl(name, args, typeBefore, resultType, textRange)
fun StreamCall.typeBefore() = fun StreamCall.typeBefore() =
if (StreamCall@ this is TypeBeforeAware) StreamCall@ this.typeBefore else KotlinTypes.ANY if (StreamCall@ this is TypeBeforeAware) StreamCall@ this.typeBefore else KotlinSequenceTypes.ANY
fun StreamCall.typeAfter() = fun StreamCall.typeAfter() =
if (StreamCall@ this is TypeAfterAware) StreamCall@ this.typeAfter else KotlinTypes.ANY if (StreamCall@ this is TypeAfterAware) StreamCall@ this.typeAfter else KotlinSequenceTypes.ANY
@@ -7,13 +7,13 @@ import com.intellij.debugger.streams.wrapper.IntermediateStreamCall
import com.intellij.debugger.streams.wrapper.StreamCallType import com.intellij.debugger.streams.wrapper.StreamCallType
import com.intellij.debugger.streams.wrapper.impl.CallArgumentImpl import com.intellij.debugger.streams.wrapper.impl.CallArgumentImpl
import com.intellij.openapi.util.TextRange import com.intellij.openapi.util.TextRange
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinSequenceTypes
class OnEachCall(private val elementsType: GenericType, lambda: String) : IntermediateStreamCall { class OnEachCall(private val elementsType: GenericType, lambda: String) : IntermediateStreamCall {
private val args: List<CallArgument> private val args: List<CallArgument>
init { init {
args = listOf(CallArgumentImpl(KotlinTypes.ANY.genericTypeName, lambda)) args = listOf(CallArgumentImpl(KotlinSequenceTypes.ANY.genericTypeName, lambda))
} }
override fun getArguments(): List<CallArgument> = args override fun getArguments(): List<CallArgument> = args
@@ -12,7 +12,7 @@ import com.intellij.debugger.streams.wrapper.IntermediateStreamCall
import com.intellij.debugger.streams.wrapper.impl.CallArgumentImpl import com.intellij.debugger.streams.wrapper.impl.CallArgumentImpl
import com.intellij.debugger.streams.wrapper.impl.IntermediateStreamCallImpl import com.intellij.debugger.streams.wrapper.impl.IntermediateStreamCallImpl
import com.intellij.openapi.util.TextRange.EMPTY_RANGE import com.intellij.openapi.util.TextRange.EMPTY_RANGE
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinSequenceTypes
class FilterIsInstanceHandler(num: Int, call: IntermediateStreamCall, dsl: Dsl) : HandlerBase.Intermediate(dsl) { class FilterIsInstanceHandler(num: Int, call: IntermediateStreamCall, dsl: Dsl) : HandlerBase.Intermediate(dsl) {
private companion object { private companion object {
@@ -56,7 +56,7 @@ class FilterIsInstanceHandler(num: Int, call: IntermediateStreamCall, dsl: Dsl)
override fun transformCall(call: IntermediateStreamCall): IntermediateStreamCall { override fun transformCall(call: IntermediateStreamCall): IntermediateStreamCall {
val typeAfter = call.typeAfter.genericTypeName val typeAfter = call.typeAfter.genericTypeName
val predicateType = functionalType(typeAfter, KotlinTypes.BOOLEAN.genericTypeName) val predicateType = functionalType(typeAfter, KotlinSequenceTypes.BOOLEAN.genericTypeName)
val predicate = CallArgumentImpl(predicateType, " { x -> x is $typeAfter} ") val predicate = CallArgumentImpl(predicateType, " { x -> x is $typeAfter} ")
return syntheticFilterCall(predicate) return syntheticFilterCall(predicate)
} }
@@ -10,7 +10,7 @@ import com.intellij.debugger.streams.wrapper.CallArgument
import com.intellij.debugger.streams.wrapper.IntermediateStreamCall import com.intellij.debugger.streams.wrapper.IntermediateStreamCall
import com.intellij.debugger.streams.wrapper.impl.CallArgumentImpl import com.intellij.debugger.streams.wrapper.impl.CallArgumentImpl
import com.intellij.debugger.streams.wrapper.impl.IntermediateStreamCallImpl import com.intellij.debugger.streams.wrapper.impl.IntermediateStreamCallImpl
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinSequenceTypes
/** /**
* Based on com.intellij.debugger.streams.trace.impl.handler.unified.DistinctByKeyHandler * Based on com.intellij.debugger.streams.trace.impl.handler.unified.DistinctByKeyHandler
@@ -26,7 +26,7 @@ class KotlinDistinctByHandler(callNumber: Int, private val call: IntermediateStr
private val extractorVariable: Variable private val extractorVariable: Variable
private val beforeTimes = dsl.list(dsl.types.INT, call.name + callNumber + "BeforeTimes") private val beforeTimes = dsl.list(dsl.types.INT, call.name + callNumber + "BeforeTimes")
private val beforeValues = dsl.list(call.typeBefore, call.name + callNumber + "BeforeValues") private val beforeValues = dsl.list(call.typeBefore, call.name + callNumber + "BeforeValues")
private val keys = dsl.list(KotlinTypes.NULLABLE_ANY, call.name + callNumber + "Keys") private val keys = dsl.list(KotlinSequenceTypes.NULLABLE_ANY, call.name + callNumber + "Keys")
private val time2ValueAfter = dsl.linkedMap(dsl.types.INT, call.typeAfter, call.name + callNumber + "after") private val time2ValueAfter = dsl.linkedMap(dsl.types.INT, call.typeAfter, call.name + callNumber + "after")
init { init {
@@ -50,7 +50,7 @@ class KotlinDistinctByHandler(callNumber: Int, private val call: IntermediateStr
override fun transformCall(call: IntermediateStreamCall): IntermediateStreamCall { override fun transformCall(call: IntermediateStreamCall): IntermediateStreamCall {
val newKeyExtractor = dsl.lambda("x") { val newKeyExtractor = dsl.lambda("x") {
val key = dsl.variable(KotlinTypes.NULLABLE_ANY, "key") val key = dsl.variable(KotlinSequenceTypes.NULLABLE_ANY, "key")
declare(key, extractorVariable.call("invoke", lambdaArg), false) declare(key, extractorVariable.call("invoke", lambdaArg), false)
statement { beforeTimes.add(dsl.currentTime()) } statement { beforeTimes.add(dsl.currentTime()) }
statement { beforeValues.add(lambdaArg) } statement { beforeValues.add(lambdaArg) }
@@ -61,7 +61,7 @@ class KotlinDistinctByHandler(callNumber: Int, private val call: IntermediateStr
} }
override fun prepareResult(): CodeBlock { override fun prepareResult(): CodeBlock {
val keys2TimesBefore = dsl.map(KotlinTypes.NULLABLE_ANY, dsl.types.list(dsl.types.INT), "keys2Times") val keys2TimesBefore = dsl.map(KotlinSequenceTypes.NULLABLE_ANY, dsl.types.list(dsl.types.INT), "keys2Times")
val transitions = dsl.map(dsl.types.INT, dsl.types.INT, "transitionsMap") val transitions = dsl.map(dsl.types.INT, dsl.types.INT, "transitionsMap")
return dsl.block { return dsl.block {
add(peekHandler.prepareResult()) add(peekHandler.prepareResult())
@@ -69,7 +69,7 @@ class KotlinDistinctByHandler(callNumber: Int, private val call: IntermediateStr
declare(transitions.defaultDeclaration()) declare(transitions.defaultDeclaration())
integerIteration(keys.size(), block@ this) { integerIteration(keys.size(), block@ this) {
val key = declare(variable(KotlinTypes.NULLABLE_ANY, "key"), keys.get(loopVariable), false) val key = declare(variable(KotlinSequenceTypes.NULLABLE_ANY, "key"), keys.get(loopVariable), false)
val lst = list(dsl.types.INT, "lst") val lst = list(dsl.types.INT, "lst")
declare(lst, keys2TimesBefore.computeIfAbsent(key, lambda("k") { declare(lst, keys2TimesBefore.computeIfAbsent(key, lambda("k") {
doReturn(newList(types.INT)) doReturn(newList(types.INT))
@@ -80,7 +80,7 @@ class KotlinDistinctByHandler(callNumber: Int, private val call: IntermediateStr
forEachLoop(variable(types.INT, "afterTime"), time2ValueAfter.keys()) { forEachLoop(variable(types.INT, "afterTime"), time2ValueAfter.keys()) {
val afterTime = loopVariable val afterTime = loopVariable
val valueAfter = declare(variable(call.typeAfter, "valueAfter"), time2ValueAfter.get(loopVariable), false) val valueAfter = declare(variable(call.typeAfter, "valueAfter"), time2ValueAfter.get(loopVariable), false)
val key = declare(variable(KotlinTypes.NULLABLE_ANY, "key"), nullExpression, true) val key = declare(variable(KotlinSequenceTypes.NULLABLE_ANY, "key"), nullExpression, true)
integerIteration(beforeTimes.size(), forEachLoop@ this) { integerIteration(beforeTimes.size(), forEachLoop@ this) {
ifBranch((valueAfter same beforeValues.get(loopVariable)) and !transitions.contains(beforeTimes.get(loopVariable))) { ifBranch((valueAfter same beforeValues.get(loopVariable)) and !transitions.contains(beforeTimes.get(loopVariable))) {
key assign keys.get(loopVariable) key assign keys.get(loopVariable)
@@ -4,47 +4,47 @@ package org.jetbrains.kotlin.idea.debugger.sequence.psi.collection
import com.intellij.debugger.streams.wrapper.StreamChainBuilder import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import org.jetbrains.kotlin.idea.debugger.sequence.lib.collections.KotlinCollectionSupportProvider import org.jetbrains.kotlin.idea.debugger.sequence.lib.collections.KotlinCollectionSupportProvider
import org.jetbrains.kotlin.idea.debugger.sequence.psi.TypedChainTestCase import org.jetbrains.kotlin.idea.debugger.sequence.psi.TypedChainTestCase
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinSequenceTypes
class TypedCollectionChainTest : TypedChainTestCase("collection/positive/types") { class TypedCollectionChainTest : TypedChainTestCase("collection/positive/types") {
override val kotlinChainBuilder: StreamChainBuilder = KotlinCollectionSupportProvider().chainBuilder override val kotlinChainBuilder: StreamChainBuilder = KotlinCollectionSupportProvider().chainBuilder
fun testAny() = doTest(KotlinTypes.ANY) fun testAny() = doTest(KotlinSequenceTypes.ANY)
fun testNullableAny() = doTest(KotlinTypes.NULLABLE_ANY) fun testNullableAny() = doTest(KotlinSequenceTypes.NULLABLE_ANY)
fun testBoolean() = doTest(KotlinTypes.BOOLEAN) fun testBoolean() = doTest(KotlinSequenceTypes.BOOLEAN)
fun testNullableBoolean() = doTest(KotlinTypes.NULLABLE_ANY) fun testNullableBoolean() = doTest(KotlinSequenceTypes.NULLABLE_ANY)
fun testByte() = doTest(KotlinTypes.BYTE) fun testByte() = doTest(KotlinSequenceTypes.BYTE)
fun testNullableByte() = doTest(KotlinTypes.NULLABLE_ANY) fun testNullableByte() = doTest(KotlinSequenceTypes.NULLABLE_ANY)
fun testShort() = doTest(KotlinTypes.SHORT) fun testShort() = doTest(KotlinSequenceTypes.SHORT)
fun testNullableShort() = doTest(KotlinTypes.NULLABLE_ANY) fun testNullableShort() = doTest(KotlinSequenceTypes.NULLABLE_ANY)
fun testInt() = doTest(KotlinTypes.INT) fun testInt() = doTest(KotlinSequenceTypes.INT)
fun testNullableInt() = doTest(KotlinTypes.NULLABLE_ANY) fun testNullableInt() = doTest(KotlinSequenceTypes.NULLABLE_ANY)
fun testLong() = doTest(KotlinTypes.LONG) fun testLong() = doTest(KotlinSequenceTypes.LONG)
fun testNullableLong() = doTest(KotlinTypes.NULLABLE_ANY) fun testNullableLong() = doTest(KotlinSequenceTypes.NULLABLE_ANY)
fun testFloat() = doTest(KotlinTypes.FLOAT) fun testFloat() = doTest(KotlinSequenceTypes.FLOAT)
fun testNullableFloat() = doTest(KotlinTypes.NULLABLE_ANY) fun testNullableFloat() = doTest(KotlinSequenceTypes.NULLABLE_ANY)
fun testDouble() = doTest(KotlinTypes.DOUBLE) fun testDouble() = doTest(KotlinSequenceTypes.DOUBLE)
fun testNullableDouble() = doTest(KotlinTypes.NULLABLE_ANY) fun testNullableDouble() = doTest(KotlinSequenceTypes.NULLABLE_ANY)
fun testChar() = doTest(KotlinTypes.CHAR) fun testChar() = doTest(KotlinSequenceTypes.CHAR)
fun testNullableChar() = doTest(KotlinTypes.NULLABLE_ANY) fun testNullableChar() = doTest(KotlinSequenceTypes.NULLABLE_ANY)
fun testNullableAnyToPrimitive() = doTest(KotlinTypes.NULLABLE_ANY, KotlinTypes.BOOLEAN) fun testNullableAnyToPrimitive() = doTest(KotlinSequenceTypes.NULLABLE_ANY, KotlinSequenceTypes.BOOLEAN)
fun testPrimitiveToNullableAny() = doTest(KotlinTypes.INT, KotlinTypes.NULLABLE_ANY) fun testPrimitiveToNullableAny() = doTest(KotlinSequenceTypes.INT, KotlinSequenceTypes.NULLABLE_ANY)
fun testAnyToPrimitive() = doTest(KotlinTypes.ANY, KotlinTypes.INT) fun testAnyToPrimitive() = doTest(KotlinSequenceTypes.ANY, KotlinSequenceTypes.INT)
fun testPrimitiveToAny() = doTest(KotlinTypes.INT, KotlinTypes.ANY) fun testPrimitiveToAny() = doTest(KotlinSequenceTypes.INT, KotlinSequenceTypes.ANY)
fun testNullableToNotNull() = doTest(KotlinTypes.NULLABLE_ANY, KotlinTypes.INT) fun testNullableToNotNull() = doTest(KotlinSequenceTypes.NULLABLE_ANY, KotlinSequenceTypes.INT)
fun testNotNullToNullable() = doTest(KotlinTypes.DOUBLE, KotlinTypes.NULLABLE_ANY) fun testNotNullToNullable() = doTest(KotlinSequenceTypes.DOUBLE, KotlinSequenceTypes.NULLABLE_ANY)
fun testFewTransitions1() = doTest(KotlinTypes.BYTE, KotlinTypes.ANY, KotlinTypes.NULLABLE_ANY, KotlinTypes.INT) fun testFewTransitions1() = doTest(KotlinSequenceTypes.BYTE, KotlinSequenceTypes.ANY, KotlinSequenceTypes.NULLABLE_ANY, KotlinSequenceTypes.INT)
fun testFewTransitions2() = doTest(KotlinTypes.CHAR, KotlinTypes.BOOLEAN, KotlinTypes.DOUBLE, KotlinTypes.ANY) fun testFewTransitions2() = doTest(KotlinSequenceTypes.CHAR, KotlinSequenceTypes.BOOLEAN, KotlinSequenceTypes.DOUBLE, KotlinSequenceTypes.ANY)
} }
@@ -4,10 +4,10 @@ package org.jetbrains.kotlin.idea.debugger.sequence.psi.java
import com.intellij.debugger.streams.wrapper.StreamChainBuilder import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import org.jetbrains.kotlin.idea.debugger.sequence.lib.java.JavaStandardLibrarySupportProvider import org.jetbrains.kotlin.idea.debugger.sequence.lib.java.JavaStandardLibrarySupportProvider
import org.jetbrains.kotlin.idea.debugger.sequence.psi.TypedChainTestCase import org.jetbrains.kotlin.idea.debugger.sequence.psi.TypedChainTestCase
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.DOUBLE import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinSequenceTypes.DOUBLE
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.INT import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinSequenceTypes.INT
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.LONG import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinSequenceTypes.LONG
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes.NULLABLE_ANY import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinSequenceTypes.NULLABLE_ANY
class TypedJavaChainTest : TypedChainTestCase("streams/positive/types") { class TypedJavaChainTest : TypedChainTestCase("streams/positive/types") {
override val kotlinChainBuilder: StreamChainBuilder = JavaStandardLibrarySupportProvider().chainBuilder override val kotlinChainBuilder: StreamChainBuilder = JavaStandardLibrarySupportProvider().chainBuilder
@@ -4,48 +4,48 @@ package org.jetbrains.kotlin.idea.debugger.sequence.psi.sequence
import com.intellij.debugger.streams.wrapper.StreamChainBuilder import com.intellij.debugger.streams.wrapper.StreamChainBuilder
import org.jetbrains.kotlin.idea.debugger.sequence.lib.sequence.KotlinSequenceSupportProvider import org.jetbrains.kotlin.idea.debugger.sequence.lib.sequence.KotlinSequenceSupportProvider
import org.jetbrains.kotlin.idea.debugger.sequence.psi.TypedChainTestCase import org.jetbrains.kotlin.idea.debugger.sequence.psi.TypedChainTestCase
import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinTypes import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinSequenceTypes
class TypedSequenceChain : TypedChainTestCase("sequence/positive/types") { class TypedSequenceChain : TypedChainTestCase("sequence/positive/types") {
override val kotlinChainBuilder: StreamChainBuilder = KotlinSequenceSupportProvider().chainBuilder override val kotlinChainBuilder: StreamChainBuilder = KotlinSequenceSupportProvider().chainBuilder
fun testAny() = doTest(KotlinTypes.ANY) fun testAny() = doTest(KotlinSequenceTypes.ANY)
fun testNullableAny() = doTest(KotlinTypes.NULLABLE_ANY) fun testNullableAny() = doTest(KotlinSequenceTypes.NULLABLE_ANY)
fun testBoolean() = doTest(KotlinTypes.BOOLEAN) fun testBoolean() = doTest(KotlinSequenceTypes.BOOLEAN)
fun testNullableBoolean() = doTest(KotlinTypes.NULLABLE_ANY) fun testNullableBoolean() = doTest(KotlinSequenceTypes.NULLABLE_ANY)
fun testByte() = doTest(KotlinTypes.BYTE) fun testByte() = doTest(KotlinSequenceTypes.BYTE)
fun testNullableByte() = doTest(KotlinTypes.NULLABLE_ANY) fun testNullableByte() = doTest(KotlinSequenceTypes.NULLABLE_ANY)
fun testShort() = doTest(KotlinTypes.SHORT) fun testShort() = doTest(KotlinSequenceTypes.SHORT)
fun testNullableShort() = doTest(KotlinTypes.NULLABLE_ANY) fun testNullableShort() = doTest(KotlinSequenceTypes.NULLABLE_ANY)
fun testInt() = doTest(KotlinTypes.INT) fun testInt() = doTest(KotlinSequenceTypes.INT)
fun testNullableInt() = doTest(KotlinTypes.NULLABLE_ANY) fun testNullableInt() = doTest(KotlinSequenceTypes.NULLABLE_ANY)
fun testLong() = doTest(KotlinTypes.LONG) fun testLong() = doTest(KotlinSequenceTypes.LONG)
fun testNullableLong() = doTest(KotlinTypes.NULLABLE_ANY) fun testNullableLong() = doTest(KotlinSequenceTypes.NULLABLE_ANY)
fun testFloat() = doTest(KotlinTypes.FLOAT) fun testFloat() = doTest(KotlinSequenceTypes.FLOAT)
fun testNullableFloat() = doTest(KotlinTypes.NULLABLE_ANY) fun testNullableFloat() = doTest(KotlinSequenceTypes.NULLABLE_ANY)
fun testDouble() = doTest(KotlinTypes.DOUBLE) fun testDouble() = doTest(KotlinSequenceTypes.DOUBLE)
fun testNullableDouble() = doTest(KotlinTypes.NULLABLE_ANY) fun testNullableDouble() = doTest(KotlinSequenceTypes.NULLABLE_ANY)
fun testChar() = doTest(KotlinTypes.CHAR) fun testChar() = doTest(KotlinSequenceTypes.CHAR)
fun testNullableChar() = doTest(KotlinTypes.NULLABLE_ANY) fun testNullableChar() = doTest(KotlinSequenceTypes.NULLABLE_ANY)
fun testNullableAnyToPrimitive() = doTest(KotlinTypes.NULLABLE_ANY, KotlinTypes.BOOLEAN) fun testNullableAnyToPrimitive() = doTest(KotlinSequenceTypes.NULLABLE_ANY, KotlinSequenceTypes.BOOLEAN)
fun testPrimitiveToNullableAny() = doTest(KotlinTypes.INT, KotlinTypes.NULLABLE_ANY) fun testPrimitiveToNullableAny() = doTest(KotlinSequenceTypes.INT, KotlinSequenceTypes.NULLABLE_ANY)
fun testAnyToPrimitive() = doTest(KotlinTypes.ANY, KotlinTypes.INT) fun testAnyToPrimitive() = doTest(KotlinSequenceTypes.ANY, KotlinSequenceTypes.INT)
fun testPrimitiveToAny() = doTest(KotlinTypes.INT, KotlinTypes.ANY) fun testPrimitiveToAny() = doTest(KotlinSequenceTypes.INT, KotlinSequenceTypes.ANY)
fun testNullableToNotNull() = doTest(KotlinTypes.NULLABLE_ANY, KotlinTypes.INT) fun testNullableToNotNull() = doTest(KotlinSequenceTypes.NULLABLE_ANY, KotlinSequenceTypes.INT)
fun testNotNullToNullable() = doTest(KotlinTypes.DOUBLE, KotlinTypes.NULLABLE_ANY) fun testNotNullToNullable() = doTest(KotlinSequenceTypes.DOUBLE, KotlinSequenceTypes.NULLABLE_ANY)
fun testFewTransitions1() = doTest(KotlinTypes.BYTE, KotlinTypes.ANY, KotlinTypes.NULLABLE_ANY, KotlinTypes.INT) fun testFewTransitions1() = doTest(KotlinSequenceTypes.BYTE, KotlinSequenceTypes.ANY, KotlinSequenceTypes.NULLABLE_ANY, KotlinSequenceTypes.INT)
fun testFewTransitions2() = doTest(KotlinTypes.CHAR, KotlinTypes.BOOLEAN, KotlinTypes.DOUBLE, KotlinTypes.ANY) fun testFewTransitions2() = doTest(KotlinSequenceTypes.CHAR, KotlinSequenceTypes.BOOLEAN, KotlinSequenceTypes.DOUBLE, KotlinSequenceTypes.ANY)
} }