remove support for 'trait' keyword
This commit is contained in:
@@ -151,9 +151,7 @@ public open class JetPsiChecker : Annotator, HighlightRangeExtension {
|
||||
|
||||
when (factory) {
|
||||
Errors.DEPRECATED_SYMBOL,
|
||||
Errors.DEPRECATED_SYMBOL_WITH_MESSAGE,
|
||||
Errors.DEPRECATED_TRAIT_KEYWORD
|
||||
-> annotation.setTextAttributes(CodeInsightColors.DEPRECATED_ATTRIBUTES)
|
||||
Errors.DEPRECATED_SYMBOL_WITH_MESSAGE -> annotation.setTextAttributes(CodeInsightColors.DEPRECATED_ATTRIBUTES)
|
||||
}
|
||||
|
||||
setUpAnnotation(diagnostic, annotation, if (factory in Errors.UNUSED_ELEMENT_DIAGNOSTICS)
|
||||
|
||||
@@ -41,8 +41,7 @@ open class KeywordLookupObject
|
||||
|
||||
object KeywordCompletion {
|
||||
private val NON_ACTUAL_KEYWORDS = setOf(CAPITALIZED_THIS_KEYWORD,
|
||||
TYPE_ALIAS_KEYWORD,
|
||||
TRAIT_KEYWORD)
|
||||
TYPE_ALIAS_KEYWORD)
|
||||
private val ALL_KEYWORDS = (KEYWORDS.getTypes() + SOFT_KEYWORDS.getTypes())
|
||||
.filter { it !in NON_ACTUAL_KEYWORDS }
|
||||
.map { it as JetKeywordToken }
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ fun foo(p: Iterable<D>) {
|
||||
p.filter { it.<caret> }
|
||||
}
|
||||
|
||||
trait D {
|
||||
interface D {
|
||||
fun bar()
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
trait T1 {
|
||||
interface T1 {
|
||||
fun inT1(){}
|
||||
}
|
||||
|
||||
trait T2 {
|
||||
interface T2 {
|
||||
fun inT2(){}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ open class C {
|
||||
}
|
||||
}
|
||||
|
||||
trait T
|
||||
interface T
|
||||
|
||||
// EXIST: { itemText: "extFunForT", attributes: "bold" }
|
||||
// EXIST: { itemText: "extFunForC", attributes: "bold" }
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
trait T {
|
||||
interface T {
|
||||
fun fromTrait(){}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
trait T {
|
||||
interface T {
|
||||
fun fromTrait(){}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
trait T {
|
||||
interface T {
|
||||
fun f(){}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
trait T {
|
||||
interface T {
|
||||
fun foo1(){}
|
||||
fun foo2(){}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
fun globalFun(){}
|
||||
|
||||
trait T {
|
||||
interface T {
|
||||
fun fromTrait(){}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
trait I<T>
|
||||
interface I<T>
|
||||
|
||||
fun <E, T : I<E>> T.ext() : T = this
|
||||
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
trait A {
|
||||
interface A {
|
||||
fun foo(): Int
|
||||
}
|
||||
|
||||
trait B: A {
|
||||
interface B: A {
|
||||
override fun foo(): Int
|
||||
override fun foo1(): Int
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
trait Expr
|
||||
interface Expr
|
||||
class Num(val value : Int) : Expr
|
||||
|
||||
fun eval(e : Expr) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
trait Expr {
|
||||
interface Expr {
|
||||
public fun testThis() {
|
||||
if (this is Num) {
|
||||
this.<caret>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
trait Expr
|
||||
interface Expr
|
||||
class Sum(val left : Expr, val right : Expr) : Expr
|
||||
|
||||
fun evalWhen(e : Expr) : Int = when (e) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
trait Trait<T>
|
||||
interface Trait<T>
|
||||
|
||||
fun<T> Trait<T>.extension(t: T): T = t
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package first
|
||||
|
||||
trait TestedTrait() {
|
||||
interface TestedTrait() {
|
||||
}
|
||||
|
||||
fun firstFun() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
trait X {
|
||||
interface X {
|
||||
open fun fn() {}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
trait X {
|
||||
interface X {
|
||||
open fun fn() {}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
public trait Comparator<T> {
|
||||
public interface Comparator<T> {
|
||||
public fun compare(var1: T, var2: T): Int
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
trait Foo
|
||||
interface Foo
|
||||
|
||||
var a : Foo = <caret>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
trait Foo
|
||||
interface Foo
|
||||
|
||||
var a : Foo = object: Foo {<caret>}
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
trait Foo
|
||||
interface Foo
|
||||
|
||||
fun foo(f: Foo, i: Int){}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
trait Foo
|
||||
interface Foo
|
||||
|
||||
fun foo(f: Foo, i: Int){}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ fun test() {
|
||||
registerHandler(<caret>)
|
||||
}
|
||||
|
||||
trait Message
|
||||
interface Message
|
||||
|
||||
trait Handler<E> {
|
||||
interface Handler<E> {
|
||||
fun handle(e: E)
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -8,9 +8,9 @@ fun test() {
|
||||
})
|
||||
}
|
||||
|
||||
trait Message
|
||||
interface Message
|
||||
|
||||
trait Handler<E> {
|
||||
interface Handler<E> {
|
||||
fun handle(e: E)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
class `class`<T>
|
||||
|
||||
trait `trait`
|
||||
interface `interface`
|
||||
|
||||
fun foo(p: `class`<`trait`>){}
|
||||
fun foo(p: `class`<`interface`>){}
|
||||
|
||||
fun f(){
|
||||
foo(<caret>)
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
class `class`<T>
|
||||
|
||||
trait `trait`
|
||||
interface `interface`
|
||||
|
||||
fun foo(p: `class`<`trait`>){}
|
||||
fun foo(p: `class`<`interface`>){}
|
||||
|
||||
fun f(){
|
||||
foo(`class`())<caret>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
trait X
|
||||
trait Y
|
||||
interface X
|
||||
interface Y
|
||||
|
||||
fun X.iterator(): Y
|
||||
fun Y.next(): Int
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
trait X
|
||||
trait Y
|
||||
interface X
|
||||
interface Y
|
||||
|
||||
fun X.iterator(): Y
|
||||
fun Y.next(): Int
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
trait X
|
||||
trait Y
|
||||
interface X
|
||||
interface Y
|
||||
|
||||
fun X.iterator(): Y
|
||||
fun Y.next(): Int
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
trait X
|
||||
trait Y
|
||||
interface X
|
||||
interface Y
|
||||
|
||||
fun X.iterator(): Y
|
||||
fun Y.next(): Int
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package p
|
||||
|
||||
class Outer {
|
||||
trait T {
|
||||
interface T {
|
||||
object Null : T { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package p
|
||||
|
||||
class Outer {
|
||||
trait T {
|
||||
interface T {
|
||||
object Null : T { }
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ public class LibClass {
|
||||
public val nested: Nested = Nested()
|
||||
}
|
||||
|
||||
public trait LibTrait {
|
||||
public interface LibTrait {
|
||||
public fun foo() {
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
trait Foo{
|
||||
interface Foo{
|
||||
public fun foo() : Foo
|
||||
public fun s() : String
|
||||
public val prop : String
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
trait T {
|
||||
interface T {
|
||||
fun fromTrait() = ""
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
trait I
|
||||
interface I
|
||||
|
||||
object O : I
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package p
|
||||
|
||||
trait T {
|
||||
interface T {
|
||||
object Null : T { }
|
||||
|
||||
object Other {}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
trait Foo{
|
||||
interface Foo{
|
||||
fun foo1() : String
|
||||
fun foo2() : Object
|
||||
val prop : String
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
trait Foo
|
||||
interface Foo
|
||||
|
||||
var a : Foo = <caret>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
trait Foo
|
||||
interface Foo
|
||||
|
||||
var a : Foo = o<caret>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
trait T
|
||||
interface T
|
||||
|
||||
class C {
|
||||
inner class Inner1(s: String) : T
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
trait X
|
||||
trait Y
|
||||
interface X
|
||||
interface Y
|
||||
|
||||
fun X.iterator(): Y
|
||||
fun Y.next(): Int
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
trait X
|
||||
trait Y: X
|
||||
trait Z
|
||||
interface X
|
||||
interface Y: X
|
||||
interface Z
|
||||
|
||||
fun foo(p1: Collection<X>, p2: Collection<Y>, p3: Collection<Z>, p4: Collection<X?>) {
|
||||
for (i: X in <caret>)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
trait A
|
||||
trait B : A
|
||||
trait C
|
||||
interface A
|
||||
interface B : A
|
||||
interface C
|
||||
|
||||
fun foo(a: A, cA: Collection<A>, cB: Collection<B>, cC: Collection<C>, cAny: Collection<Any>,
|
||||
lA: List<A>, lb: List<B>, lC: List<C>, lAny: List<Any>,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
trait A
|
||||
trait B : A
|
||||
trait C
|
||||
interface A
|
||||
interface B : A
|
||||
interface C
|
||||
|
||||
fun foo(a: A){}
|
||||
fun foo(c: C){}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
trait A
|
||||
trait B : A
|
||||
trait C
|
||||
interface A
|
||||
interface B : A
|
||||
interface C
|
||||
|
||||
fun foo(a: A?){}
|
||||
fun foo(c: C?){}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
trait A
|
||||
trait B : A
|
||||
trait C
|
||||
interface A
|
||||
interface B : A
|
||||
interface C
|
||||
|
||||
fun foo(a: A){}
|
||||
fun foo(c: C){}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
trait A
|
||||
trait B : A
|
||||
trait C
|
||||
interface A
|
||||
interface B : A
|
||||
interface C
|
||||
|
||||
fun foo(a: A){}
|
||||
fun foo(c: C){}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
trait X
|
||||
trait Y : X
|
||||
trait Z
|
||||
interface X
|
||||
interface Y : X
|
||||
interface Z
|
||||
|
||||
fun X.contains(s: String): Boolean
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
trait X {
|
||||
interface X {
|
||||
fun contains(s: String): Boolean
|
||||
}
|
||||
|
||||
trait Y {
|
||||
interface Y {
|
||||
fun contains(i: Int): Boolean
|
||||
}
|
||||
|
||||
trait Z {
|
||||
interface Z {
|
||||
fun contains(o: Any): Boolean
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
trait X<T> {
|
||||
interface X<T> {
|
||||
fun contains(t: T): Boolean
|
||||
}
|
||||
|
||||
trait A {
|
||||
interface A {
|
||||
fun<T> createX(t: T): X<T>
|
||||
|
||||
fun foo(s: String) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
trait X<T>
|
||||
interface X<T>
|
||||
|
||||
fun<T> X<T>.contains(t: T): Boolean
|
||||
|
||||
trait A {
|
||||
interface A {
|
||||
fun<T> createX(t: T): X<T>
|
||||
|
||||
fun foo(s: String) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
trait X {
|
||||
interface X {
|
||||
fun contains(s: String): Boolean?
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
trait T
|
||||
interface T
|
||||
|
||||
open class A : T
|
||||
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
public trait Comparator<T> {
|
||||
public interface Comparator<T> {
|
||||
public fun compare(var1: T, var2: T): Int
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
package p
|
||||
|
||||
trait I1
|
||||
trait I2
|
||||
trait I3
|
||||
interface I1
|
||||
interface I2
|
||||
interface I3
|
||||
|
||||
trait KotlinTrait<T1, T2>
|
||||
interface KotlinTrait<T1, T2>
|
||||
|
||||
open class KotlinInheritor1<T> : KotlinTrait<T, I2>
|
||||
|
||||
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
package p
|
||||
|
||||
trait I1
|
||||
trait I2
|
||||
trait I3
|
||||
interface I1
|
||||
interface I2
|
||||
interface I3
|
||||
|
||||
trait KotlinTrait<T1, T2>
|
||||
interface KotlinTrait<T1, T2>
|
||||
|
||||
class KotlinInheritor<T> : KotlinTrait<T, T>
|
||||
|
||||
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
package p
|
||||
|
||||
trait I1
|
||||
trait I2
|
||||
trait I3
|
||||
interface I1
|
||||
interface I2
|
||||
interface I3
|
||||
|
||||
trait KotlinTrait<T1, T2>
|
||||
interface KotlinTrait<T1, T2>
|
||||
|
||||
class KotlinInheritor<T> : KotlinTrait<T, T>
|
||||
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package p
|
||||
|
||||
trait I1<T>
|
||||
trait I2
|
||||
interface I1<T>
|
||||
interface I2
|
||||
|
||||
trait KotlinTrait<T>
|
||||
interface KotlinTrait<T>
|
||||
|
||||
class KotlinInheritor<T> : KotlinTrait<I1<T>>
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
trait T
|
||||
interface T
|
||||
|
||||
class C : A()
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package p2
|
||||
|
||||
trait KotlinTrait
|
||||
interface KotlinTrait
|
||||
|
||||
open class KotlinInheritor1 : KotlinTrait
|
||||
|
||||
|
||||
Vendored
+3
-3
@@ -1,9 +1,9 @@
|
||||
class X
|
||||
class Y
|
||||
|
||||
trait T1
|
||||
trait T2<T>
|
||||
trait T3<T>
|
||||
interface T1
|
||||
interface T2<T>
|
||||
interface T3<T>
|
||||
|
||||
class C1 : T1
|
||||
class C2<T> : T2<T>, T3<T>
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
trait X
|
||||
interface X
|
||||
|
||||
fun foo(x: X) {
|
||||
JavaClass.search(<caret>)
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
trait T
|
||||
interface T
|
||||
|
||||
object OO : T
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
This intention converts a member of a class or trait into an extension to this class/trait.
|
||||
This intention converts a member of a class or interface into an extension to this class/interface.
|
||||
</body>
|
||||
</html>
|
||||
@@ -82,7 +82,6 @@ public class KotlinCleanupInspection(): LocalInspectionTool(), CleanupLocalInspe
|
||||
private fun Diagnostic.isCleanup() = getFactory() in cleanupDiagnosticsFactories || isObsoleteLabel()
|
||||
|
||||
private val cleanupDiagnosticsFactories = setOf(
|
||||
Errors.DEPRECATED_TRAIT_KEYWORD,
|
||||
Errors.DEPRECATED_LAMBDA_SYNTAX,
|
||||
Errors.MISSING_CONSTRUCTOR_KEYWORD,
|
||||
Errors.FUNCTION_EXPRESSION_WITH_NAME,
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.quickfix
|
||||
|
||||
import com.intellij.codeInsight.intention.IntentionAction
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic
|
||||
import org.jetbrains.kotlin.idea.quickfix.quickfixUtil.createIntentionFactory
|
||||
import org.jetbrains.kotlin.lexer.JetTokens
|
||||
import org.jetbrains.kotlin.psi.JetClass
|
||||
import org.jetbrains.kotlin.psi.JetFile
|
||||
import org.jetbrains.kotlin.psi.JetPsiFactory
|
||||
|
||||
public class DeprecatedTraitSyntaxFix(element: PsiElement): JetIntentionAction<PsiElement>(element), CleanupFix {
|
||||
override fun getFamilyName() = "Replace 'trait' with 'interface'"
|
||||
override fun getText() = getFamilyName()
|
||||
|
||||
override fun invoke(project: Project, editor: Editor?, file: JetFile)
|
||||
= replaceWithInterfaceKeyword(element)
|
||||
|
||||
|
||||
companion object : JetSingleIntentionActionFactory() {
|
||||
fun replaceWithInterfaceKeyword(element: PsiElement) {
|
||||
val cls = JetPsiFactory(element.getProject()).createClass("interface A {}")
|
||||
element.replace(cls.getNode().findChildByType(JetTokens.INTERFACE_KEYWORD)!!.getPsi())
|
||||
}
|
||||
|
||||
override fun createAction(diagnostic: Diagnostic): IntentionAction =
|
||||
DeprecatedTraitSyntaxFix(diagnostic.getPsiElement())
|
||||
|
||||
public fun createWholeProjectFixFactory(): JetSingleIntentionActionFactory = createIntentionFactory {
|
||||
JetWholeProjectForEachElementOfTypeFix.createByPredicate<JetClass>(
|
||||
predicate = { it.getNode().findChildByType(JetTokens.TRAIT_KEYWORD) != null },
|
||||
taskProcessor = { replaceWithInterfaceKeyword(it.getNode().findChildByType(JetTokens.TRAIT_KEYWORD)!!.getPsi())},
|
||||
name = "Replace 'trait' with 'interface' in whole project"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,6 @@ public class QuickFixRegistrar : QuickFixContributor {
|
||||
val removeRedundantModifierFactory = RemoveModifierFix.createRemoveModifierFactory(true)
|
||||
REDUNDANT_MODIFIER.registerFactory(removeRedundantModifierFactory)
|
||||
ABSTRACT_MODIFIER_IN_TRAIT.registerFactory(RemoveModifierFix.createRemoveModifierFromListOwnerFactory(ABSTRACT_KEYWORD, true))
|
||||
DEPRECATED_TRAIT_KEYWORD.registerFactory(DeprecatedTraitSyntaxFix, DeprecatedTraitSyntaxFix.createWholeProjectFixFactory())
|
||||
|
||||
REDUNDANT_PROJECTION.registerFactory(RemoveModifierFix.createRemoveProjectionFactory(true))
|
||||
INCOMPATIBLE_MODIFIERS.registerFactory(RemoveModifierFix.createRemoveModifierFactory(false))
|
||||
|
||||
@@ -2,9 +2,6 @@ import pack.oldFun1
|
||||
import pack.oldFun2 // should not be removed for non-deprecated overload used
|
||||
import pack.oldFun3
|
||||
|
||||
trait Foo {
|
||||
}
|
||||
|
||||
val f = { (a: Int, b: Int) -> a + b }
|
||||
|
||||
class A private()
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import pack.bar
|
||||
import pack.oldFun2 // should not be removed for non-deprecated overload used
|
||||
|
||||
interface Foo {
|
||||
}
|
||||
|
||||
val f = { a: Int, b: Int -> a + b }
|
||||
|
||||
class A private constructor()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
trait I {
|
||||
interface I {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
public trait I {
|
||||
public interface I {
|
||||
public fun foo(): String
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
public trait I {
|
||||
public interface I {
|
||||
public fun foo(): String
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// IS_APPLICABLE: false
|
||||
public trait I {
|
||||
public interface I {
|
||||
public val v: String?
|
||||
}
|
||||
|
||||
public trait I1 : I {
|
||||
public interface I1 : I {
|
||||
override val v: String<caret>
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
// "Replace with 'x'" "true"
|
||||
|
||||
trait X {
|
||||
interface X {
|
||||
@Deprecated("", ReplaceWith("x"))
|
||||
fun getX(): String
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// "Replace with 'x'" "true"
|
||||
|
||||
trait X {
|
||||
interface X {
|
||||
@Deprecated("", ReplaceWith("x"))
|
||||
fun getX(): String
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// "Replace with 'getX()'" "true"
|
||||
|
||||
trait X {
|
||||
interface X {
|
||||
@Deprecated("", ReplaceWith("getX()"))
|
||||
val x: String
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// "Replace with 'getX()'" "true"
|
||||
|
||||
trait X {
|
||||
interface X {
|
||||
@Deprecated("", ReplaceWith("getX()"))
|
||||
val x: String
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
// "Replace 'trait' with 'interface'" "true"
|
||||
|
||||
<caret>trait Foo {
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
// "Replace 'trait' with 'interface'" "true"
|
||||
|
||||
<caret>interface Foo {
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// "Add constructor parameters from Base(T, String, Base<T, String>?)" "true"
|
||||
trait I
|
||||
interface I
|
||||
|
||||
open class Base<T1, T2>(p1: T1, p2: T2, p3: Base<T1, T2>?)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// "Add constructor parameters from Base(T, String, Base<T, String>?)" "true"
|
||||
trait I
|
||||
interface I
|
||||
|
||||
open class Base<T1, T2>(p1: T1, p2: T2, p3: Base<T1, T2>?)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package testing
|
||||
|
||||
trait Trait {
|
||||
interface Trait {
|
||||
open fun foo(aa: Int, b: String) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package testing
|
||||
|
||||
trait Trait {
|
||||
interface Trait {
|
||||
open fun foo(a: Int, b: String) {
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package testing
|
||||
|
||||
trait Trait {
|
||||
interface Trait {
|
||||
open fun Int.foo(aa: Int, b: String) {
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package testing
|
||||
|
||||
trait Trait {
|
||||
interface Trait {
|
||||
open fun Int.foo(a: Int, b: String) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.codeInsight.smartEnter
|
||||
|
||||
import org.jetbrains.kotlin.idea.test.JetLightCodeInsightFixtureTestCase
|
||||
import com.intellij.openapi.actionSystem.IdeActions
|
||||
import org.jetbrains.kotlin.idea.JetFileType
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
||||
import org.jetbrains.kotlin.idea.JetFileType
|
||||
import org.jetbrains.kotlin.idea.test.JetLightCodeInsightFixtureTestCase
|
||||
|
||||
class SmartEnterTest : JetLightCodeInsightFixtureTestCase() {
|
||||
fun testIfCondition() = doFunTest(
|
||||
@@ -878,13 +878,13 @@ class SmartEnterTest : JetLightCodeInsightFixtureTestCase() {
|
||||
|
||||
fun testFunBody3() = doFileTest(
|
||||
"""
|
||||
trait Some {
|
||||
interface Some {
|
||||
fun (<caret>p: Int)
|
||||
}
|
||||
"""
|
||||
,
|
||||
"""
|
||||
trait Some {
|
||||
interface Some {
|
||||
fun(p: Int)
|
||||
<caret>
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class JetStubsTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testClassIsTrait() {
|
||||
PsiFile psiFile = myFixture.configureByText("foo.kt", "trait Test { }");
|
||||
PsiFile psiFile = myFixture.configureByText("foo.kt", "interface Test { }");
|
||||
List<JetDeclaration> declarations = ((JetFile) psiFile).getDeclarations();
|
||||
JetClass jetClass = (JetClass) declarations.get(0);
|
||||
KotlinClassStub stub = JetStubElementTypes.CLASS.createStub(jetClass, null);
|
||||
|
||||
Reference in New Issue
Block a user