Support platform/impl modifiers for properties
Do not allow platform properties to have backing fields, initializers, be delegated, lateinit or const, or have accessors with bodies
This commit is contained in:
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
platform val justVal: String
|
||||
platform var justVar: String
|
||||
|
||||
platform val String.extensionVal: Unit
|
||||
platform var <T> T.genericExtensionVar: T
|
||||
|
||||
platform val valWithGet: String
|
||||
get
|
||||
platform var varWithGetSet: String
|
||||
get set
|
||||
|
||||
platform var varWithPlatformGetSet: String
|
||||
<!WRONG_MODIFIER_TARGET!>platform<!> get
|
||||
<!WRONG_MODIFIER_TARGET!>platform<!> set
|
||||
|
||||
platform val backingFieldVal: String = <!PLATFORM_PROPERTY_INITIALIZER!>"no"<!>
|
||||
platform var backingFieldVar: String = <!PLATFORM_PROPERTY_INITIALIZER!>"no"<!>
|
||||
|
||||
platform val customAccessorVal: String
|
||||
<!PLATFORM_DECLARATION_WITH_BODY!>get()<!> = "no"
|
||||
platform var customAccessorVar: String
|
||||
<!PLATFORM_DECLARATION_WITH_BODY!>get()<!> = "no"
|
||||
<!PLATFORM_DECLARATION_WITH_BODY!>set(value)<!> {}
|
||||
|
||||
platform <!CONST_VAL_WITHOUT_INITIALIZER!>const<!> val constVal: Int
|
||||
|
||||
platform <!WRONG_MODIFIER_TARGET!>lateinit<!> var lateinitVar: String
|
||||
|
||||
<!WRONG_MODIFIER_TARGET!>platform<!> val delegated: String by Delegate
|
||||
object Delegate { operator fun getValue(x: Any?, y: Any?): String = "" }
|
||||
|
||||
fun test(): String {
|
||||
<!WRONG_MODIFIER_TARGET!>platform<!> val localVariable: String
|
||||
localVariable = "no"
|
||||
return localVariable
|
||||
}
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
package
|
||||
|
||||
public val backingFieldVal: kotlin.String = "no"
|
||||
public var backingFieldVar: kotlin.String
|
||||
public const val constVal: kotlin.Int
|
||||
public val customAccessorVal: kotlin.String
|
||||
public var customAccessorVar: kotlin.String
|
||||
public val delegated: kotlin.String
|
||||
public val justVal: kotlin.String
|
||||
public var justVar: kotlin.String
|
||||
public lateinit var lateinitVar: kotlin.String
|
||||
public val valWithGet: kotlin.String
|
||||
public var varWithGetSet: kotlin.String
|
||||
public var varWithPlatformGetSet: kotlin.String
|
||||
public val kotlin.String.extensionVal: kotlin.Unit
|
||||
public var </*0*/ T> T.genericExtensionVar: T
|
||||
public fun test(): kotlin.String
|
||||
|
||||
public object Delegate {
|
||||
private constructor Delegate()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final operator fun getValue(/*0*/ x: kotlin.Any?, /*1*/ y: kotlin.Any?): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
platform var foo: String
|
||||
|
||||
// MODULE: m2-jvm(m1-common)
|
||||
// FILE: jvm.kt
|
||||
impl var foo: String = "JVM"
|
||||
|
||||
// MODULE: m3-js(m1-common)
|
||||
// FILE: js.kt
|
||||
impl var foo: String = "JS"
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// -- Module: <m1-common> --
|
||||
package
|
||||
|
||||
public var foo: kotlin.String
|
||||
|
||||
|
||||
// -- Module: <m2-jvm> --
|
||||
package
|
||||
|
||||
public var foo: kotlin.String
|
||||
|
||||
|
||||
// -- Module: <m3-js> --
|
||||
package
|
||||
|
||||
public var foo: kotlin.String
|
||||
Reference in New Issue
Block a user