Report "declaration should be marked with impl" when possible
Also support a quick fix to add 'impl' modifier (KT-18454), although it doesn't work yet on classes because there's no error on them in the IDE #KT-18087 Fixed #KT-18452 Fixed #KT-18454
This commit is contained in:
+3
-3
@@ -25,8 +25,8 @@ header class Baz(w: List<String>) {
|
||||
// MODULE: m2-jvm(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
impl data class Foo(impl val x: Int, impl val y: String)
|
||||
impl data class Foo impl constructor(impl val x: Int, impl val y: String)
|
||||
|
||||
impl data class Bar(val z: Double)
|
||||
impl data class Bar impl constructor(val z: Double)
|
||||
|
||||
impl data class Baz(impl val w: List<String>)
|
||||
impl data class Baz impl constructor(impl val w: List<String>)
|
||||
|
||||
+2
-3
@@ -9,7 +9,6 @@ header class Foo {
|
||||
// MODULE: m2-jvm(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
// TODO: run HeaderImplDeclarationChecker on non-impl members of impl classes, and report something like "impl expected" on 'bar' instead
|
||||
impl class <!HEADER_CLASS_MEMBERS_ARE_NOT_IMPLEMENTED!>Foo<!> {
|
||||
fun bar(): String = "bar"
|
||||
impl class Foo {
|
||||
<!IMPL_MISSING!>fun bar(): String<!> = "bar"
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ fun testCommon() {
|
||||
// MODULE: m2-jvm(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
impl class Foo(val aaa: Boolean) {
|
||||
impl class Foo impl constructor(val aaa: Boolean) {
|
||||
impl constructor(zzz: Int) : this(zzz == 0)
|
||||
|
||||
impl fun f1(xxx: String) = xxx
|
||||
|
||||
Reference in New Issue
Block a user