diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/builtinSpecialBridges.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/builtinSpecialBridges.kt index 5dc175bc30d..20b2744c4ad 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/builtinSpecialBridges.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/builtinSpecialBridges.kt @@ -63,8 +63,7 @@ object BuiltinSpecialBridgesUtil { val specialBridgeExists = function.getSpecialBridgeSignatureIfExists(signatureByDescriptor) != null val specialBridgesSignaturesInSuperClass = function.overriddenTreeAsSequence(useOriginal = true).mapNotNull { - if (it === function) return@mapNotNull null - it.getSpecialBridgeSignatureIfExists(signatureByDescriptor) + it.takeUnless { it === function }?.getSpecialBridgeSignatureIfExists(signatureByDescriptor) } val isTherePossibleClashWithSpecialBridge = specialBridgeSignature in specialBridgesSignaturesInSuperClass diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineCodegen.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineCodegen.kt index af2cf12e79e..1dfb9525cf8 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineCodegen.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineCodegen.kt @@ -288,7 +288,7 @@ class CoroutineCodegen private constructor( } private fun allFunctionParameters() = - listOfNotNull(originalSuspendFunctionDescriptor.extensionReceiverParameter) + + originalSuspendFunctionDescriptor.extensionReceiverParameter.let(::listOfNotNull) + originalSuspendFunctionDescriptor.valueParameters.orEmpty() private fun ParameterDescriptor.getFieldInfoForCoroutineLambdaParameter() = diff --git a/compiler/daemon/daemon-client/src/org/jetbrains/kotlin/daemon/client/KotlinCompilerClient.kt b/compiler/daemon/daemon-client/src/org/jetbrains/kotlin/daemon/client/KotlinCompilerClient.kt index eb63f161586..bec4ea5055e 100644 --- a/compiler/daemon/daemon-client/src/org/jetbrains/kotlin/daemon/client/KotlinCompilerClient.kt +++ b/compiler/daemon/daemon-client/src/org/jetbrains/kotlin/daemon/client/KotlinCompilerClient.kt @@ -61,7 +61,7 @@ object KotlinCompilerClient { ): CompileService? { val flagFile = System.getProperty(COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY) ?.let(String::trimQuotes) - ?.takeIf { !it.isBlank() } + ?.takeUnless(String::isBlank) ?.let(::File) ?.takeIf(File::exists) ?: makeAutodeletingFlagFile(baseDir = File(daemonOptions.runFilesPathOrDefault)) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/sam/SingleAbstractMethodUtils.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/sam/SingleAbstractMethodUtils.kt index 4ce6358c867..255e6f5bd22 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/sam/SingleAbstractMethodUtils.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/sam/SingleAbstractMethodUtils.kt @@ -42,8 +42,8 @@ internal fun nonProjectionParametrization(samType: SimpleType): SimpleType? { projection.projectionKind == Variance.INVARIANT -> projection projection.isStarProjection -> - parameter.upperBounds.first().takeIf { - t -> !t.contains { it.constructor.declarationDescriptor in parametersSet } + parameter.upperBounds.first().takeUnless { + t -> t.contains { it.constructor.declarationDescriptor in parametersSet } }?.asTypeProjection() ?: return@nonProjectionParametrization null else -> projection.type.asTypeProjection() diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.kt index b8061cd6e08..d6ba031898e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.kt @@ -417,12 +417,12 @@ class QualifiedExpressionResolver { val qualifierDescriptor = when (receiver) { is PackageQualifier -> { val childPackageFQN = receiver.descriptor.fqName.child(name) - receiver.descriptor.module.getPackage(childPackageFQN).takeIf { !it.isEmpty() } ?: + receiver.descriptor.module.getPackage(childPackageFQN).takeUnless { 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)).takeIf { !it.isEmpty() } + context.scope.ownerDescriptor.module.getPackage(FqName.ROOT.child(name)).takeUnless { it.isEmpty() } is ReceiverValue -> receiver.type.memberScope.memberScopeAsImportingScope().findClassifier(name, location) else -> null } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/DefaultImportProvider.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/DefaultImportProvider.kt index 385c146c59a..92c2c760bd7 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/DefaultImportProvider.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/DefaultImportProvider.kt @@ -55,7 +55,7 @@ class DefaultImportProvider( defaultImports .filter { it.isAllUnder } .mapNotNull { - it.fqName.takeIf { !it.isSubpackageOf(KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME) } + it.fqName.takeUnless { it.isSubpackageOf(KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME) } } val nonKotlinAliasedTypeFqNames = builtinTypeAliases diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/EnumClassLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/EnumClassLowering.kt index 1f4ed97253c..3cff76917ad 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/EnumClassLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/EnumClassLowering.kt @@ -167,8 +167,8 @@ class EnumClassLowering(val context: JvmBackendContext) : ClassLoweringPass { private fun lowerEnumEntries() { irClass.declarations.transformFlat { declaration -> if (declaration is IrEnumEntry) { - listOf(createFieldForEnumEntry(declaration)) + - listOfNotNull(lowerEnumEntryClass(declaration.correspondingClass)) + listOfNotNull(createFieldForEnumEntry(declaration), + lowerEnumEntryClass(declaration.correspondingClass)) } else null } diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/lightClassUtils.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/lightClassUtils.kt index 294c89009e5..ba396abcd7a 100644 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/lightClassUtils.kt +++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/lightClassUtils.kt @@ -50,12 +50,10 @@ fun KtElement.toLightElements(): List = is KtSecondaryConstructor -> LightClassUtil.getLightClassMethods(this as KtFunction) is KtProperty -> LightClassUtil.getLightClassPropertyMethods(this).allDeclarations is KtPropertyAccessor -> listOfNotNull(LightClassUtil.getLightClassAccessorMethod(this)) - is KtParameter -> ArrayList().let { elements -> + is KtParameter -> mutableListOf().also { elements -> toPsiParameters().toCollection(elements) LightClassUtil.getLightClassPropertyMethods(this).toCollection(elements) - toAnnotationLightMethod()?.let { elements.add(it) } - - elements + toAnnotationLightMethod()?.let(elements::add) } is KtTypeParameter -> toPsiTypeParameters() is KtFile -> listOfNotNull(findFacadeClass()) diff --git a/compiler/tests/org/jetbrains/kotlin/scripts/ScriptTemplateTest.kt b/compiler/tests/org/jetbrains/kotlin/scripts/ScriptTemplateTest.kt index b8d94195231..77e31b982ba 100644 --- a/compiler/tests/org/jetbrains/kotlin/scripts/ScriptTemplateTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/scripts/ScriptTemplateTest.kt @@ -334,12 +334,10 @@ class TestKotlinScriptDependenciesResolver : TestKotlinScriptDummyDependenciesRe when (it) { is DependsOn -> if (it.path == "@{runtime}") listOf(kotlinPaths.runtimePath, kotlinPaths.scriptRuntimePath) else listOf(File(it.path)) is DependsOnTwo -> listOf(it.path1, it.path2).flatMap { - it.let { - when { - it.isBlank() -> emptyList() - it == "@{runtime}" -> listOf(kotlinPaths.runtimePath, kotlinPaths.scriptRuntimePath) - else -> listOf(File(it)) - } + when { + it.isBlank() -> emptyList() + it == "@{runtime}" -> listOf(kotlinPaths.runtimePath, kotlinPaths.scriptRuntimePath) + else -> listOf(File(it)) } } is InvalidScriptResolverAnnotation -> throw Exception("Invalid annotation ${it.name}", it.error) diff --git a/compiler/util/src/org/jetbrains/kotlin/utils/reflectionUtil.kt b/compiler/util/src/org/jetbrains/kotlin/utils/reflectionUtil.kt index 215f1c9daba..8c255b38c3e 100644 --- a/compiler/util/src/org/jetbrains/kotlin/utils/reflectionUtil.kt +++ b/compiler/util/src/org/jetbrains/kotlin/utils/reflectionUtil.kt @@ -183,7 +183,7 @@ private class StringArgsConverter : ArgsConverter { DoubleArray::class -> args.map { it?.toDoubleOrNull() } BooleanArray::class -> args.map { it?.toBoolean() } else -> null - }?.toList()?.takeIf { list -> list.none { it == null } }?.toTypedArray() + }?.toList()?.takeUnless { null in it }?.toTypedArray() val parameterType = parameter.type if (parameterType.jvmErasure.java.isArray) { diff --git a/core/descriptors/src/org/jetbrains/kotlin/builtins/functionTypes.kt b/core/descriptors/src/org/jetbrains/kotlin/builtins/functionTypes.kt index 81d7c4e1ea5..bb6656e018d 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/builtins/functionTypes.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/builtins/functionTypes.kt @@ -166,7 +166,7 @@ fun getFunctionTypeArgumentProjections( arguments.addIfNotNull(receiverType?.asTypeProjection()) parameterTypes.mapIndexedTo(arguments) { index, type -> - val name = parameterNames?.get(index)?.takeIf { !it.isSpecial } + val name = parameterNames?.get(index)?.takeUnless { it.isSpecial } val typeToUse = if (name != null) { val annotationClass = builtIns.getBuiltInClassByName(KotlinBuiltIns.FQ_NAMES.parameterName.shortName()) val nameValue = ConstantValueFactory(builtIns).createStringValue(name.asString()) diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/VariableDescriptorWithAccessors.kt b/core/descriptors/src/org/jetbrains/kotlin/descriptors/VariableDescriptorWithAccessors.kt index 5008a327615..2bd04e9116c 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/VariableDescriptorWithAccessors.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/VariableDescriptorWithAccessors.kt @@ -33,4 +33,4 @@ interface VariableDescriptorWithAccessors : VariableDescriptor { } val VariableDescriptorWithAccessors.accessors: List - get() = listOfNotNull(getter) + listOfNotNull(setter) + get() = listOfNotNull(getter, setter) diff --git a/idea/ide-common/src/org/jetbrains/kotlin/idea/util/FuzzyType.kt b/idea/ide-common/src/org/jetbrains/kotlin/idea/util/FuzzyType.kt index 3f0fec21839..1f50cf999ed 100644 --- a/idea/ide-common/src/org/jetbrains/kotlin/idea/util/FuzzyType.kt +++ b/idea/ide-common/src/org/jetbrains/kotlin/idea/util/FuzzyType.kt @@ -181,7 +181,7 @@ class FuzzyType( valueTransform = { val typeProjection = TypeProjectionImpl(Variance.INVARIANT, it.defaultType) val substitutedProjection = substitutorToKeepCapturedTypes.substitute(typeProjection) - substitutedProjection?.takeIf { !ErrorUtils.containsUninferredParameter(it.type) } ?: typeProjection + substitutedProjection?.takeUnless { ErrorUtils.containsUninferredParameter(it.type) } ?: typeProjection }) return TypeConstructorSubstitution.createByConstructorsMap(substitutionMap, approximateCapturedTypes = true).buildSubstitutor() } diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/StaticMembersCompletion.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/StaticMembersCompletion.kt index a31a6bb9dda..0218be952d1 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/StaticMembersCompletion.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/StaticMembersCompletion.kt @@ -51,11 +51,11 @@ class StaticMembersCompletion( return object : AbstractLookupElementFactory { override fun createStandardLookupElementsForDescriptor(descriptor: DeclarationDescriptor, useReceiverTypes: Boolean): Collection { if (!useReceiverTypes) return emptyList() - return listOfNotNull(lookupElementFactory.createLookupElement(descriptor, useReceiverTypes = false) - .decorateAsStaticMember(descriptor, classNameAsLookupString = false) - ?.assignPriority(itemPriority) - ?.suppressAutoInsertion() - ) + return lookupElementFactory.createLookupElement(descriptor, useReceiverTypes = false) + .decorateAsStaticMember(descriptor, classNameAsLookupString = false) + ?.assignPriority(itemPriority) + ?.suppressAutoInsertion() + .let(::listOfNotNull) } override fun createLookupElement(descriptor: DeclarationDescriptor, useReceiverTypes: Boolean, diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/ExpectedInfos.kt b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/ExpectedInfos.kt index ef9eb4656a0..adc72432972 100644 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/ExpectedInfos.kt +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/ExpectedInfos.kt @@ -588,7 +588,7 @@ class ExpectedInfos( val loopVar = forExpression.loopParameter val loopVarType = if (loopVar != null && loopVar.typeReference != null) - (bindingContext[BindingContext.DECLARATION_TO_DESCRIPTOR, loopVar] as VariableDescriptor).type.takeIf { !it.isError } + (bindingContext[BindingContext.DECLARATION_TO_DESCRIPTOR, loopVar] as VariableDescriptor).type.takeUnless { it.isError } else null diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/KotlinIndicesHelper.kt b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/KotlinIndicesHelper.kt index fbeb3fd4a2d..44f3ee7609c 100644 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/KotlinIndicesHelper.kt +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/KotlinIndicesHelper.kt @@ -478,7 +478,7 @@ class KotlinIndicesHelper( val translatedDeclaration = declarationTranslator(this) ?: return emptyList() if (!psiFilter(translatedDeclaration)) return emptyList() - return listOfNotNull((resolutionFacade.resolveToDescriptor(translatedDeclaration))) + return listOfNotNull(resolutionFacade.resolveToDescriptor(translatedDeclaration)) } } } diff --git a/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinCodeFragmentFactory.kt b/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinCodeFragmentFactory.kt index 0cffaf61aa9..66ce1982d1a 100644 --- a/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinCodeFragmentFactory.kt +++ b/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinCodeFragmentFactory.kt @@ -322,7 +322,7 @@ class KotlinCodeFragmentFactory: CodeFragmentFactory() { return containingFile } - private fun KtElement?.check(): Boolean = this != null && this.takeIf { KotlinEditorTextProvider.isAcceptedAsCodeFragmentContext(it) } != null + private fun KtElement?.check(): Boolean = this != null && KotlinEditorTextProvider.isAcceptedAsCodeFragmentContext(this) //internal for tests fun createCodeFragmentForLabeledObjects(project: Project, markupMap: Map<*, ValueMarkup>): Pair> { @@ -397,7 +397,7 @@ class KotlinCodeFragmentFactory: CodeFragmentFactory() { val sb = StringBuilder() - javaFile?.packageName?.takeIf { !it.isBlank() }?.let { + javaFile?.packageName?.takeUnless { it.isBlank() }?.let { sb.append("package ").append(it.quoteIfNeeded()).append("\n") } diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeCallableReturnTypeFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeCallableReturnTypeFix.kt index 8bad035bcb0..1b1b2f779d2 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeCallableReturnTypeFix.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeCallableReturnTypeFix.kt @@ -75,7 +75,7 @@ abstract class ChangeCallableReturnTypeFix( val name = element.name if (name != null) { val container = element.resolveToDescriptor().containingDeclaration as? ClassDescriptor - val containerName = container?.name?.takeIf { !it.isSpecial }?.asString() + val containerName = container?.name?.takeUnless { it.isSpecial }?.asString() val fullName = if (containerName != null) "'$containerName.$name'" else "'$name'" if (element is KtParameter) { return "property $fullName" diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeVariableTypeFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeVariableTypeFix.kt index 542310e4937..f33f605d757 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeVariableTypeFix.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeVariableTypeFix.kt @@ -50,7 +50,7 @@ open class ChangeVariableTypeFix(element: KtVariableDeclaration, type: KotlinTyp val name = element.name if (name != null) { val container = element.resolveToDescriptor().containingDeclaration as? ClassDescriptor - val containerName = container?.name?.takeIf { !it.isSpecial }?.asString() + val containerName = container?.name?.takeUnless { it.isSpecial }?.asString() return if (containerName != null) "'$containerName.$name'" else "'$name'" } else { diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/ImportFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/ImportFix.kt index b90d28e718f..b4e2ef00479 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/ImportFix.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/ImportFix.kt @@ -488,8 +488,8 @@ internal class ImportForMismatchingArgumentsFix( return callExpression.valueArguments + callExpression.valueArguments.mapNotNull { it.getArgumentExpression() } + callExpression.valueArguments.mapNotNull { it.getArgumentName()?.referenceExpression } + - listOfNotNull(callExpression.valueArgumentList) + - listOfNotNull(callExpression.referenceExpression()) + listOfNotNull(callExpression.valueArgumentList, + callExpression.referenceExpression()) } override fun fillCandidates( diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/KotlinIntentionActionFactoryWithDelegate.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/KotlinIntentionActionFactoryWithDelegate.kt index 7dcb7cb7fce..d9cbf77d3b2 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/KotlinIntentionActionFactoryWithDelegate.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/KotlinIntentionActionFactoryWithDelegate.kt @@ -37,11 +37,11 @@ abstract class KotlinSingleIntentionActionFactoryWithDelegate D? ): List { - return listOf(QuickFixWithDelegateFactory(actionPriority) factory@ { + return QuickFixWithDelegateFactory(actionPriority) factory@ { val originalElement = originalElementPointer.element ?: return@factory null val data = quickFixDataFactory() ?: return@factory null createFix(originalElement, data) - }) + }.let(::listOf) } } diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createClass/CreateClassFromCallWithConstructorCalleeActionFactory.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createClass/CreateClassFromCallWithConstructorCalleeActionFactory.kt index 8b2870b5035..0b8a795342f 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createClass/CreateClassFromCallWithConstructorCalleeActionFactory.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createClass/CreateClassFromCallWithConstructorCalleeActionFactory.kt @@ -45,7 +45,7 @@ object CreateClassFromCallWithConstructorCalleeActionFactory : CreateClassFromUs } override fun getPossibleClassKinds(element: KtCallElement, diagnostic: Diagnostic): List { - return listOf((if (element is KtAnnotationEntry) ClassKind.ANNOTATION_CLASS else ClassKind.PLAIN_CLASS)) + return listOf(if (element is KtAnnotationEntry) ClassKind.ANNOTATION_CLASS else ClassKind.PLAIN_CLASS) } override fun extractFixData(element: KtCallElement, diagnostic: Diagnostic): ClassInfo? { diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createTypeParameter/CreateTypeParameterUnmatchedTypeArgumentActionFactory.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createTypeParameter/CreateTypeParameterUnmatchedTypeArgumentActionFactory.kt index 15d17fdb5ae..64d62b0661e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createTypeParameter/CreateTypeParameterUnmatchedTypeArgumentActionFactory.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createTypeParameter/CreateTypeParameterUnmatchedTypeArgumentActionFactory.kt @@ -76,10 +76,10 @@ object CreateTypeParameterUnmatchedTypeArgumentActionFactory : KotlinIntentionAc diagnostic: Diagnostic, quickFixDataFactory: () -> CreateTypeParameterData? ): List { - return listOf(QuickFixWithDelegateFactory factory@ { + return QuickFixWithDelegateFactory factory@ { val originalElement = originalElementPointer.element ?: return@factory null val data = quickFixDataFactory() ?: return@factory null CreateTypeParameterFromUsageFix(originalElement, data, false) - }) + }.let(::listOf) } } \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceVariable/KotlinIntroduceVariableHandler.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceVariable/KotlinIntroduceVariableHandler.kt index e2285a06b04..b70c33af0e8 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceVariable/KotlinIntroduceVariableHandler.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceVariable/KotlinIntroduceVariableHandler.kt @@ -561,11 +561,11 @@ object KotlinIntroduceVariableHandler : RefactoringActionHandler { componentFunctions.map { suggestNamesForComponent(it, project, collectingValidator) } } else { - listOf(KotlinNameSuggester.suggestNamesByExpressionAndType(expression, - substringInfo?.type, - bindingContext, - validator, - "value")) + KotlinNameSuggester.suggestNamesByExpressionAndType(expression, + substringInfo?.type, + bindingContext, + validator, + "value").let(::listOf) } val introduceVariableContext = IntroduceVariableContext(