diff options
author | Marcin Aman <maman@virtuslab.com> | 2020-05-05 12:09:39 +0200 |
---|---|---|
committer | BarkingBad <32793002+BarkingBad@users.noreply.github.com> | 2020-05-06 12:14:18 +0200 |
commit | 17ef3207c536a9bd5357336977a0c59efcc8daba (patch) | |
tree | 7dfcd4e3f524de1ce673d79fab2afacaa007e25c /plugins/base/src/test/kotlin | |
parent | a09cdf52571c9c93ca3244d2fc92577dee3fae24 (diff) | |
download | dokka-17ef3207c536a9bd5357336977a0c59efcc8daba.tar.gz dokka-17ef3207c536a9bd5357336977a0c59efcc8daba.tar.bz2 dokka-17ef3207c536a9bd5357336977a0c59efcc8daba.zip |
Receiver for extension property #809
Diffstat (limited to 'plugins/base/src/test/kotlin')
-rw-r--r-- | plugins/base/src/test/kotlin/model/PropertyTest.kt | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/plugins/base/src/test/kotlin/model/PropertyTest.kt b/plugins/base/src/test/kotlin/model/PropertyTest.kt index 14f7b402..ac055c69 100644 --- a/plugins/base/src/test/kotlin/model/PropertyTest.kt +++ b/plugins/base/src/test/kotlin/model/PropertyTest.kt @@ -188,6 +188,59 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro } } } + + @Test fun genericTopLevelExtensionProperty(){ + inlineModelTest( + """ | val <T : Number> List<T>.sampleProperty: T + | get() { TODO() } + """.trimIndent() + ){ + with((this / "property" / "sampleProperty").cast<DProperty>()) { + name equals "sampleProperty" + with(receiver.assertNotNull("Property receiver")) { + type.name equals "List" + } + with(getter.assertNotNull("Getter")) { + type.name equals "T" + } + setter equals null + generics counts 1 + generics.forEach { + it.name equals "T" + it.bounds.first().name equals "Number" + } + visibility.values allEquals KotlinVisibility.Public + } + } + } + + @Test fun genericExtensionPropertyInClass(){ + inlineModelTest( + """ | package test + | class XD<T> { + | var List<T>.sampleProperty: T + | get() { TODO() } + | set(value) { TODO() } + | } + """.trimIndent() + ){ + with((this / "property" / "XD" / "sampleProperty").cast<DProperty>()) { + name equals "sampleProperty" + children counts 0 + with(receiver.assertNotNull("Property receiver")) { + type.name equals "List" + } + with(getter.assertNotNull("Getter")) { + type.name equals "T" + } + with(setter.assertNotNull("Setter")){ + type.name equals "Unit" + } + generics counts 0 + visibility.values allEquals KotlinVisibility.Public + } + } + } // @Test // fun annotatedProperty() { // checkSourceExistsAndVerifyModel( |