diff --git a/compiler/frontend/src/org/jetbrains/kotlin/cfg/UnreachableCode.kt b/compiler/frontend/src/org/jetbrains/kotlin/cfg/UnreachableCode.kt index 5504c179b56..8d7ea3c4106 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/cfg/UnreachableCode.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/cfg/UnreachableCode.kt @@ -16,17 +16,16 @@ package org.jetbrains.kotlin.cfg -import org.jetbrains.kotlin.psi.JetElement import com.intellij.openapi.util.TextRange -import java.util.HashSet -import org.jetbrains.kotlin.psi.JetPsiUtil +import com.intellij.psi.PsiComment import com.intellij.psi.PsiElement import com.intellij.psi.PsiElementVisitor import com.intellij.psi.PsiWhiteSpace -import java.util.ArrayList -import org.jetbrains.kotlin.lexer.JetTokens import com.intellij.psi.util.PsiTreeUtil -import com.intellij.psi.PsiComment +import org.jetbrains.kotlin.lexer.JetTokens +import org.jetbrains.kotlin.psi.JetElement +import org.jetbrains.kotlin.psi.JetPsiUtil +import java.util.* interface UnreachableCode { val elements: Set @@ -99,7 +98,7 @@ class UnreachableCodeImpl( private fun List.mergeAdjacentTextRanges(): List { val result = ArrayList() - val lastRange = fold(null: TextRange?) { + val lastRange = fold(null as TextRange?) { currentTextRange, element -> val elementRange = element.getTextRange()!! diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetOperationReferenceExpression.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetOperationReferenceExpression.kt index bf82fe1eaca..edcdbad4988 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetOperationReferenceExpression.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetOperationReferenceExpression.kt @@ -17,16 +17,16 @@ package org.jetbrains.kotlin.psi import com.intellij.lang.ASTNode -import org.jetbrains.kotlin.parsing.JetExpressionParsing import com.intellij.psi.PsiElement import com.intellij.psi.impl.source.tree.TreeElement import org.jetbrains.kotlin.lexer.JetSingleValueToken import org.jetbrains.kotlin.lexer.JetToken import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.parsing.JetExpressionParsing import org.jetbrains.kotlin.types.expressions.OperatorConventions public class JetOperationReferenceExpression(node: ASTNode) : JetSimpleNameExpressionImpl(node) { - override fun getReferencedNameElement() = (findChildByType(JetExpressionParsing.ALL_OPERATIONS): PsiElement?) ?: this + override fun getReferencedNameElement() = findChildByType(JetExpressionParsing.ALL_OPERATIONS) ?: this fun getNameForConventionalOperation(unaryOperations: Boolean = true, binaryOperations: Boolean = true): Name? { val operator = (firstChild as? TreeElement)?.elementType as? JetToken ?: return null diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/TaskPrioritizer.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/TaskPrioritizer.kt index 7ebf8d08dfa..dace6fb013c 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/TaskPrioritizer.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/TaskPrioritizer.kt @@ -21,7 +21,9 @@ import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.incremental.KotlinLookupLocation import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus -import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.psi.Call +import org.jetbrains.kotlin.psi.JetFile +import org.jetbrains.kotlin.psi.doNotAnalyze import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.calls.callResolverUtil.isConventionCall import org.jetbrains.kotlin.resolve.calls.callResolverUtil.isOrOverridesSynthesized @@ -484,7 +486,7 @@ public class TaskPrioritizer( private fun isSynthesized(candidate: ResolutionCandidate): Boolean { val descriptor = candidate.getDescriptor() - return descriptor is CallableMemberDescriptor && isOrOverridesSynthesized(descriptor : CallableMemberDescriptor) + return descriptor is CallableMemberDescriptor && isOrOverridesSynthesized(descriptor) } fun hasImplicitDynamicReceiver(candidate: ResolutionCandidate): Boolean { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/dynamicCalls.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/dynamicCalls.kt index e883fceae85..2a4fa6a111c 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/dynamicCalls.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tasks/dynamicCalls.kt @@ -104,7 +104,7 @@ class DynamicCallableDescriptors(private val builtIns: KotlinBuiltIns) { dynamicType, createTypeParameters(propertyDescriptor, call), createDynamicDispatchReceiverParameter(propertyDescriptor), - null: JetType? + null as JetType? ) val getter = DescriptorFactory.createDefaultGetter(propertyDescriptor, Annotations.EMPTY) diff --git a/js/js.translator/src/org/jetbrains/kotlin/js/translate/callTranslator/FunctionCallCases.kt b/js/js.translator/src/org/jetbrains/kotlin/js/translate/callTranslator/FunctionCallCases.kt index 5450d35d333..c35dfe04dd8 100644 --- a/js/js.translator/src/org/jetbrains/kotlin/js/translate/callTranslator/FunctionCallCases.kt +++ b/js/js.translator/src/org/jetbrains/kotlin/js/translate/callTranslator/FunctionCallCases.kt @@ -282,7 +282,8 @@ object DynamicOperatorCallCase : FunctionCallCase() { } is JetPostfixExpression -> { // TODO drop hack with ":JsExpression" when KT-5569 will be fixed - JsPostfixOperation(OperatorTable.getUnaryOperator(operationToken), dispatchReceiver): JsExpression + @Suppress("USELESS_CAST") + (JsPostfixOperation(OperatorTable.getUnaryOperator(operationToken), dispatchReceiver) as JsExpression) } else -> unsupported("Unsupported callElement type: ${callElement.javaClass}, callElement: $callElement, callInfo: $this") } diff --git a/js/js.translator/src/org/jetbrains/kotlin/js/translate/declaration/DelegationTranslator.kt b/js/js.translator/src/org/jetbrains/kotlin/js/translate/declaration/DelegationTranslator.kt index 0b9b61b24ac..9a0c0aeadae 100644 --- a/js/js.translator/src/org/jetbrains/kotlin/js/translate/declaration/DelegationTranslator.kt +++ b/js/js.translator/src/org/jetbrains/kotlin/js/translate/declaration/DelegationTranslator.kt @@ -36,7 +36,7 @@ import org.jetbrains.kotlin.psi.JetClassOrObject import org.jetbrains.kotlin.psi.JetDelegationSpecifier import org.jetbrains.kotlin.psi.JetDelegatorByExpressionSpecifier import org.jetbrains.kotlin.resolve.DescriptorUtils -import java.util.HashMap +import java.util.* public class DelegationTranslator( private val classDeclaration: JetClassOrObject, @@ -116,13 +116,13 @@ public class DelegationTranslator( val delegateRefName = context().getScopeForDescriptor(getterDescriptor).declareName(delegateName) val delegateRef = JsNameRef(delegateRefName, JsLiteral.THIS) - val returnExpression = if (DescriptorUtils.isExtension(descriptor)) { + val returnExpression: JsExpression = if (DescriptorUtils.isExtension(descriptor)) { // TODO remove explicit type specification after resolving KT-5569 val getterName = context().getNameForDescriptor(getterDescriptor) val receiver = Namer.getReceiverParameterName() JsInvocation(JsNameRef(getterName, delegateRef), JsNameRef(receiver)) } else { - JsNameRef(propertyName, delegateRef): JsExpression // TODO remove explicit type specification after resolving KT-5569 + JsNameRef(propertyName, delegateRef) } val jsFunction = simpleReturnFunction(context().getScopeForDescriptor(getterDescriptor.getContainingDeclaration()), returnExpression)