removed explicit type arguments
from delegation tests where possible
This commit is contained in:
@@ -25,7 +25,7 @@ class DelegationTest(): DelegationTestBase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class TestNotNullVar<T>(val a1: String, val b1: T): WithBox {
|
public class TestNotNullVar<T>(val a1: String, val b1: T): WithBox {
|
||||||
var a: String by Delegates.notNull<String>()
|
var a: String by Delegates.notNull()
|
||||||
var b by Delegates.notNull<T>()
|
var b by Delegates.notNull<T>()
|
||||||
|
|
||||||
override fun box(): String {
|
override fun box(): String {
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ class TestMapValWithDifferentTypes(): WithBox {
|
|||||||
|
|
||||||
class TestMapVarWithDifferentTypes(): WithBox {
|
class TestMapVarWithDifferentTypes(): WithBox {
|
||||||
val map: HashMap<String, Any?> = hashMapOf("a" to "a", "b" to 1, "c" to A(1), "d" to "d")
|
val map: HashMap<String, Any?> = hashMapOf("a" to "a", "b" to 1, "c" to A(1), "d" to "d")
|
||||||
var a by Delegates.mapVar<String>(map)
|
var a: String by Delegates.mapVar(map)
|
||||||
var b by Delegates.mapVar<Int>(map)
|
var b: Int by Delegates.mapVar(map)
|
||||||
var c by Delegates.mapVar<Any>(map)
|
var c by Delegates.mapVar<Any>(map)
|
||||||
var d by Delegates.mapVar<String?>(map)
|
var d by Delegates.mapVar<String?>(map)
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ class TestNullableKey: WithBox {
|
|||||||
|
|
||||||
class TestMapPropertyString(): WithBox {
|
class TestMapPropertyString(): WithBox {
|
||||||
val map = hashMapOf("a" to "a", "b" to "b", "c" to "c":Any?)
|
val map = hashMapOf("a" to "a", "b" to "b", "c" to "c":Any?)
|
||||||
val a by Delegates.mapVal<String>(map)
|
val a: String by Delegates.mapVal(map)
|
||||||
var b by Delegates.mapVar<String>(map)
|
var b by Delegates.mapVar<String>(map)
|
||||||
val c by Delegates.mapVal<String>(map)
|
val c by Delegates.mapVal<String>(map)
|
||||||
|
|
||||||
@@ -115,9 +115,9 @@ class TestMapPropertyString(): WithBox {
|
|||||||
|
|
||||||
class TestMapValWithDefault(): WithBox {
|
class TestMapValWithDefault(): WithBox {
|
||||||
val map = hashMapOf<String, String>()
|
val map = hashMapOf<String, String>()
|
||||||
val a by Delegates.mapVal<String>(map, default = { ref, desc -> "aDefault" })
|
val a: String by Delegates.mapVal(map, default = { ref, desc -> "aDefault" })
|
||||||
val b by FixedMapVal<TestMapValWithDefault, String, String>(map, default = { ref, desc -> "bDefault" }, key = {"b"})
|
val b: String by FixedMapVal(map, default = { (ref: TestMapValWithDefault, desc: String) -> "bDefault" }, key = {"b"})
|
||||||
val c by FixedMapVal<TestMapValWithDefault, String, String>(map, default = { ref, desc -> "cDefault" }, key = { desc -> desc.name })
|
val c: String by FixedMapVal(map, default = { (ref: TestMapValWithDefault, desc: String) -> "cDefault" }, key = { desc -> desc.name })
|
||||||
|
|
||||||
override fun box(): String {
|
override fun box(): String {
|
||||||
if (a != "aDefault") return "fail at 'a'"
|
if (a != "aDefault") return "fail at 'a'"
|
||||||
@@ -130,8 +130,8 @@ class TestMapValWithDefault(): WithBox {
|
|||||||
class TestMapVarWithDefault(): WithBox {
|
class TestMapVarWithDefault(): WithBox {
|
||||||
val map = hashMapOf<String, Any?>()
|
val map = hashMapOf<String, Any?>()
|
||||||
var a: String by Delegates.mapVar(map, default = {ref, desc -> "aDefault" })
|
var a: String by Delegates.mapVar(map, default = {ref, desc -> "aDefault" })
|
||||||
var b: String by FixedMapVar<Any?, String, String>(map, default = {ref, desc -> "bDefault" }, key = {"b"})
|
var b: String by FixedMapVar(map, default = {(ref: Any?, desc: String) -> "bDefault" }, key = {"b"})
|
||||||
var c: String by FixedMapVar<Any?, String, String>(map, default = {ref, desc -> "cDefault" }, key = { desc -> desc.name })
|
var c: String by FixedMapVar(map, default = {(ref: Any?, desc: String) -> "cDefault" }, key = { desc -> desc.name })
|
||||||
|
|
||||||
override fun box(): String {
|
override fun box(): String {
|
||||||
if (a != "aDefault") return "fail at 'a'"
|
if (a != "aDefault") return "fail at 'a'"
|
||||||
|
|||||||
Reference in New Issue
Block a user