From 16768bd9e3c24636da835f18f664ec4703868634 Mon Sep 17 00:00:00 2001 From: "Vitaliy.Bibaev" Date: Fri, 17 Nov 2017 16:41:27 +0300 Subject: [PATCH] Add and use NULLABLE_ANY type into KotlinTypes.kt --- .../kotlin/psi/impl/KotlinChainTransformerImpl.kt | 13 +++++-------- .../streams/kotlin/trace/dsl/KotlinTypes.kt | 2 ++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/idea/idea-jvm/src/com/intellij/debugger/streams/kotlin/psi/impl/KotlinChainTransformerImpl.kt b/idea/idea-jvm/src/com/intellij/debugger/streams/kotlin/psi/impl/KotlinChainTransformerImpl.kt index f07523dbc85..02afc7df893 100644 --- a/idea/idea-jvm/src/com/intellij/debugger/streams/kotlin/psi/impl/KotlinChainTransformerImpl.kt +++ b/idea/idea-jvm/src/com/intellij/debugger/streams/kotlin/psi/impl/KotlinChainTransformerImpl.kt @@ -3,7 +3,7 @@ package com.intellij.debugger.streams.kotlin.psi.impl import com.intellij.debugger.streams.kotlin.psi.callName import com.intellij.debugger.streams.kotlin.psi.resolveType -import com.intellij.debugger.streams.kotlin.trace.dsl.KotlinTypes +import com.intellij.debugger.streams.kotlin.trace.dsl.KotlinTypes.NULLABLE_ANY import com.intellij.debugger.streams.psi.ChainTransformer import com.intellij.debugger.streams.wrapper.CallArgument import com.intellij.debugger.streams.wrapper.IntermediateStreamCall @@ -28,24 +28,21 @@ class KotlinChainTransformerImpl : ChainTransformer { val firstCall = callChain.first() val parent = firstCall.parent val qualifier = if (parent is KtDotQualifiedExpression) - QualifierExpressionImpl(parent.receiverExpression.text, parent.receiverExpression.textRange, KotlinTypes.ANY) + QualifierExpressionImpl(parent.receiverExpression.text, parent.receiverExpression.textRange, NULLABLE_ANY) else - QualifierExpressionImpl("", TextRange.EMPTY_RANGE, KotlinTypes.nullable { KotlinTypes.ANY }) // This is possible only when this inherits Stream + QualifierExpressionImpl("", TextRange.EMPTY_RANGE, NULLABLE_ANY) // This is possible only when this inherits Stream val intermediateCalls = mutableListOf() for (call in callChain.subList(0, callChain.size - 1)) { intermediateCalls += IntermediateStreamCallImpl(call.callName(), - call.valueArguments.map { createCallArgument(call, it) }, - KotlinTypes.nullable { KotlinTypes.ANY }, KotlinTypes.nullable { KotlinTypes.ANY }, - call.textRange) + call.valueArguments.map { createCallArgument(call, it) }, NULLABLE_ANY, NULLABLE_ANY, call.textRange) } val terminationsPsiCall = callChain.last() // TODO: infer true types val terminationCall = TerminatorStreamCallImpl(terminationsPsiCall.callName(), terminationsPsiCall.valueArguments.map { createCallArgument(terminationsPsiCall, it) }, - KotlinTypes.nullable { KotlinTypes.ANY }, KotlinTypes.nullable { KotlinTypes.ANY }, - terminationsPsiCall.textRange) + NULLABLE_ANY, NULLABLE_ANY, terminationsPsiCall.textRange) return StreamChainImpl(qualifier, intermediateCalls, terminationCall, context) } diff --git a/idea/idea-jvm/src/com/intellij/debugger/streams/kotlin/trace/dsl/KotlinTypes.kt b/idea/idea-jvm/src/com/intellij/debugger/streams/kotlin/trace/dsl/KotlinTypes.kt index 8a0d713d9d4..757849b49f0 100644 --- a/idea/idea-jvm/src/com/intellij/debugger/streams/kotlin/trace/dsl/KotlinTypes.kt +++ b/idea/idea-jvm/src/com/intellij/debugger/streams/kotlin/trace/dsl/KotlinTypes.kt @@ -17,6 +17,8 @@ object KotlinTypes : Types { override val EXCEPTION: GenericType = ClassTypeImpl("kotlin.Throwable", "kotlin.Throwable()") override val VOID: GenericType = ClassTypeImpl("kotlin.Unit", "Unit") + val NULLABLE_ANY: GenericType = nullable { ANY } + override val TIME: GenericType = ClassTypeImpl("java.util.concurrent.atomic.AtomicInteger", "java.util.concurrent.atomic.AtomicInteger()")