New J2K: add copy-paste tests for new j2k

This commit is contained in:
Ilya Kirillov
2019-06-20 13:44:42 +03:00
parent dc469cbdbf
commit 98be5d8ed0
113 changed files with 815 additions and 0 deletions
@@ -0,0 +1,39 @@
class A {
fun someOther() = false
private fun formatElement(element: PsiElement): String {
var element: PsiElement = element
element = JetPsiUtil.ascendIfPropertyAccessor(element)
if (element is JetNamedFunction || element is JetProperty) {
val bindingContext: BindingContext = AnalyzerFacadeWithCache.analyzeFileWithCache(element.getContainingJetFile()).getBindingContext()
val declarationDescriptor: DeclarationDescriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, element)
if (declarationDescriptor is CallableMemberDescriptor) {
val containingDescriptor: DeclarationDescriptor = declarationDescriptor.getContainingDeclaration()
if (containingDescriptor is ClassDescriptor) {
return JetBundle.message(
"x.in.y",
DescriptorRenderer.COMPACT.render(declarationDescriptor),
IdeDescriptorRenderers.SOURCE_CODE_SHORT_NAMES_NO_ANNOTATIONS.render(containingDescriptor)
)
}
}
}
assert(element is PsiMethod
) { "Method accepts only kotlin functions/properties and java methods, but '" + element.getText().toString() + "' was found" }
return JetRefactoringUtil.formatPsiMethod(element as PsiMethod, true, false)
}
protected fun getDimensionServiceKey(): String {
return "#org.jetbrains.kotlin.idea.refactoring.safeDelete.KotlinOverridingDialog"
}
fun getSelected(): ArrayList<UsageInfo> {
val result: ArrayList<UsageInfo> = ArrayList<UsageInfo>()
for (i in 0 until myChecked.length) {
if (myChecked[i]) {
result.add(myOverridingMethods.get(i))
}
}
return result
}
}