Cleanup: fix some compiler warnings (mostly deprecations, javaClass)
This commit is contained in:
@@ -38,7 +38,6 @@ import org.jetbrains.kotlin.resolve.CompilerEnvironment
|
||||
import org.jetbrains.kotlin.resolve.MultiTargetPlatform
|
||||
import org.jetbrains.kotlin.resolve.TargetEnvironment
|
||||
import org.jetbrains.kotlin.resolve.TargetPlatform
|
||||
import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
||||
import java.util.*
|
||||
|
||||
class ResolverForModule(
|
||||
@@ -179,7 +178,7 @@ abstract class AnalyzerFacade<in P : PlatformAnalysisParameters> {
|
||||
val resolverForProject = createResolverForProject()
|
||||
|
||||
fun computeDependencyDescriptors(module: M): List<ModuleDescriptorImpl> {
|
||||
val orderedDependencies = firstDependency.singletonOrEmptyList() + module.dependencies()
|
||||
val orderedDependencies = listOfNotNull(firstDependency) + module.dependencies()
|
||||
val dependenciesDescriptors = orderedDependencies.mapTo(ArrayList<ModuleDescriptorImpl>()) {
|
||||
dependencyInfo ->
|
||||
resolverForProject.descriptorForModule(dependencyInfo as M)
|
||||
|
||||
@@ -113,7 +113,7 @@ class ConstructorConsistencyChecker private constructor(
|
||||
.filterIsInstance<PropertyDescriptor>()
|
||||
.filter { trace.get(BindingContext.BACKING_FIELD_REQUIRED, it) == true }
|
||||
pseudocode.traverse(
|
||||
TraversalOrder.FORWARD, variablesData.variableInitializers, { instruction, enterData, exitData ->
|
||||
TraversalOrder.FORWARD, variablesData.variableInitializers, { instruction, enterData, _ ->
|
||||
|
||||
fun firstUninitializedNotNullProperty() = propertyDescriptors.firstOrNull {
|
||||
!it.type.isMarkedNullable && !KotlinBuiltIns.isPrimitiveType(it.type) &&
|
||||
|
||||
@@ -549,7 +549,7 @@ class ControlFlowInformationProvider private constructor(
|
||||
pseudocode.traverse(TraversalOrder.BACKWARD, variableStatusData) {
|
||||
instruction: Instruction,
|
||||
enterData: Map<VariableDescriptor, VariableUseState>,
|
||||
exitData: Map<VariableDescriptor, VariableUseState> ->
|
||||
_: Map<VariableDescriptor, VariableUseState> ->
|
||||
|
||||
val ctxt = VariableUseContext(instruction, reportedDiagnosticMap)
|
||||
val declaredVariables = pseudocodeVariablesData.getDeclaredVariables(instruction.owner, false)
|
||||
|
||||
@@ -1026,7 +1026,7 @@ class ControlFlowProcessor(private val trace: BindingTrace) {
|
||||
}
|
||||
|
||||
private fun isBlockInDoWhile(expression: KtBlockExpression): Boolean {
|
||||
val parent = expression.parent ?: return false
|
||||
val parent = expression.parent
|
||||
return parent.parent is KtDoWhileExpression
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -17,17 +17,16 @@
|
||||
package org.jetbrains.kotlin.cfg.pseudocode.instructions
|
||||
|
||||
import org.jetbrains.kotlin.psi.KtElement
|
||||
import org.jetbrains.kotlin.utils.emptyOrSingletonList
|
||||
|
||||
abstract class InstructionWithNext(
|
||||
element: KtElement,
|
||||
blockScope: BlockScope
|
||||
) : KtElementInstructionImpl(element, blockScope) {
|
||||
var next: Instruction? = null
|
||||
set(value: Instruction?) {
|
||||
set(value) {
|
||||
field = outgoingEdgeTo(value)
|
||||
}
|
||||
|
||||
override val nextInstructions: Collection<Instruction>
|
||||
get() = emptyOrSingletonList(next)
|
||||
get() = listOfNotNull(next)
|
||||
}
|
||||
|
||||
+2
-3
@@ -22,7 +22,6 @@ import org.jetbrains.kotlin.cfg.pseudocode.instructions.BlockScope
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.KtElementInstructionImpl
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionImpl
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.Instruction
|
||||
import org.jetbrains.kotlin.utils.emptyOrSingletonList
|
||||
|
||||
abstract class AbstractJumpInstruction(
|
||||
element: KtElement,
|
||||
@@ -30,7 +29,7 @@ abstract class AbstractJumpInstruction(
|
||||
blockScope: BlockScope
|
||||
) : KtElementInstructionImpl(element, blockScope), JumpInstruction {
|
||||
var resolvedTarget: Instruction? = null
|
||||
set(value: Instruction?) {
|
||||
set(value) {
|
||||
field = outgoingEdgeTo(value)
|
||||
}
|
||||
|
||||
@@ -45,5 +44,5 @@ abstract class AbstractJumpInstruction(
|
||||
}
|
||||
|
||||
override val nextInstructions: Collection<Instruction>
|
||||
get() = emptyOrSingletonList(resolvedTarget)
|
||||
get() = listOfNotNull(resolvedTarget)
|
||||
}
|
||||
|
||||
+3
-4
@@ -24,7 +24,6 @@ import org.jetbrains.kotlin.cfg.pseudocode.instructions.BlockScope
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.Instruction
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionVisitorWithResult
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionVisitor
|
||||
import org.jetbrains.kotlin.utils.emptyOrSingletonList
|
||||
|
||||
class ConditionalJumpInstruction(
|
||||
element: KtElement,
|
||||
@@ -37,13 +36,13 @@ class ConditionalJumpInstruction(
|
||||
|
||||
var nextOnTrue: Instruction
|
||||
get() = _nextOnTrue!!
|
||||
set(value: Instruction) {
|
||||
set(value) {
|
||||
_nextOnTrue = outgoingEdgeTo(value)
|
||||
}
|
||||
|
||||
var nextOnFalse: Instruction
|
||||
get() = _nextOnFalse!!
|
||||
set(value: Instruction) {
|
||||
set(value) {
|
||||
_nextOnFalse = outgoingEdgeTo(value)
|
||||
}
|
||||
|
||||
@@ -51,7 +50,7 @@ class ConditionalJumpInstruction(
|
||||
get() = Arrays.asList(nextOnFalse, nextOnTrue)
|
||||
|
||||
override val inputValues: List<PseudoValue>
|
||||
get() = emptyOrSingletonList(conditionValue)
|
||||
get() = listOfNotNull(conditionValue)
|
||||
|
||||
override fun accept(visitor: InstructionVisitor) {
|
||||
visitor.visitConditionalJump(this)
|
||||
|
||||
+2
-3
@@ -27,7 +27,6 @@ import org.jetbrains.kotlin.cfg.pseudocode.instructions.Instruction
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionVisitor
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionVisitorWithResult
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionImpl
|
||||
import org.jetbrains.kotlin.utils.emptyOrSingletonList
|
||||
|
||||
class NondeterministicJumpInstruction(
|
||||
element: KtElement,
|
||||
@@ -48,7 +47,7 @@ class NondeterministicJumpInstruction(
|
||||
|
||||
var next: Instruction
|
||||
get() = _next!!
|
||||
set(value: Instruction) {
|
||||
set(value) {
|
||||
_next = outgoingEdgeTo(value)
|
||||
}
|
||||
|
||||
@@ -60,7 +59,7 @@ class NondeterministicJumpInstruction(
|
||||
}
|
||||
|
||||
override val inputValues: List<PseudoValue>
|
||||
get() = emptyOrSingletonList(inputValue)
|
||||
get() = listOfNotNull(inputValue)
|
||||
|
||||
override fun accept(visitor: InstructionVisitor) {
|
||||
visitor.visitNondeterministicJump(this)
|
||||
|
||||
+1
-2
@@ -20,7 +20,6 @@ import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.singletonList
|
||||
|
||||
sealed class LocalVariableAccessorDescriptor(
|
||||
final override val correspondingVariable: LocalVariableDescriptor,
|
||||
@@ -38,7 +37,7 @@ sealed class LocalVariableAccessorDescriptor(
|
||||
|
||||
init {
|
||||
val valueParameters =
|
||||
if (isGetter) emptyList() else createValueParameter(Name.identifier("value"), correspondingVariable.type).singletonList()
|
||||
if (isGetter) emptyList() else listOf(createValueParameter(Name.identifier("value"), correspondingVariable.type))
|
||||
initialize(null, null, emptyList(), valueParameters, correspondingVariable.type, Modality.FINAL, Visibilities.LOCAL)
|
||||
}
|
||||
|
||||
|
||||
@@ -276,7 +276,7 @@ object PositioningStrategies {
|
||||
is KtPropertyAccessor -> element.namePlaceholder
|
||||
is KtAnonymousInitializer -> element
|
||||
else -> throw IllegalArgumentException(
|
||||
"Can't find text range for element '${element.javaClass.canonicalName}' with the text '${element.text}'")
|
||||
"Can't find text range for element '${element::class.java.canonicalName}' with the text '${element.text}'")
|
||||
}
|
||||
return markElement(elementToMark)
|
||||
}
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ sealed class RenderingContext {
|
||||
is DiagnosticWithParameters1<*, *> -> listOf(d.a)
|
||||
is DiagnosticWithParameters2<*, *, *> -> listOf(d.a, d.b)
|
||||
is DiagnosticWithParameters3<*, *, *, *> -> listOf(d.a, d.b, d.c)
|
||||
is ParametrizedDiagnostic<*> -> error("Unexpected diagnostic: ${d.javaClass}")
|
||||
is ParametrizedDiagnostic<*> -> error("Unexpected diagnostic: ${d::class.java}")
|
||||
else -> listOf()
|
||||
}
|
||||
return Impl(parameters)
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ private class AdaptiveClassifierNamePolicy(private val ambiguousNames: List<Name
|
||||
val index = typeParametersWithSameName.indexOf(classifier)
|
||||
renderer.renderAmbiguousTypeParameter(classifier, index + 1, isFirstOccurence)
|
||||
}
|
||||
else -> error("Unexpected classifier: ${classifier.javaClass}")
|
||||
else -> error("Unexpected classifier: ${classifier::class.java}")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ fun KtElement.getDebugText(): String {
|
||||
|
||||
private object DebugTextBuildingVisitor : KtVisitor<String, Unit>() {
|
||||
|
||||
private val LOG = Logger.getInstance(this.javaClass)
|
||||
private val LOG = Logger.getInstance(this::class.java)
|
||||
|
||||
override fun visitKtFile(file: KtFile, data: Unit?): String? {
|
||||
return "STUB file: ${file.name}"
|
||||
@@ -48,7 +48,7 @@ private object DebugTextBuildingVisitor : KtVisitor<String, Unit>() {
|
||||
|
||||
override fun visitKtElement(element: KtElement, data: Unit?): String? {
|
||||
if (element is KtElementImplStub<*>) {
|
||||
LOG.error("getDebugText() is not defined for ${element.javaClass}")
|
||||
LOG.error("getDebugText() is not defined for ${element::class.java}")
|
||||
}
|
||||
return element.text
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ abstract class KtClassOrObject :
|
||||
return getOrCreateBody().addBefore(declaration, anchorAfter) as T
|
||||
}
|
||||
|
||||
fun isTopLevel(): Boolean = stub?.isTopLevel() ?: (parent == null || parent is KtFile)
|
||||
fun isTopLevel(): Boolean = stub?.isTopLevel() ?: (parent is KtFile)
|
||||
|
||||
override fun isLocal(): Boolean = stub?.isLocal() ?: KtPsiUtil.isLocal(this)
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.intellij.testFramework.LightVirtualFile
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getElementTextWithContext
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||
import java.util.*
|
||||
|
||||
abstract class KtCodeFragment(
|
||||
@@ -175,7 +174,7 @@ abstract class KtCodeFragment(
|
||||
private fun initImports(imports: String?) {
|
||||
if (imports != null && !imports.isEmpty()) {
|
||||
|
||||
val importsWithPrefix = imports.split(IMPORT_SEPARATOR).map { it.check { it.startsWith("import ") } ?: "import ${it.trim()}" }
|
||||
val importsWithPrefix = imports.split(IMPORT_SEPARATOR).map { it.takeIf { it.startsWith("import ") } ?: "import ${it.trim()}" }
|
||||
importsWithPrefix.forEach {
|
||||
addImport(it)
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ private val SUPPORTED_ARGUMENT_TYPES = listOf(
|
||||
fun <TElement : KtElement> createByPattern(pattern: String, vararg args: Any, factory: (String) -> TElement): TElement {
|
||||
val argumentTypes = args.map { arg ->
|
||||
SUPPORTED_ARGUMENT_TYPES.firstOrNull { it.klass.isInstance(arg) }
|
||||
?: throw IllegalArgumentException("Unsupported argument type: ${arg.javaClass}, should be one of: ${SUPPORTED_ARGUMENT_TYPES.map { it.klass.simpleName }.joinToString()}")
|
||||
?: throw IllegalArgumentException("Unsupported argument type: ${arg::class.java}, should be one of: ${SUPPORTED_ARGUMENT_TYPES.map { it.klass.simpleName }.joinToString()}")
|
||||
}
|
||||
|
||||
// convert arguments that can be converted into plain text
|
||||
@@ -105,7 +105,7 @@ fun <TElement : KtElement> createByPattern(pattern: String, vararg args: Any, fa
|
||||
val args = args.zip(argumentTypes).map {
|
||||
val (arg, type) = it
|
||||
if (type is PlainTextArgumentType)
|
||||
(type.toPlainText as Function1<in Any, String>).invoke(arg) // TODO: see KT-7833
|
||||
(type.toPlainText as Function1<Any, String>).invoke(arg) // TODO: see KT-7833
|
||||
else
|
||||
arg
|
||||
}
|
||||
@@ -127,7 +127,7 @@ fun <TElement : KtElement> createByPattern(pattern: String, vararg args: Any, fa
|
||||
if (arg is String) continue // already in the text
|
||||
val expectedElementType = (argumentTypes[n] as PsiElementPlaceholderArgumentType<*, *>).placeholderClass
|
||||
|
||||
for ((range, text) in placeholders) {
|
||||
for ((range, _) in placeholders) {
|
||||
val token = resultElement.findElementAt(range.startOffset)!!
|
||||
for (element in token.parentsWithSelf) {
|
||||
val elementRange = element.textRange.shiftRight(-start)
|
||||
|
||||
@@ -28,5 +28,5 @@ internal fun KtElement.deleteSemicolon() {
|
||||
if (sibling == null || sibling.node.elementType != KtTokens.SEMICOLON) return
|
||||
|
||||
val lastSiblingToDelete = PsiTreeUtil.skipSiblingsForward(sibling, PsiWhiteSpace::class.java)?.prevSibling ?: sibling
|
||||
parent?.deleteChildRange(nextSibling, lastSiblingToDelete)
|
||||
parent.deleteChildRange(nextSibling, lastSiblingToDelete)
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ fun StubBasedPsiElementBase<out KotlinClassOrObjectStub<out KtClassOrObject>>.ge
|
||||
}
|
||||
}
|
||||
|
||||
require(this is KtClassOrObject) { "it should be ${KtClassOrObject::class} but it is a ${this.javaClass.name}" }
|
||||
require(this is KtClassOrObject) { "it should be ${KtClassOrObject::class} but it is a ${this::class.java.name}" }
|
||||
|
||||
val stub = stub
|
||||
if (stub != null) {
|
||||
@@ -339,12 +339,12 @@ fun KtModifierListOwner.isProtected(): Boolean = hasModifier(KtTokens.PROTECTED_
|
||||
|
||||
fun KtSimpleNameExpression.isImportDirectiveExpression(): Boolean {
|
||||
val parent = parent
|
||||
return parent is KtImportDirective || parent?.parent is KtImportDirective
|
||||
return parent is KtImportDirective || parent.parent is KtImportDirective
|
||||
}
|
||||
|
||||
fun KtSimpleNameExpression.isPackageDirectiveExpression(): Boolean {
|
||||
val parent = parent
|
||||
return parent is KtPackageDirective || parent?.parent is KtPackageDirective
|
||||
return parent is KtPackageDirective || parent.parent is KtPackageDirective
|
||||
}
|
||||
|
||||
fun KtExpression.isInImportDirective(): Boolean {
|
||||
|
||||
@@ -33,7 +33,7 @@ val STUB_TO_STRING_PREFIX = "KotlinStub$"
|
||||
open class KotlinStubBaseImpl<T : KtElementImplStub<*>>(parent: StubElement<*>?, elementType: IStubElementType<*, *>) : StubBase<T>(parent, elementType) {
|
||||
|
||||
override fun toString(): String {
|
||||
val stubInterface = this.javaClass.interfaces.filter { it.name.contains("Stub") }.single()
|
||||
val stubInterface = this::class.java.interfaces.filter { it.name.contains("Stub") }.single()
|
||||
val propertiesValues = renderPropertyValues(stubInterface)
|
||||
if (propertiesValues.isEmpty()) {
|
||||
return "$STUB_TO_STRING_PREFIX$stubType"
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ class SyntheticClassOrObjectDescriptor(
|
||||
override fun getSealedSubclasses() = emptyList<ClassDescriptor>()
|
||||
|
||||
init {
|
||||
assert(modality != Modality.SEALED) { "Implement getSealedSubclasses() for this class: $javaClass" }
|
||||
assert(modality != Modality.SEALED) { "Implement getSealedSubclasses() for this class: ${this::class.java}" }
|
||||
}
|
||||
|
||||
override fun getDeclaredCallableMembers(): List<CallableMemberDescriptor> =
|
||||
|
||||
@@ -79,7 +79,7 @@ class AllUnderImportScope(
|
||||
}
|
||||
|
||||
override fun printStructure(p: Printer) {
|
||||
p.println(javaClass.simpleName)
|
||||
p.println(this::class.java.simpleName)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.resolve
|
||||
import org.jetbrains.kotlin.psi.KtNamedFunction
|
||||
|
||||
interface BodyResolveCache {
|
||||
open fun resolveFunctionBody(function: KtNamedFunction): BindingContext
|
||||
fun resolveFunctionBody(function: KtNamedFunction): BindingContext
|
||||
|
||||
object ThrowException : BodyResolveCache {
|
||||
override fun resolveFunctionBody(function: KtNamedFunction): BindingContext {
|
||||
|
||||
@@ -34,13 +34,11 @@ import org.jetbrains.kotlin.resolve.BindingContext.*
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils.classCanHaveAbstractMembers
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils.classCanHaveOpenMembers
|
||||
import org.jetbrains.kotlin.resolve.calls.results.TypeSpecificityComparator
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.hasDefaultValue
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||
import org.jetbrains.kotlin.resolve.source.KotlinSourceElement
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
|
||||
import org.jetbrains.kotlin.types.typeUtil.*
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||
import java.util.*
|
||||
|
||||
internal class DeclarationsCheckerBuilder(
|
||||
@@ -189,7 +187,7 @@ class DeclarationsChecker(
|
||||
private fun getUsedTypeAliasParameters(type: KotlinType, typeAlias: TypeAliasDescriptor): Set<TypeParameterDescriptor> =
|
||||
type.constituentTypes().mapNotNullTo(HashSet()) {
|
||||
val descriptor = it.constructor.declarationDescriptor as? TypeParameterDescriptor
|
||||
descriptor?.check { it.containingDeclaration == typeAlias }
|
||||
descriptor?.takeIf { it.containingDeclaration == typeAlias }
|
||||
}
|
||||
|
||||
private class TypeAliasDeclarationCheckingReportStrategy(
|
||||
@@ -271,10 +269,10 @@ class DeclarationsChecker(
|
||||
if (visibilityModifier != null && visibilityModifier.node?.elementType != KtTokens.PRIVATE_KEYWORD) {
|
||||
val classDescriptor = constructorDescriptor.containingDeclaration
|
||||
if (classDescriptor.kind == ClassKind.ENUM_CLASS) {
|
||||
trace.report(NON_PRIVATE_CONSTRUCTOR_IN_ENUM.on(visibilityModifier));
|
||||
trace.report(NON_PRIVATE_CONSTRUCTOR_IN_ENUM.on(visibilityModifier))
|
||||
}
|
||||
else if (classDescriptor.modality == Modality.SEALED) {
|
||||
trace.report(NON_PRIVATE_CONSTRUCTOR_IN_SEALED.on(visibilityModifier));
|
||||
trace.report(NON_PRIVATE_CONSTRUCTOR_IN_SEALED.on(visibilityModifier))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||
|
||||
class LazyExplicitImportScope(
|
||||
private val packageOrClassDescriptor: DeclarationDescriptor,
|
||||
@@ -68,7 +67,7 @@ class LazyExplicitImportScope(
|
||||
}
|
||||
|
||||
override fun printStructure(p: Printer) {
|
||||
p.println(javaClass.simpleName, ": ", aliasName)
|
||||
p.println(this::class.java.simpleName, ": ", aliasName)
|
||||
}
|
||||
|
||||
// should be called only once
|
||||
@@ -113,5 +112,5 @@ class LazyExplicitImportScope(
|
||||
|
||||
private fun <D : CallableMemberDescriptor> Collection<D>.choseOnlyVisibleOrAll() =
|
||||
filter { isVisible(it, packageFragmentForVisibilityCheck, position = QualifierPosition.IMPORT) }.
|
||||
check { it.isNotEmpty() } ?: this
|
||||
takeIf { it.isNotEmpty() } ?: this
|
||||
}
|
||||
@@ -26,7 +26,6 @@ import org.jetbrains.kotlin.name.FqNameUnsafe
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.calls.tower.getTypeAliasConstructors
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
||||
import java.util.*
|
||||
|
||||
class OverloadResolver(
|
||||
@@ -38,7 +37,7 @@ class OverloadResolver(
|
||||
fun checkOverloads(c: BodiesResolveContext) {
|
||||
val inClasses = findConstructorsInNestedClassesAndTypeAliases(c)
|
||||
|
||||
for ((key, value) in c.declaredClasses) {
|
||||
for (value in c.declaredClasses.values) {
|
||||
checkOverloadsInClass(value, inClasses.get(value))
|
||||
}
|
||||
checkOverloadsInPackages(c)
|
||||
@@ -115,7 +114,7 @@ class OverloadResolver(
|
||||
scope, name ->
|
||||
val variables = scope.getContributedVariables(name, NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS)
|
||||
val classifier = scope.getContributedClassifier(name, NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS)
|
||||
variables + classifier.singletonOrEmptyList()
|
||||
variables + listOfNotNull(classifier)
|
||||
}
|
||||
|
||||
return packageMembersByName
|
||||
@@ -215,7 +214,7 @@ class OverloadResolver(
|
||||
val bySourceFile = members.groupBy { DescriptorUtils.getContainingSourceFile(it) }
|
||||
|
||||
var hasGroupIncludingNonPrivateMembers = false
|
||||
for ((sourceFile, membersInFile) in bySourceFile) {
|
||||
for (membersInFile in bySourceFile.values) {
|
||||
// File member groups are interesting in redeclaration check if at least one file member is private.
|
||||
if (membersInFile.any { it.isPrivate() }) {
|
||||
hasGroupIncludingNonPrivateMembers = true
|
||||
|
||||
@@ -37,7 +37,6 @@ import org.jetbrains.kotlin.resolve.scopes.utils.memberScopeAsImportingScope
|
||||
import org.jetbrains.kotlin.resolve.source.KotlinSourceElement
|
||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingContext
|
||||
import org.jetbrains.kotlin.types.expressions.isWithoutValueArguments
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||
|
||||
class QualifiedExpressionResolver {
|
||||
fun resolvePackageHeader(
|
||||
@@ -418,12 +417,12 @@ class QualifiedExpressionResolver {
|
||||
val qualifierDescriptor = when (receiver) {
|
||||
is PackageQualifier -> {
|
||||
val childPackageFQN = receiver.descriptor.fqName.child(name)
|
||||
receiver.descriptor.module.getPackage(childPackageFQN).check { !it.isEmpty() } ?:
|
||||
receiver.descriptor.module.getPackage(childPackageFQN).takeIf { !it.isEmpty() } ?:
|
||||
receiver.descriptor.memberScope.getContributedClassifier(name, location)
|
||||
}
|
||||
is ClassQualifier -> receiver.staticScope.getContributedClassifier(name, location)
|
||||
null -> context.scope.findClassifier(name, location) ?:
|
||||
context.scope.ownerDescriptor.module.getPackage(FqName.ROOT.child(name)).check { !it.isEmpty() }
|
||||
context.scope.ownerDescriptor.module.getPackage(FqName.ROOT.child(name)).takeIf { !it.isEmpty() }
|
||||
is ReceiverValue -> receiver.type.memberScope.memberScopeAsImportingScope().findClassifier(name, location)
|
||||
else -> null
|
||||
}
|
||||
@@ -549,7 +548,7 @@ class QualifiedExpressionResolver {
|
||||
trace: BindingTrace,
|
||||
position: QualifierPosition
|
||||
) {
|
||||
path.foldRight(packageView) { (name, expression), currentView ->
|
||||
path.foldRight(packageView) { (_, expression), currentView ->
|
||||
storeResult(trace, expression, currentView, shouldBeVisibleFrom = null, position = position)
|
||||
currentView.containingDeclaration
|
||||
?: error("Containing Declaration must be not null for package with fqName: ${currentView.fqName}, " +
|
||||
|
||||
@@ -121,7 +121,7 @@ abstract class PlatformConfigurator(
|
||||
|
||||
abstract fun configureModuleComponents(container: StorageComponentContainer)
|
||||
|
||||
val platformSpecificContainer = composeContainer(this.javaClass.simpleName) {
|
||||
val platformSpecificContainer = composeContainer(this::class.java.simpleName) {
|
||||
useInstance(dynamicTypesSettings)
|
||||
declarationCheckers.forEach { useInstance(it) }
|
||||
callCheckers.forEach { useInstance(it) }
|
||||
|
||||
@@ -281,7 +281,7 @@ class TypeResolver(
|
||||
override fun getVisibility() = Visibilities.LOCAL
|
||||
|
||||
override fun substitute(substitutor: TypeSubstitutor): VariableDescriptor? {
|
||||
throw UnsupportedOperationException("Should not be called for descriptor of type $javaClass")
|
||||
throw UnsupportedOperationException("Should not be called for descriptor of type ${this::class.java}")
|
||||
}
|
||||
|
||||
override fun isVar() = false
|
||||
@@ -415,7 +415,7 @@ class TypeResolver(
|
||||
}
|
||||
is ClassDescriptor -> resolveTypeForClass(c, annotations, descriptor, element, qualifierResolutionResult)
|
||||
is TypeAliasDescriptor -> resolveTypeForTypeAlias(c, annotations, descriptor, element, qualifierResolutionResult)
|
||||
else -> error("Unexpected classifier type: ${descriptor.javaClass}")
|
||||
else -> error("Unexpected classifier type: ${descriptor::class.java}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -727,7 +727,7 @@ class TypeResolver(
|
||||
Math.min(classifierChainLastIndex + 1, reversedQualifierParts.size),
|
||||
reversedQualifierParts.size)
|
||||
|
||||
for ((name, expression, typeArguments) in nonClassQualifierParts) {
|
||||
for ((_, _, typeArguments) in nonClassQualifierParts) {
|
||||
if (typeArguments != null) {
|
||||
c.trace.report(TYPE_ARGUMENTS_NOT_ALLOWED.on(typeArguments, "here"))
|
||||
return null
|
||||
|
||||
@@ -189,7 +189,7 @@ class VarianceCheckerCore(
|
||||
(accessor as PropertyAccessorDescriptorImpl).visibility = Visibilities.PRIVATE_TO_THIS
|
||||
}
|
||||
}
|
||||
else -> throw IllegalStateException("Unexpected descriptor type: ${descriptor.javaClass.name}")
|
||||
else -> throw IllegalStateException("Unexpected descriptor type: ${descriptor::class.java.name}")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -94,11 +94,11 @@ open class ConstraintSystemBuilderImpl(private val mode: Mode = ConstraintSystem
|
||||
}
|
||||
}
|
||||
|
||||
for ((descriptor, typeVariable) in typeParameters.zip(typeVariables)) {
|
||||
for ((_, typeVariable) in typeParameters.zip(typeVariables)) {
|
||||
allTypeParameterBounds.put(typeVariable, TypeBoundsImpl(typeVariable))
|
||||
}
|
||||
|
||||
for ((typeVariable, typeBounds) in allTypeParameterBounds) {
|
||||
for ((typeVariable, _) in allTypeParameterBounds) {
|
||||
for (declaredUpperBound in typeVariable.freshTypeParameter.upperBounds) {
|
||||
if (declaredUpperBound.isDefaultBound()) continue //todo remove this line (?)
|
||||
val context = ConstraintContext(TYPE_BOUND_POSITION.position(typeVariable.originalTypeParameter.index))
|
||||
|
||||
@@ -48,7 +48,7 @@ interface TypeBounds {
|
||||
) {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other == null || javaClass != other.javaClass) return false
|
||||
if (other == null || this::class.java != other::class.java) return false
|
||||
|
||||
val bound = other as Bound
|
||||
|
||||
|
||||
+2
-2
@@ -123,7 +123,7 @@ object DataFlowValueFactory {
|
||||
receiverValue.getType(),
|
||||
bindingContext,
|
||||
containingDeclarationOrModule)
|
||||
else -> throw UnsupportedOperationException("Unsupported receiver value: " + receiverValue.javaClass.name)
|
||||
else -> throw UnsupportedOperationException("Unsupported receiver value: " + receiverValue::class.java.name)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@@ -242,7 +242,7 @@ object DataFlowValueFactory {
|
||||
}
|
||||
else {
|
||||
IdentifierInfo.qualified(receiverInfo, implicitReceiver.type,
|
||||
selectorInfo, resolvedCall?.call?.isSafeCall() ?: false)
|
||||
selectorInfo, resolvedCall.call.isSafeCall())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class DynamicCallableDescriptors(storageManager: StorageManager, builtIns: Kotli
|
||||
|
||||
fun createDynamicDescriptorScope(call: Call, owner: DeclarationDescriptor) = object : MemberScopeImpl() {
|
||||
override fun printScopeStructure(p: Printer) {
|
||||
p.println(javaClass.simpleName, ": dynamic candidates for " + call)
|
||||
p.println(this::class.java.simpleName, ": dynamic candidates for " + call)
|
||||
}
|
||||
|
||||
override fun getContributedFunctions(name: Name, location: LookupLocation): Collection<SimpleFunctionDescriptor> {
|
||||
|
||||
+1
-2
@@ -56,7 +56,6 @@ import org.jetbrains.kotlin.types.ErrorUtils
|
||||
import org.jetbrains.kotlin.types.expressions.OperatorConventions
|
||||
import org.jetbrains.kotlin.types.isDynamic
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||
import org.jetbrains.kotlin.utils.sure
|
||||
import java.lang.IllegalStateException
|
||||
import java.util.*
|
||||
@@ -449,7 +448,7 @@ class NewResolutionOldInference(
|
||||
functionContext.tracing.bindReference(variable.resolvedCall.trace, variable.resolvedCall)
|
||||
// todo hacks
|
||||
val functionCall = CallTransformer.CallForImplicitInvoke(
|
||||
basicCallContext.call.explicitReceiver?.check { useExplicitReceiver },
|
||||
basicCallContext.call.explicitReceiver?.takeIf { useExplicitReceiver },
|
||||
variableReceiver, basicCallContext.call, true)
|
||||
val tracingForInvoke = TracingStrategyForInvoke(calleeExpression, functionCall, variableReceiver.type)
|
||||
val basicCallResolutionContext = basicCallContext.replaceBindingTrace(variable.resolvedCall.trace)
|
||||
|
||||
@@ -144,9 +144,9 @@ fun KtElement.getCall(context: BindingContext): Call? {
|
||||
if (element is KtCallElement && element.calleeExpression == null) return null
|
||||
|
||||
val parent = element.parent
|
||||
val reference: KtExpression? = when {
|
||||
parent is KtInstanceExpressionWithLabel -> parent
|
||||
parent is KtUserType -> parent.parent?.parent as? KtConstructorCalleeExpression
|
||||
val reference: KtExpression? = when (parent) {
|
||||
is KtInstanceExpressionWithLabel -> parent
|
||||
is KtUserType -> parent.parent.parent as? KtConstructorCalleeExpression
|
||||
else -> element.getCalleeExpressionIfAny()
|
||||
}
|
||||
if (reference != null) {
|
||||
|
||||
+1
-1
@@ -401,7 +401,7 @@ private class ConstantExpressionEvaluatorVisitor(
|
||||
is IntegerValueTypeConstant ->
|
||||
compileTimeConstant.getType(expectedType)
|
||||
else ->
|
||||
throw IllegalStateException("Unexpected compileTimeConstant class: ${compileTimeConstant.javaClass.canonicalName}")
|
||||
throw IllegalStateException("Unexpected compileTimeConstant class: ${compileTimeConstant::class.java.canonicalName}")
|
||||
|
||||
}
|
||||
if (!constantType.isSubtypeOf(expectedType)) return null
|
||||
|
||||
@@ -24,7 +24,7 @@ interface Diagnostics : Iterable<Diagnostic> {
|
||||
//should not be called on readonly views
|
||||
//any Diagnostics object returned by BindingContext#getDiagnostics() should implement this property
|
||||
val modificationTracker: ModificationTracker
|
||||
get() = throw IllegalStateException("Trying to obtain modification tracker for Diagnostics object of class $javaClass")
|
||||
get() = throw IllegalStateException("Trying to obtain modification tracker for Diagnostics object of class ${this::class.java}")
|
||||
|
||||
fun all(): Collection<Diagnostic>
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class FunctionImportedFromObject(
|
||||
newOwner: DeclarationDescriptor?, modality: Modality?, visibility: Visibility?,
|
||||
kind: CallableMemberDescriptor.Kind?, copyOverrides: Boolean
|
||||
): FunctionDescriptor {
|
||||
throw UnsupportedOperationException("copy() should not be called on ${this.javaClass.simpleName}, was called for $this")
|
||||
throw UnsupportedOperationException("copy() should not be called on ${this::class.java.simpleName}, was called for $this")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class PropertyImportedFromObject(
|
||||
newOwner: DeclarationDescriptor?, modality: Modality?, visibility: Visibility?,
|
||||
kind: CallableMemberDescriptor.Kind?, copyOverrides: Boolean
|
||||
): FunctionDescriptor {
|
||||
throw UnsupportedOperationException("copy() should not be called on ${this.javaClass.simpleName}, was called for $this")
|
||||
throw UnsupportedOperationException("copy() should not be called on ${this::class.java.simpleName}, was called for $this")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
||||
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
import org.jetbrains.kotlin.storage.getValue
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||
|
||||
class DefaultImportProvider(
|
||||
storageManager: StorageManager,
|
||||
@@ -56,7 +55,7 @@ class DefaultImportProvider(
|
||||
defaultImports
|
||||
.filter { it.isAllUnder }
|
||||
.mapNotNull {
|
||||
it.fqnPart().check { !it.isSubpackageOf(KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME) }
|
||||
it.fqnPart().takeIf { !it.isSubpackageOf(KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME) }
|
||||
}
|
||||
val nonKotlinAliasedTypeFqNames =
|
||||
builtinTypeAliases
|
||||
|
||||
@@ -40,7 +40,6 @@ import org.jetbrains.kotlin.storage.StorageManager
|
||||
import org.jetbrains.kotlin.storage.getValue
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||
|
||||
data class FileScopes(val lexicalScope: LexicalScope, val importingScope: ImportingScope, val importResolver: ImportResolver)
|
||||
|
||||
@@ -176,7 +175,7 @@ class FileScopeFactory(
|
||||
if (name in excludedNames) return null
|
||||
val classifier = scope.getContributedClassifier(name, location) ?: return null
|
||||
val visible = Visibilities.isVisibleIgnoringReceiver(classifier as DeclarationDescriptorWithVisibility, fromDescriptor)
|
||||
return classifier.check { filteringKind == if (visible) FilteringKind.VISIBLE_CLASSES else FilteringKind.INVISIBLE_CLASSES }
|
||||
return classifier.takeIf { filteringKind == if (visible) FilteringKind.VISIBLE_CLASSES else FilteringKind.INVISIBLE_CLASSES }
|
||||
}
|
||||
|
||||
override fun getContributedVariables(name: Name, location: LookupLocation): Collection<PropertyDescriptor> {
|
||||
|
||||
@@ -254,7 +254,7 @@ class LazyImportScope(
|
||||
override fun toString() = "LazyImportScope: " + debugName
|
||||
|
||||
override fun printStructure(p: Printer) {
|
||||
p.println(javaClass.simpleName, ": ", debugName, " {")
|
||||
p.println(this::class.java.simpleName, ": ", debugName, " {")
|
||||
p.pushIndent()
|
||||
|
||||
p.popIndent()
|
||||
|
||||
+6
-7
@@ -33,7 +33,6 @@ import org.jetbrains.kotlin.resolve.scopes.MemberScopeImpl
|
||||
import org.jetbrains.kotlin.storage.MemoizedFunctionToNotNull
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
import org.jetbrains.kotlin.utils.toReadOnlyList
|
||||
import java.util.*
|
||||
|
||||
abstract class AbstractLazyMemberScope<out D : DeclarationDescriptor, out DP : DeclarationProvider>
|
||||
@@ -61,7 +60,7 @@ protected constructor(
|
||||
}
|
||||
}
|
||||
getNonDeclaredClasses(name, result)
|
||||
return result.toReadOnlyList()
|
||||
return result.toList()
|
||||
}
|
||||
|
||||
override fun getContributedClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? {
|
||||
@@ -92,7 +91,7 @@ protected constructor(
|
||||
|
||||
getNonDeclaredFunctions(name, result)
|
||||
|
||||
return result.toReadOnlyList()
|
||||
return result.toList()
|
||||
}
|
||||
|
||||
protected abstract fun getScopeForMemberDeclarationResolution(declaration: KtDeclaration): LexicalScope
|
||||
@@ -125,7 +124,7 @@ protected constructor(
|
||||
|
||||
getNonDeclaredProperties(name, result)
|
||||
|
||||
return result.toReadOnlyList()
|
||||
return result.toList()
|
||||
}
|
||||
|
||||
protected abstract fun getNonDeclaredProperties(name: Name, result: MutableSet<PropertyDescriptor>)
|
||||
@@ -142,7 +141,7 @@ protected constructor(
|
||||
getScopeForMemberDeclarationResolution(ktTypeAlias),
|
||||
ktTypeAlias,
|
||||
trace)
|
||||
}.toReadOnlyList()
|
||||
}.toList()
|
||||
|
||||
protected fun computeDescriptorsFromDeclaredElements(
|
||||
kindFilter: DescriptorKindFilter,
|
||||
@@ -193,7 +192,7 @@ protected constructor(
|
||||
}
|
||||
else throw IllegalArgumentException("Unsupported declaration kind: " + declaration)
|
||||
}
|
||||
return result.toReadOnlyList()
|
||||
return result.toList()
|
||||
}
|
||||
|
||||
abstract fun recordLookup(name: Name, from: LookupLocation)
|
||||
@@ -204,7 +203,7 @@ protected constructor(
|
||||
abstract override fun toString(): String
|
||||
|
||||
override fun printScopeStructure(p: Printer) {
|
||||
p.println(javaClass.simpleName, " {")
|
||||
p.println(this::class.java.simpleName, " {")
|
||||
p.pushIndent()
|
||||
|
||||
p.println("thisDescriptor = ", thisDescriptor)
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ abstract class AbstractLocalRedeclarationChecker(val overloadChecker: OverloadCh
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> throw IllegalStateException("Unexpected type of descriptor: ${newDescriptor.javaClass.name}, descriptor: $newDescriptor")
|
||||
else -> throw IllegalStateException("Unexpected type of descriptor: ${newDescriptor::class.java.name}, descriptor: $newDescriptor")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ class TypeAliasQualifier(
|
||||
?.takeIf { DescriptorUtils.isEnumEntry(it) }
|
||||
|
||||
override fun printScopeStructure(p: Printer) {
|
||||
p.println(javaClass.simpleName, " {")
|
||||
p.println(this::class.java.simpleName, " {")
|
||||
p.pushIndent()
|
||||
p.println("descriptor = ", descriptor)
|
||||
p.popIndent()
|
||||
|
||||
+3
-3
@@ -30,8 +30,8 @@ import org.jetbrains.kotlin.psi.KtScript
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
||||
import java.io.File
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.memberFunctions
|
||||
import kotlin.reflect.primaryConstructor
|
||||
import kotlin.reflect.full.memberFunctions
|
||||
import kotlin.reflect.full.primaryConstructor
|
||||
|
||||
open class KotlinScriptDefinitionFromAnnotatedTemplate(
|
||||
template: KClass<out Any>,
|
||||
@@ -95,7 +95,7 @@ open class KotlinScriptDefinitionFromAnnotatedTemplate(
|
||||
}
|
||||
|
||||
fun makeScriptContents() = BasicScriptContents(file, getAnnotations = {
|
||||
val classLoader = (template as Any).javaClass.classLoader
|
||||
val classLoader = (template as Any)::class.java.classLoader
|
||||
try {
|
||||
getAnnotationEntries(file, project)
|
||||
.mapNotNull { psiAnn ->
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.types.TypeUtils
|
||||
import org.jetbrains.kotlin.utils.tryCreateCallableMappingFromNamedArgs
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.KParameter
|
||||
import kotlin.reflect.primaryConstructor
|
||||
import kotlin.reflect.full.primaryConstructor
|
||||
|
||||
internal val KtAnnotationEntry.typeName: String get() = (typeReference?.typeElement as? KtUserType)?.referencedName.orAnonymous()
|
||||
|
||||
|
||||
+2
-2
@@ -52,13 +52,13 @@ interface ScriptTemplatesProvider {
|
||||
}
|
||||
|
||||
fun makeScriptDefsFromTemplatesProviderExtensions(project: Project,
|
||||
errorsHandler: ((ScriptTemplatesProvider, Exception) -> Unit) = { ep, ex -> throw ex }
|
||||
errorsHandler: ((ScriptTemplatesProvider, Exception) -> Unit) = { _, ex -> throw ex }
|
||||
): List<KotlinScriptDefinitionFromAnnotatedTemplate> =
|
||||
makeScriptDefsFromTemplatesProviders(Extensions.getArea(project).getExtensionPoint(ScriptTemplatesProvider.EP_NAME).extensions.asIterable(),
|
||||
errorsHandler)
|
||||
|
||||
fun makeScriptDefsFromTemplatesProviders(providers: Iterable<ScriptTemplatesProvider>,
|
||||
errorsHandler: ((ScriptTemplatesProvider, Exception) -> Unit) = { ep, ex -> throw ex }
|
||||
errorsHandler: ((ScriptTemplatesProvider, Exception) -> Unit) = { _, ex -> throw ex }
|
||||
): List<KotlinScriptDefinitionFromAnnotatedTemplate> {
|
||||
return providers.filter { it.isValid }.flatMap { provider ->
|
||||
try {
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.serialization.deserialization.findNonGenericClassAcr
|
||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import kotlin.reflect.*
|
||||
import kotlin.reflect.full.primaryConstructor
|
||||
|
||||
data class ScriptParameter(val name: Name, val type: KotlinType)
|
||||
|
||||
|
||||
@@ -41,6 +41,6 @@ open class ExceptionTracker : ModificationTracker, LockBasedStorageManager.Excep
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return javaClass.name + ": " + modificationCount
|
||||
return this::class.java.name + ": " + modificationCount
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ class FakeCallResolver(
|
||||
|
||||
if (isSuccess) {
|
||||
fakeTrace.commit(
|
||||
{ slice, key ->
|
||||
{ _, key ->
|
||||
// excluding all entries related to fake expression
|
||||
// convert all errors on this expression to ITERATOR_MISSING on callElement
|
||||
key != fake
|
||||
@@ -106,7 +106,7 @@ class FakeCallResolver(
|
||||
valueArguments: List<KtExpression>,
|
||||
name: Name,
|
||||
callElement: KtExpression,
|
||||
onComplete: (KtSimpleNameExpression, Boolean) -> Unit = { x, y -> }
|
||||
onComplete: (KtSimpleNameExpression, Boolean) -> Unit = { _, _ -> }
|
||||
): Pair<Call, OverloadResolutionResults<FunctionDescriptor>> {
|
||||
val fakeCalleeExpression = KtPsiFactory(project).createSimpleName(name.asString())
|
||||
val call = CallMaker.makeCallWithExpressions(
|
||||
|
||||
+1
-1
@@ -373,7 +373,7 @@ class PatternMatchingTypingVisitor internal constructor(facade: ExpressionTyping
|
||||
}
|
||||
|
||||
override fun visitKtElement(element: KtElement) {
|
||||
context.trace.report(UNSUPPORTED.on(element, javaClass.canonicalName))
|
||||
context.trace.report(UNSUPPORTED.on(element, this::class.java.canonicalName))
|
||||
}
|
||||
})
|
||||
return newDataFlowInfo
|
||||
|
||||
+1
-2
@@ -32,7 +32,6 @@ import org.jetbrains.kotlin.psi.KtSuperExpression
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.TypeUtils
|
||||
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.singletonList
|
||||
|
||||
|
||||
fun resolveUnqualifiedSuperFromExpressionContext(
|
||||
@@ -106,7 +105,7 @@ private fun resolveSupertypesForMethodOfAny(supertypes: Collection<KotlinType>,
|
||||
return if (typesWithConcreteOverride.isNotEmpty())
|
||||
typesWithConcreteOverride
|
||||
else
|
||||
anyType.singletonList()
|
||||
listOf(anyType)
|
||||
}
|
||||
|
||||
private fun resolveSupertypesByCalleeName(supertypes: Collection<KotlinType>, calleeName: Name): Collection<KotlinType> =
|
||||
|
||||
Reference in New Issue
Block a user