Fix Kotlin build after fixing when-related type checking issues.
Filed: KT-10752, KT-10755.
This commit is contained in:
+6
-3
@@ -35,9 +35,12 @@ class KotlinReferenceContributor() : PsiReferenceContributor() {
|
|||||||
if (it.getReferencedNameElementType() != KtTokens.IDENTIFIER) return@registerMultiProvider emptyArray()
|
if (it.getReferencedNameElementType() != KtTokens.IDENTIFIER) return@registerMultiProvider emptyArray()
|
||||||
|
|
||||||
when (it.readWriteAccess(useResolveForReadWrite = false)) {
|
when (it.readWriteAccess(useResolveForReadWrite = false)) {
|
||||||
ReferenceAccess.READ -> arrayOf(SyntheticPropertyAccessorReference.Getter(it))
|
ReferenceAccess.READ ->
|
||||||
ReferenceAccess.WRITE -> arrayOf(SyntheticPropertyAccessorReference.Setter(it))
|
arrayOf<PsiReference>(SyntheticPropertyAccessorReference.Getter(it))
|
||||||
ReferenceAccess.READ_WRITE -> arrayOf(SyntheticPropertyAccessorReference.Getter(it), SyntheticPropertyAccessorReference.Setter(it))
|
ReferenceAccess.WRITE ->
|
||||||
|
arrayOf<PsiReference>(SyntheticPropertyAccessorReference.Setter(it))
|
||||||
|
ReferenceAccess.READ_WRITE ->
|
||||||
|
arrayOf<PsiReference>(SyntheticPropertyAccessorReference.Getter(it), SyntheticPropertyAccessorReference.Setter(it))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -455,19 +455,20 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
|
|||||||
"private "
|
"private "
|
||||||
else ""
|
else ""
|
||||||
|
|
||||||
val declaration : KtNamedDeclaration = when (callableInfo.kind) {
|
val declaration: KtNamedDeclaration = when (callableInfo.kind) {
|
||||||
CallableKind.FUNCTION, CallableKind.SECONDARY_CONSTRUCTOR -> {
|
CallableKind.FUNCTION, CallableKind.SECONDARY_CONSTRUCTOR -> {
|
||||||
val body = when {
|
val body = when {
|
||||||
containingElement is KtClass && containingElement.isInterface() && !config.isExtension -> ""
|
containingElement is KtClass && containingElement.isInterface() && !config.isExtension -> ""
|
||||||
else -> "{}"
|
else -> "{}"
|
||||||
}
|
}
|
||||||
|
@Suppress("USELESS_CAST") // KT-10755
|
||||||
if (callableInfo is FunctionInfo) {
|
if (callableInfo is FunctionInfo) {
|
||||||
val operatorModifier = if (callableInfo.isOperator) "operator " else ""
|
val operatorModifier = if (callableInfo.isOperator) "operator " else ""
|
||||||
val infixModifier = if (callableInfo.isInfix) "infix " 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 {
|
else {
|
||||||
psiFactory.createSecondaryConstructor("${modifiers}constructor$paramList $body")
|
psiFactory.createSecondaryConstructor("${modifiers}constructor$paramList $body") as KtNamedDeclaration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CallableKind.CLASS_WITH_PRIMARY_CONSTRUCTOR -> {
|
CallableKind.CLASS_WITH_PRIMARY_CONSTRUCTOR -> {
|
||||||
|
|||||||
+1
-1
@@ -61,7 +61,7 @@ internal fun getTargetParentByQualifier(
|
|||||||
if (qualifierDescriptor.fqName != file.packageFqName) {
|
if (qualifierDescriptor.fqName != file.packageFqName) {
|
||||||
JavaPsiFacade.getInstance(project).findPackage(qualifierDescriptor.fqName.asString())
|
JavaPsiFacade.getInstance(project).findPackage(qualifierDescriptor.fqName.asString())
|
||||||
}
|
}
|
||||||
else file // KT-9972
|
else file as PsiElement // KT-9972
|
||||||
else ->
|
else ->
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -351,7 +351,7 @@ private fun ExtractionData.analyzeControlFlow(
|
|||||||
+ outDeclarations.map { it.renderForMessage(bindingContext)!! }).sorted()
|
+ outDeclarations.map { it.renderForMessage(bindingContext)!! }).sorted()
|
||||||
return controlFlow to ErrorMessage.MULTIPLE_OUTPUT.addAdditionalInfo(outValuesStr)
|
return controlFlow to ErrorMessage.MULTIPLE_OUTPUT.addAdditionalInfo(outValuesStr)
|
||||||
}
|
}
|
||||||
OutputValueBoxer::AsList
|
{ outputValues -> OutputValueBoxer.AsList(outputValues) } // KT-8596
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> controlFlow.boxerFactory
|
else -> controlFlow.boxerFactory
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ abstract class FunctionContext(
|
|||||||
if (descriptor != null && descriptor in functionReader) return functionReader[descriptor]
|
if (descriptor != null && descriptor in functionReader) return functionReader[descriptor]
|
||||||
|
|
||||||
/** remove ending `()` */
|
/** remove ending `()` */
|
||||||
var callQualifier = call.qualifier
|
var callQualifier: JsNode = call.qualifier
|
||||||
|
|
||||||
/** remove ending `.call()` */
|
/** remove ending `.call()` */
|
||||||
if (isCallInvocation(call)) {
|
if (isCallInvocation(call)) {
|
||||||
@@ -120,12 +120,13 @@ abstract class FunctionContext(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** in case 4, 5 get ref (reduce 4, 5 to 2, 3 accordingly) */
|
/** in case 4, 5 get ref (reduce 4, 5 to 2, 3 accordingly) */
|
||||||
|
@Suppress("USELESS_CAST") // NB do not remove 'as JsNode' below until KT-10752 is fixed
|
||||||
if (callQualifier is JsNameRef) {
|
if (callQualifier is JsNameRef) {
|
||||||
val staticRef = callQualifier.name?.staticRef
|
val staticRef = callQualifier.name?.staticRef
|
||||||
|
|
||||||
callQualifier = when (staticRef) {
|
callQualifier = when (staticRef) {
|
||||||
is JsNameRef -> staticRef
|
is JsNameRef -> staticRef as JsNode
|
||||||
is JsInvocation -> staticRef
|
is JsInvocation -> staticRef as JsNode
|
||||||
is JsFunction, null -> callQualifier
|
is JsFunction, null -> callQualifier
|
||||||
else -> throw AssertionError("Unexpected static reference type ${staticRef.javaClass}")
|
else -> throw AssertionError("Unexpected static reference type ${staticRef.javaClass}")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user