From bb7a188f875eb88fa2eb95a0592a5dec95c2791e Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Tue, 25 Apr 2017 12:15:26 +0300 Subject: [PATCH] Minor. Weaken assertion in refined int type analysis It's necessary because ASM remebers exact types obtained from value parameters, and in the further commits we're going to place code of suspend functions in their bodies, and there we get already refined type for int-like slots --- .../kotlin/codegen/coroutines/refinedIntTypesAnalysis.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/refinedIntTypesAnalysis.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/refinedIntTypesAnalysis.kt index 088a56b4284..8be5c2cd6fc 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/refinedIntTypesAnalysis.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/refinedIntTypesAnalysis.kt @@ -149,7 +149,7 @@ internal fun performRefinedTypeAnalysis(methodNode: MethodNode, thisName: String val current = Frame(basicFrames[insnIndex] ?: return@Array null) refinedVarFrames[insnIndex].expectedTypeByVarIndex.withIndex().filter { it.value != null }.forEach { - assert(current.getLocal(it.index)?.type == Type.INT_TYPE) { + assert(current.getLocal(it.index)?.type?.sort in ALL_INT_SORTS) { "int type expected, but ${current.getLocal(it.index)?.type} was found in basic frames" } @@ -181,6 +181,7 @@ private class MySourceInterpreter : SourceInterpreter() { } private val REFINED_INT_SORTS = setOf(Type.BOOLEAN, Type.CHAR, Type.BYTE, Type.SHORT) +private val ALL_INT_SORTS = REFINED_INT_SORTS + Type.INT private fun MethodNode.findContainingVariableFromTable(insn: AbstractInsnNode, varIndex: Int): LocalVariableNode? { val insnIndex = instructions.indexOf(insn)