Fix tests

This commit is contained in:
Dmitry Jemerov
2017-06-13 13:03:08 +02:00
parent 6829c5ef8f
commit a6d80b78de
3 changed files with 3 additions and 6 deletions
@@ -28,13 +28,12 @@ import org.jetbrains.kotlin.descriptors.annotations.KotlinTarget
import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.analyze
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptor import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptor
import org.jetbrains.kotlin.idea.core.ShortenReferences import org.jetbrains.kotlin.idea.core.ShortenReferences
import org.jetbrains.kotlin.idea.refactoring.isInterfaceClass
import org.jetbrains.kotlin.idea.search.usagesSearch.descriptor import org.jetbrains.kotlin.idea.search.usagesSearch.descriptor
import org.jetbrains.kotlin.idea.util.CommentSaver import org.jetbrains.kotlin.idea.util.CommentSaver
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers
import org.jetbrains.kotlin.lexer.KtModifierKeywordToken import org.jetbrains.kotlin.lexer.KtModifierKeywordToken
import org.jetbrains.kotlin.lexer.KtTokens.VARARG_KEYWORD
import org.jetbrains.kotlin.lexer.KtTokens.LATEINIT_KEYWORD import org.jetbrains.kotlin.lexer.KtTokens.LATEINIT_KEYWORD
import org.jetbrains.kotlin.lexer.KtTokens.VARARG_KEYWORD
import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
import org.jetbrains.kotlin.resolve.AnnotationChecker import org.jetbrains.kotlin.resolve.AnnotationChecker
@@ -56,8 +55,8 @@ class MovePropertyToConstructorIntention :
override fun isApplicableTo(element: KtProperty, caretOffset: Int): Boolean { override fun isApplicableTo(element: KtProperty, caretOffset: Int): Boolean {
fun KtProperty.isDeclaredInClass() : Boolean { fun KtProperty.isDeclaredInClass() : Boolean {
val parent = element.getStrictParentOfType<KtClassOrObject>() val parent = getStrictParentOfType<KtClassOrObject>()
return parent != null && !parent.isInterfaceClass() return parent is KtClass && !parent.isInterface()
} }
return !element.isLocal return !element.isLocal
@@ -1,6 +1,5 @@
// "Change type of overriden property 'A.x' to '(Int) -> Int'" "false" // "Change type of overriden property 'A.x' to '(Int) -> Int'" "false"
// ACTION: Change type to '(String) -> Int' // ACTION: Change type to '(String) -> Int'
// ACTION: Move to constructor
// ERROR: Type of 'x' is not a subtype of the overridden property 'public abstract val x: (String) -> Int defined in A' // ERROR: Type of 'x' is not a subtype of the overridden property 'public abstract val x: (String) -> Int defined in A'
interface A { interface A {
val x: (String) -> Int val x: (String) -> Int
@@ -1,6 +1,5 @@
// "Change type to '(String) -> [ERROR : Ay]'" "false" // "Change type to '(String) -> [ERROR : Ay]'" "false"
// ACTION: Change type of base property 'A.x' to '(Int) -> Int' // ACTION: Change type of base property 'A.x' to '(Int) -> Int'
// ACTION: Move to constructor
// ERROR: Type of 'x' is not a subtype of the overridden property 'public abstract val x: (String) -> [ERROR : Ay] defined in A' // ERROR: Type of 'x' is not a subtype of the overridden property 'public abstract val x: (String) -> [ERROR : Ay] defined in A'
// ERROR: Unresolved reference: Ay // ERROR: Unresolved reference: Ay
interface A { interface A {