Intentions: 'Implement abstract member' (Kotlin -> Kotlin)
#KT-8467 In Progress
This commit is contained in:
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.intentions.ImplementAbstractMemberIntention
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
// DISABLE-ERRORS
|
||||
interface T<X> {
|
||||
fun <caret>foo(x: X): X
|
||||
}
|
||||
|
||||
enum class E : T<Int> {
|
||||
A, B, C
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// WITH_RUNTIME
|
||||
// DISABLE-ERRORS
|
||||
interface T<X> {
|
||||
fun <caret>foo(x: X): X
|
||||
}
|
||||
|
||||
enum class E : T<Int> {
|
||||
A, B, C;
|
||||
|
||||
override fun foo(x: Int): Int {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
// DISABLE-ERRORS
|
||||
interface T<X> {
|
||||
fun <caret>foo(x: X): X
|
||||
}
|
||||
|
||||
enum class E : T<Int> {
|
||||
A, B, C;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// WITH_RUNTIME
|
||||
// DISABLE-ERRORS
|
||||
interface T<X> {
|
||||
fun <caret>foo(x: X): X
|
||||
}
|
||||
|
||||
enum class E : T<Int> {
|
||||
A, B, C;
|
||||
|
||||
override fun foo(x: Int): Int {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
// WITH_RUNTIME
|
||||
// DISABLE-ERRORS
|
||||
interface T<X> {
|
||||
fun <caret>foo(x: X): X
|
||||
}
|
||||
|
||||
enum class E : T<Int> {
|
||||
A, B, C;
|
||||
|
||||
val bar = 1
|
||||
|
||||
fun baz() = 2
|
||||
}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// WITH_RUNTIME
|
||||
// DISABLE-ERRORS
|
||||
interface T<X> {
|
||||
fun <caret>foo(x: X): X
|
||||
}
|
||||
|
||||
enum class E : T<Int> {
|
||||
A, B, C;
|
||||
|
||||
override fun foo(x: Int): Int {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
val bar = 1
|
||||
|
||||
fun baz() = 2
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
//DISABLE-ERRORS
|
||||
enum class E {
|
||||
A, B, C;
|
||||
|
||||
abstract fun <caret>foo(x: Int): Int
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// WITH_RUNTIME
|
||||
//DISABLE-ERRORS
|
||||
enum class E {
|
||||
A {
|
||||
override fun foo(x: Int): Int {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
}, B {
|
||||
override fun foo(x: Int): Int {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
}, C {
|
||||
override fun foo(x: Int): Int {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
};
|
||||
|
||||
abstract fun <caret>foo(x: Int): Int
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
//DISABLE-ERRORS
|
||||
enum class E(n: Int) {
|
||||
A(1), B(2), C(3);
|
||||
|
||||
abstract fun <caret>foo(x: Int): Int
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// WITH_RUNTIME
|
||||
//DISABLE-ERRORS
|
||||
enum class E(n: Int) {
|
||||
A(1) {
|
||||
override fun foo(x: Int): Int {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
}, B(2) {
|
||||
override fun foo(x: Int): Int {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
}, C(3) {
|
||||
override fun foo(x: Int): Int {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
};
|
||||
|
||||
abstract fun <caret>foo(x: Int): Int
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// WITH_RUNTIME
|
||||
// DISABLE-ERRORS
|
||||
interface T<X> {
|
||||
fun <caret>foo(x: X): X
|
||||
}
|
||||
|
||||
class U : T<String> {
|
||||
|
||||
}
|
||||
|
||||
class V : T<Int> {
|
||||
|
||||
}
|
||||
|
||||
class Z : T<Int> by V() {
|
||||
|
||||
}
|
||||
|
||||
class W : T<Boolean> {
|
||||
override fun foo(x: Boolean): Boolean {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// WITH_RUNTIME
|
||||
// DISABLE-ERRORS
|
||||
interface T<X> {
|
||||
fun <caret>foo(x: X): X
|
||||
}
|
||||
|
||||
class U : T<String> {
|
||||
override fun foo(x: String): String {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class V : T<Int> {
|
||||
override fun foo(x: Int): Int {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Z : T<Int> by V() {
|
||||
|
||||
}
|
||||
|
||||
class W : T<Boolean> {
|
||||
override fun foo(x: Boolean): Boolean {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: Abstract function 'foo' in non-abstract class 'A'
|
||||
class A {
|
||||
abstract fun <caret>foo(): Int
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: Abstract function 'foo' in non-abstract class 'A'
|
||||
object A {
|
||||
abstract fun <caret>foo(): Int
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: Class 'C' must be declared abstract or implement abstract base class member public abstract fun foo(): kotlin.Int defined in B
|
||||
interface A {
|
||||
fun <caret>foo(): Int
|
||||
}
|
||||
|
||||
class X : A {
|
||||
override fun foo() = 1
|
||||
}
|
||||
|
||||
abstract class B : A {
|
||||
abstract override fun foo(): Int
|
||||
}
|
||||
|
||||
class C: B() {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
interface A {
|
||||
fun <caret>foo(): Int
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
open class A {
|
||||
fun <caret>foo() = 1
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
interface A {
|
||||
fun <caret>foo() = 1
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: Function 'foo' without a body must be abstract
|
||||
open class A {
|
||||
fun <caret>foo(): Int
|
||||
}
|
||||
Reference in New Issue
Block a user