Fix Kotlin build after fixing when-related type checking issues.

Filed: KT-10752, KT-10755.
This commit is contained in:
Dmitry Petrov
2016-01-21 11:59:09 +03:00
parent f371e67ce8
commit a33c840939
5 changed files with 16 additions and 11 deletions
@@ -455,19 +455,20 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
"private "
else ""
val declaration : KtNamedDeclaration = when (callableInfo.kind) {
val declaration: KtNamedDeclaration = when (callableInfo.kind) {
CallableKind.FUNCTION, CallableKind.SECONDARY_CONSTRUCTOR -> {
val body = when {
containingElement is KtClass && containingElement.isInterface() && !config.isExtension -> ""
else -> "{}"
}
@Suppress("USELESS_CAST") // KT-10755
if (callableInfo is FunctionInfo) {
val operatorModifier = if (callableInfo.isOperator) "operator " else ""
val infixModifier = if (callableInfo.isInfix) "infix " else ""
psiFactory.createFunction("$modifiers$infixModifier${operatorModifier}fun<> $header $body")
psiFactory.createFunction("$modifiers$infixModifier${operatorModifier}fun<> $header $body") as KtNamedDeclaration
}
else {
psiFactory.createSecondaryConstructor("${modifiers}constructor$paramList $body")
psiFactory.createSecondaryConstructor("${modifiers}constructor$paramList $body") as KtNamedDeclaration
}
}
CallableKind.CLASS_WITH_PRIMARY_CONSTRUCTOR -> {
@@ -61,7 +61,7 @@ internal fun getTargetParentByQualifier(
if (qualifierDescriptor.fqName != file.packageFqName) {
JavaPsiFacade.getInstance(project).findPackage(qualifierDescriptor.fqName.asString())
}
else file // KT-9972
else file as PsiElement // KT-9972
else ->
null
}
@@ -351,7 +351,7 @@ private fun ExtractionData.analyzeControlFlow(
+ outDeclarations.map { it.renderForMessage(bindingContext)!! }).sorted()
return controlFlow to ErrorMessage.MULTIPLE_OUTPUT.addAdditionalInfo(outValuesStr)
}
OutputValueBoxer::AsList
{ outputValues -> OutputValueBoxer.AsList(outputValues) } // KT-8596
}
else -> controlFlow.boxerFactory