FE 1.0: introduce DELEGATE_USES_EXTENSION_PROPERTY_TYPE_PARAMETER error
#KT-24643 Fixed
This commit is contained in:
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// !LANGUAGE: +ForbidUsingExtensionPropertyTypeParameterInDelegate
|
||||
|
||||
class Delegate<T : Any> {
|
||||
private var v: T? = null
|
||||
operator fun getValue(thisRef: Any?, kp: Any?): T = v!!
|
||||
operator fun setValue(thisRef: Any?, kp: Any?, newValue: T) { v = newValue }
|
||||
}
|
||||
|
||||
var <T : Any> List<T>.foo by Delegate<T>()
|
||||
|
||||
fun useString(s: String) {}
|
||||
|
||||
fun main(listInt: List<Int>, listStr: List<String>) {
|
||||
listInt.foo = 42
|
||||
useString(listStr.foo) // CCE
|
||||
}
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// !LANGUAGE: +ForbidUsingExtensionPropertyTypeParameterInDelegate
|
||||
|
||||
class Delegate<T : Any> {
|
||||
private var v: T? = null
|
||||
operator fun getValue(thisRef: Any?, kp: Any?): T = v!!
|
||||
operator fun setValue(thisRef: Any?, kp: Any?, newValue: T) { v = newValue }
|
||||
}
|
||||
|
||||
var <T : Any> List<T>.foo <!DELEGATE_USES_EXTENSION_PROPERTY_TYPE_PARAMETER!>by Delegate<T>()<!>
|
||||
|
||||
fun useString(s: String) {}
|
||||
|
||||
fun main(listInt: List<Int>, listStr: List<String>) {
|
||||
listInt.foo = 42
|
||||
useString(listStr.foo) // CCE
|
||||
}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
package
|
||||
|
||||
public var </*0*/ T : kotlin.Any> kotlin.collections.List<T>.foo: T
|
||||
public fun main(/*0*/ listInt: kotlin.collections.List<kotlin.Int>, /*1*/ listStr: kotlin.collections.List<kotlin.String>): kotlin.Unit
|
||||
public fun useString(/*0*/ s: kotlin.String): kotlin.Unit
|
||||
|
||||
public final class Delegate</*0*/ T : kotlin.Any> {
|
||||
public constructor Delegate</*0*/ T : kotlin.Any>()
|
||||
private final var v: T?
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kp: kotlin.Any?): T
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kp: kotlin.Any?, /*2*/ newValue: T): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// !LANGUAGE: -ForbidUsingExtensionPropertyTypeParameterInDelegate
|
||||
|
||||
class Delegate<T : Any> {
|
||||
private var v: T? = null
|
||||
operator fun getValue(thisRef: Any?, kp: Any?): T = v!!
|
||||
operator fun setValue(thisRef: Any?, kp: Any?, newValue: T) { v = newValue }
|
||||
}
|
||||
|
||||
var <T : Any> List<T>.foo by Delegate<T>()
|
||||
|
||||
fun useString(s: String) {}
|
||||
|
||||
fun main(listInt: List<Int>, listStr: List<String>) {
|
||||
listInt.foo = 42
|
||||
useString(listStr.foo) // CCE
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// !LANGUAGE: -ForbidUsingExtensionPropertyTypeParameterInDelegate
|
||||
|
||||
class Delegate<T : Any> {
|
||||
private var v: T? = null
|
||||
operator fun getValue(thisRef: Any?, kp: Any?): T = v!!
|
||||
operator fun setValue(thisRef: Any?, kp: Any?, newValue: T) { v = newValue }
|
||||
}
|
||||
|
||||
var <T : Any> List<T>.foo <!DELEGATE_USES_EXTENSION_PROPERTY_TYPE_PARAMETER_WARNING!>by Delegate<T>()<!>
|
||||
|
||||
fun useString(s: String) {}
|
||||
|
||||
fun main(listInt: List<Int>, listStr: List<String>) {
|
||||
listInt.foo = 42
|
||||
useString(listStr.foo) // CCE
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package
|
||||
|
||||
public var </*0*/ T : kotlin.Any> kotlin.collections.List<T>.foo: T
|
||||
public fun main(/*0*/ listInt: kotlin.collections.List<kotlin.Int>, /*1*/ listStr: kotlin.collections.List<kotlin.String>): kotlin.Unit
|
||||
public fun useString(/*0*/ s: kotlin.String): kotlin.Unit
|
||||
|
||||
public final class Delegate</*0*/ T : kotlin.Any> {
|
||||
public constructor Delegate</*0*/ T : kotlin.Any>()
|
||||
private final var v: T?
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kp: kotlin.Any?): T
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ kp: kotlin.Any?, /*2*/ newValue: T): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user