Remove 'debugTypeInfo' key

The key became obsolete as the new evaluator doesn't use it anymore.
This commit is contained in:
Yan Zhulanow
2019-02-01 19:33:48 +03:00
parent 6a81c2e1e4
commit 24cdd3f857
3 changed files with 1 additions and 34 deletions
@@ -20,8 +20,6 @@ import com.intellij.openapi.util.Key
import org.jetbrains.kotlin.psi.KtCodeFragment
import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtTypeReference
import org.jetbrains.kotlin.types.KotlinType
val SUPPRESS_DIAGNOSTICS_IN_DEBUG_MODE: Key<Boolean> = Key.create<Boolean>("SUPPRESS_DIAGNOSTICS_IN_DEBUG_MODE")
@@ -43,13 +41,4 @@ var KtFile.suppressDiagnosticsInDebugMode: Boolean
putUserData(SUPPRESS_DIAGNOSTICS_IN_DEBUG_MODE, skip)
}
val DEBUG_TYPE_REFERENCE_STRING: String = "DebugTypeKotlinRulezzzz"
val DEBUG_TYPE_INFO: Key<KotlinType> = Key.create<KotlinType>("DEBUG_TYPE_INFO")
var KtTypeReference.debugTypeInfo: KotlinType?
get() = getUserData(DEBUG_TYPE_INFO)
set(type) {
if (type != null && this.text == DEBUG_TYPE_REFERENCE_STRING) {
putUserData(DEBUG_TYPE_INFO, type)
}
}
val DEBUG_TYPE_REFERENCE_STRING: String = "DebugTypeKotlinRulezzzz"
@@ -31,7 +31,6 @@ import org.jetbrains.kotlin.diagnostics.Errors.*
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.codeFragmentUtil.debugTypeInfo
import org.jetbrains.kotlin.psi.codeFragmentUtil.suppressDiagnosticsInDebugMode
import org.jetbrains.kotlin.psi.debugText.getDebugText
import org.jetbrains.kotlin.psi.psiUtil.checkReservedYield
@@ -113,12 +112,6 @@ class TypeResolver(
val resolvedTypeSlice = if (c.abbreviated) BindingContext.ABBREVIATED_TYPE else BindingContext.TYPE
val debugType = typeReference.debugTypeInfo
if (debugType != null) {
c.trace.record(resolvedTypeSlice, typeReference, debugType)
return type(debugType)
}
val annotations = resolveTypeAnnotations(c, typeReference)
val type = resolveTypeElement(c, annotations, typeReference.modifierList, typeReference.typeElement)
c.trace.recordScope(c.scope, typeReference)
@@ -47,8 +47,6 @@ import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.KtPsiFactory.CallableBuilder
import org.jetbrains.kotlin.psi.codeFragmentUtil.DEBUG_TYPE_REFERENCE_STRING
import org.jetbrains.kotlin.psi.codeFragmentUtil.debugTypeInfo
import org.jetbrains.kotlin.psi.codeFragmentUtil.suppressDiagnosticsInDebugMode
import org.jetbrains.kotlin.psi.psiUtil.*
import org.jetbrains.kotlin.renderer.DescriptorRenderer
import org.jetbrains.kotlin.resolve.DescriptorUtils
@@ -56,7 +54,6 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.getCalleeExpressionIfAny
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.isError
import org.jetbrains.kotlin.types.isFlexible
import org.jetbrains.kotlin.types.typeUtil.builtIns
import java.util.*
private fun buildSignature(config: ExtractionGeneratorConfiguration, renderer: DescriptorRenderer): CallableBuilder {
@@ -655,18 +652,6 @@ fun ExtractionGeneratorConfiguration.generateDeclaration(
val declaration = createDeclaration().let { if (shouldInsert) insertDeclaration(it, anchor) else it }
adjustDeclarationBody(declaration)
if (declaration is KtNamedFunction && declaration.getContainingKtFile().suppressDiagnosticsInDebugMode) {
declaration.receiverTypeReference?.debugTypeInfo = descriptor.receiverParameter?.getParameterType(true)
for ((i, param) in declaration.valueParameters.withIndex()) {
param.typeReference?.debugTypeInfo = descriptor.parameters[i].getParameterType(true)
}
if (declaration.typeReference != null) {
declaration.typeReference?.debugTypeInfo = descriptor.returnType.builtIns.anyType
}
}
if (generatorOptions.inTempFile) return ExtractionResult(this, declaration, Collections.emptyMap())
val replaceInitialOccurrence = {