Fix "Placing function type parameters after the function name" errors in project

This commit is contained in:
Yan Zhulanow
2015-11-24 18:21:13 +03:00
parent 87799e9b6b
commit 278f1cd6ef
21 changed files with 46 additions and 46 deletions
@@ -61,7 +61,7 @@ public class HierarchySearchRequest<T: PsiElement> (
override val searchScope: SearchScope,
val searchDeeply: Boolean = true
) : SearchRequestWithElement<T> {
fun copy<U: PsiElement>(newOriginalElement: U): HierarchySearchRequest<U> =
fun <U: PsiElement> copy(newOriginalElement: U): HierarchySearchRequest<U> =
HierarchySearchRequest(newOriginalElement, searchScope, searchDeeply)
}
@@ -21,14 +21,14 @@ import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.stubs.KotlinCallableStubBase
import org.jetbrains.kotlin.util.aliasImportMap
fun indexTopLevelExtension<TDeclaration : KtCallableDeclaration>(stub: KotlinCallableStubBase<TDeclaration>, sink: IndexSink) {
fun <TDeclaration : KtCallableDeclaration> indexTopLevelExtension(stub: KotlinCallableStubBase<TDeclaration>, sink: IndexSink) {
if (stub.isExtension()) {
val declaration = stub.getPsi()
declaration.getReceiverTypeReference()!!.typeElement?.index(declaration, sink)
}
}
private fun KtTypeElement.index<TDeclaration : KtCallableDeclaration>(declaration: TDeclaration, sink: IndexSink) {
private fun <TDeclaration : KtCallableDeclaration> KtTypeElement.index(declaration: TDeclaration, sink: IndexSink) {
fun occurrence(typeName: String) {
val name = declaration.getName() ?: return
sink.occurrence(KotlinTopLevelExtensionsByReceiverTypeIndex.INSTANCE.getKey(),
@@ -21,11 +21,11 @@ import com.intellij.openapi.command.CommandProcessor
import com.intellij.openapi.project.DumbService
import com.intellij.openapi.project.Project
public fun runReadAction<T>(action: () -> T): T {
public fun <T> runReadAction(action: () -> T): T {
return ApplicationManager.getApplication().runReadAction<T>(action)
}
public fun runWriteAction<T>(action: () -> T): T {
public fun <T> runWriteAction(action: () -> T): T {
return ApplicationManager.getApplication().runWriteAction<T>(action)
}
@@ -342,7 +342,7 @@ public fun KtElement.getContextForContainingDeclarationBody(): BindingContext? {
return bodyElement?.let { it.analyze() }
}
public fun chooseContainerElement<T>(
public fun <T> chooseContainerElement(
containers: List<T>,
editor: Editor,
title: String,
@@ -415,7 +415,7 @@ public fun chooseContainerElement<T>(
).showInBestPositionFor(editor)
}
public fun chooseContainerElementIfNecessary<T>(
public fun <T> chooseContainerElementIfNecessary(
containers: List<T>,
editor: Editor,
title: String,
@@ -462,7 +462,7 @@ private fun copyModifierListItems(from: PsiModifierList, to: PsiModifierList, wi
}
}
private fun copyTypeParameters<T>(
private fun <T> copyTypeParameters(
from: T,
to: T,
inserter: (T, PsiTypeParameterList) -> Unit
@@ -522,7 +522,7 @@ public class KotlinPsiUnifier(
return (!decl1.isNameRelevant() && !decl2.isNameRelevant()) || desc1.getName() == desc2.getName()
}
private fun matchContainedDescriptors<T: DeclarationDescriptor>(
private fun <T: DeclarationDescriptor> matchContainedDescriptors(
declarations1: List<T>,
declarations2: List<T>,
matchPair: (Pair<T, T>) -> Boolean
@@ -99,7 +99,7 @@ public abstract class AbstractMemberPullPushTest : KotlinLightCodeInsightFixture
}
}
protected fun chooseMembers<T : MemberInfoBase<*>>(members: List<T>): List<T> {
protected fun <T : MemberInfoBase<*>> chooseMembers(members: List<T>): List<T> {
members.forEach {
val info = it.member.elementInfo
it.isChecked = info.checked
@@ -52,7 +52,7 @@ public class KotlinReferencesSearchTest(): AbstractSearcherTest() {
// workaround for KT-9788 AssertionError from backand when we read field from inline function
private val myFixtureProxy: JavaCodeInsightTestFixture get() = myFixture
private inline fun doTest<reified T: PsiElement>(): List<PsiReference> {
private inline fun <reified T: PsiElement> doTest(): List<PsiReference> {
myFixtureProxy.configureByFile(getFileName())
val func = myFixtureProxy.getElementAtCaret().getParentOfType<T>(false)!!
return ReferencesSearch.search(func).findAll().sortedBy { it.getElement().getTextRange().getStartOffset() }