fix some tests for as36

This commit is contained in:
Dmitry Gridin
2020-05-08 19:07:55 +07:00
parent ad09eb5416
commit 50506658c0
22 changed files with 319 additions and 0 deletions
@@ -0,0 +1,45 @@
class A {
fun someOther() = false
private fun formatElement(element: PsiElement): String {
var element = element
element = JetPsiUtil.ascendIfPropertyAccessor(element)
if (element is JetNamedFunction || element is JetProperty) {
val bindingContext =
AnalyzerFacadeWithCache.analyzeFileWithCache(element.getContainingJetFile())
.getBindingContext()
val declarationDescriptor =
bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, element)
if (declarationDescriptor is CallableMemberDescriptor) {
val containingDescriptor = declarationDescriptor.getContainingDeclaration()
if (containingDescriptor is ClassDescriptor) {
return JetBundle.message(
"override.declaration.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() + "' 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>()
for (i in 0 until myChecked.length) {
if (myChecked[i]) {
result.add(myOverridingMethods.get(i))
}
}
return result
}
}
@@ -0,0 +1,35 @@
import test.ToBeImportedJava.staticMethod
import test.ToBeImportedJava.TO_BE_IMPORTED_CONST
import test.ToBeImportedJava
import test.ToBeImportedKotlin
import java.util.HashMap
import java.util.ArrayList
class Target {
var listOfPlatformType: List<String> = ArrayList()
var unresolved: UnresolvedInterface<UnresolvedGeneric> =
UnresolvedImplementation() // Should not add import
var hashMapOfNotImported: Map<ToBeImportedJava, ToBeImportedKotlin> = HashMap()
fun acceptKotlinClass(tbi: ToBeImportedKotlin) {
}
fun acceptJavaClass(tbi: ToBeImportedJava) {
}
var ambiguousKotlin: IAmbiguousKotlin =
AmbiguousKotlin() // Should not add import in case of 2 declarations in Kotlin
var ambiguous: IAmbiguous =
Ambiguous() // Should not add import in case of ambiguous declarations in Kotlin and in Java
var ambiguousJava: IAmbiguousJava =
AmbiguousJava() // Should not add import in case of 2 declarations in Java
fun workWithStatics() {
val a = TO_BE_IMPORTED_CONST
staticMethod()
}
}