[FIR] Fix handling of WRONG_MODIFIER_TARGET
Implement DEPRECATED_MODIFIER, DEPRECATED_MODIFIER_FOR_TARGET, REDUNDANT_MODIFIER_FOR_TARGET
This commit is contained in:
committed by
TeamCityServer
parent
e85940a1ac
commit
cd6384eb20
+10
-10
@@ -2,29 +2,29 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
header class My
|
||||
<!DEPRECATED_MODIFIER!>header<!> class My
|
||||
|
||||
header fun foo(): Int
|
||||
<!DEPRECATED_MODIFIER!>header<!> fun foo(): Int
|
||||
|
||||
header val x: String
|
||||
<!DEPRECATED_MODIFIER!>header<!> val x: String
|
||||
|
||||
header object O
|
||||
<!DEPRECATED_MODIFIER!>header<!> object O
|
||||
|
||||
header enum class E {
|
||||
<!DEPRECATED_MODIFIER!>header<!> enum class E {
|
||||
FIRST
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
impl class My
|
||||
<!DEPRECATED_MODIFIER!>impl<!> class My
|
||||
|
||||
impl fun foo() = 42
|
||||
<!DEPRECATED_MODIFIER!>impl<!> fun foo() = 42
|
||||
|
||||
impl val x get() = "Hello"
|
||||
<!DEPRECATED_MODIFIER!>impl<!> val x get() = "Hello"
|
||||
|
||||
impl object O
|
||||
<!DEPRECATED_MODIFIER!>impl<!> object O
|
||||
|
||||
impl enum class E {
|
||||
<!DEPRECATED_MODIFIER!>impl<!> enum class E {
|
||||
FIRST
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
// FILE: common.kt
|
||||
|
||||
expect class H {
|
||||
expect fun foo()
|
||||
<!WRONG_MODIFIER_TARGET!>expect<!> fun foo()
|
||||
}
|
||||
|
||||
// MODULE: m1-jvm()()(m1-common)
|
||||
|
||||
Vendored
+4
-4
@@ -5,14 +5,14 @@
|
||||
expect class B {
|
||||
class N {
|
||||
<!EXPECTED_DECLARATION_WITH_BODY!>fun body()<!> {}
|
||||
expect fun extraHeader()
|
||||
<!WRONG_MODIFIER_TARGET!>expect<!> fun extraHeader()
|
||||
}
|
||||
}
|
||||
|
||||
expect class C {
|
||||
expect class N
|
||||
expect enum class E
|
||||
expect inner class I
|
||||
<!WRONG_MODIFIER_TARGET!>expect<!> class N
|
||||
<!WRONG_MODIFIER_TARGET!>expect<!> enum class E
|
||||
<!WRONG_MODIFIER_TARGET!>expect<!> inner class I
|
||||
}
|
||||
|
||||
expect class D {
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
// FILE: common.kt
|
||||
|
||||
class Foo {
|
||||
<!NON_ABSTRACT_FUNCTION_WITH_NO_BODY!>expect fun bar(): String<!>
|
||||
<!NON_ABSTRACT_FUNCTION_WITH_NO_BODY!><!WRONG_MODIFIER_TARGET!>expect<!> fun bar(): String<!>
|
||||
}
|
||||
|
||||
// MODULE: m1-jvm()()(m1-common)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
|
||||
<!INCOMPATIBLE_MODIFIERS!>header<!> <!INCOMPATIBLE_MODIFIERS!>impl<!> class First
|
||||
<!DEPRECATED_MODIFIER, INCOMPATIBLE_MODIFIERS!>header<!> <!INCOMPATIBLE_MODIFIERS!>impl<!> class First
|
||||
|
||||
<!INCOMPATIBLE_MODIFIERS!>header<!> <!INCOMPATIBLE_MODIFIERS!>expect<!> class Second
|
||||
<!DEPRECATED_MODIFIER, INCOMPATIBLE_MODIFIERS!>header<!> <!INCOMPATIBLE_MODIFIERS!>expect<!> class Second
|
||||
|
||||
<!INCOMPATIBLE_MODIFIERS!>header<!> <!INCOMPATIBLE_MODIFIERS!>actual<!> class Third
|
||||
<!DEPRECATED_MODIFIER, INCOMPATIBLE_MODIFIERS!>header<!> <!INCOMPATIBLE_MODIFIERS!>actual<!> class Third
|
||||
|
||||
<!INCOMPATIBLE_MODIFIERS!>impl<!> <!INCOMPATIBLE_MODIFIERS!>expect<!> class Fourth
|
||||
<!DEPRECATED_MODIFIER, INCOMPATIBLE_MODIFIERS!>impl<!> <!INCOMPATIBLE_MODIFIERS!>expect<!> class Fourth
|
||||
|
||||
<!INCOMPATIBLE_MODIFIERS!>impl<!> <!INCOMPATIBLE_MODIFIERS!>actual<!> class Fifth
|
||||
<!DEPRECATED_MODIFIER, INCOMPATIBLE_MODIFIERS!>impl<!> <!INCOMPATIBLE_MODIFIERS!>actual<!> class Fifth
|
||||
|
||||
<!INCOMPATIBLE_MODIFIERS!>expect<!> <!INCOMPATIBLE_MODIFIERS!>actual<!> class Sixth
|
||||
<!INCOMPATIBLE_MODIFIERS!>expect<!> <!INCOMPATIBLE_MODIFIERS!>actual<!> class Sixth
|
||||
|
||||
+13
-13
@@ -2,21 +2,21 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect typealias Foo = String
|
||||
<!WRONG_MODIFIER_TARGET!>expect<!> typealias Foo = String
|
||||
|
||||
class Outer expect constructor() {
|
||||
expect class Nested
|
||||
class Outer <!WRONG_MODIFIER_TARGET!>expect<!> constructor() {
|
||||
<!WRONG_MODIFIER_TARGET!>expect<!> class Nested
|
||||
|
||||
expect init {}
|
||||
<!WRONG_MODIFIER_TARGET!>expect<!> init {}
|
||||
|
||||
<!NON_ABSTRACT_FUNCTION_WITH_NO_BODY!>expect fun foo()<!>
|
||||
expect val bar: Int
|
||||
<!NON_ABSTRACT_FUNCTION_WITH_NO_BODY!><!WRONG_MODIFIER_TARGET!>expect<!> fun foo()<!>
|
||||
<!WRONG_MODIFIER_TARGET!>expect<!> val bar: Int
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
expect fun localFun()
|
||||
expect var x = 42
|
||||
expect class Bar
|
||||
<!WRONG_MODIFIER_TARGET!>expect<!> fun localFun()
|
||||
<!WRONG_MODIFIER_TARGET!>expect<!> var x = 42
|
||||
<!WRONG_MODIFIER_TARGET!>expect<!> class Bar
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm
|
||||
@@ -25,11 +25,11 @@ fun foo() {
|
||||
class Outer <!ACTUAL_WITHOUT_EXPECT!>actual constructor()<!> {
|
||||
actual class Nested
|
||||
|
||||
actual init {}
|
||||
<!WRONG_MODIFIER_TARGET!>actual<!> init {}
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
actual fun localFun() {}
|
||||
actual var x = 42
|
||||
actual class Bar
|
||||
<!WRONG_MODIFIER_TARGET!>actual<!> fun localFun() {}
|
||||
<!WRONG_MODIFIER_TARGET!>actual<!> var x = 42
|
||||
<!WRONG_MODIFIER_TARGET!>actual<!> class Bar
|
||||
}
|
||||
|
||||
compiler/testData/diagnostics/tests/multiplatform/topLevelProperty/differentKindsOfProperties.fir.kt
Vendored
+3
-3
@@ -14,8 +14,8 @@ expect var varWithGetSet: String
|
||||
get set
|
||||
|
||||
expect var varWithPlatformGetSet: String
|
||||
expect get
|
||||
expect set
|
||||
<!WRONG_MODIFIER_TARGET!>expect<!> get
|
||||
<!WRONG_MODIFIER_TARGET!>expect<!> set
|
||||
|
||||
expect val backingFieldVal: String = <!EXPECTED_PROPERTY_INITIALIZER!>"no"<!>
|
||||
expect var backingFieldVar: String = <!EXPECTED_PROPERTY_INITIALIZER!>"no"<!>
|
||||
@@ -34,7 +34,7 @@ expect val delegated: String by <!EXPECTED_DELEGATED_PROPERTY!>Delegate<!>
|
||||
object Delegate { operator fun getValue(x: Any?, y: Any?): String = "" }
|
||||
|
||||
fun test(): String {
|
||||
expect val localVariable: String
|
||||
<!WRONG_MODIFIER_TARGET!>expect<!> val localVariable: String
|
||||
localVariable = "no"
|
||||
return localVariable
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user