aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/model/annotations/KotlinAnnotationsForParametersTest.kt
diff options
context:
space:
mode:
authorMarcin Aman <marcin.aman@gmail.com>2021-02-05 14:55:45 +0100
committerGitHub <noreply@github.com>2021-02-05 14:55:45 +0100
commit70000c87a37caa2a6b518a555f53c98514434403 (patch)
tree3a0e7a2b797b6edfffc0396bb5f9d35708120e9d /plugins/base/src/test/kotlin/model/annotations/KotlinAnnotationsForParametersTest.kt
parentb44e41ec8e3e26c73affaaa98bbd170fde352d96 (diff)
downloaddokka-70000c87a37caa2a6b518a555f53c98514434403.tar.gz
dokka-70000c87a37caa2a6b518a555f53c98514434403.tar.bz2
dokka-70000c87a37caa2a6b518a555f53c98514434403.zip
Annotations for parameters (#1710)
* Annotations for parameters * Annotations for parameters
Diffstat (limited to 'plugins/base/src/test/kotlin/model/annotations/KotlinAnnotationsForParametersTest.kt')
-rw-r--r--plugins/base/src/test/kotlin/model/annotations/KotlinAnnotationsForParametersTest.kt23
1 files changed, 23 insertions, 0 deletions
diff --git a/plugins/base/src/test/kotlin/model/annotations/KotlinAnnotationsForParametersTest.kt b/plugins/base/src/test/kotlin/model/annotations/KotlinAnnotationsForParametersTest.kt
index 4cc34c09..e88d7353 100644
--- a/plugins/base/src/test/kotlin/model/annotations/KotlinAnnotationsForParametersTest.kt
+++ b/plugins/base/src/test/kotlin/model/annotations/KotlinAnnotationsForParametersTest.kt
@@ -3,6 +3,8 @@ package model.annotations
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.Annotations
import org.jetbrains.dokka.model.DFunction
+import org.jetbrains.dokka.model.DProperty
+import org.jetbrains.dokka.model.GenericTypeConstructor
import org.junit.jupiter.api.Test
import utils.AbstractModelTest
import kotlin.test.assertEquals
@@ -27,4 +29,25 @@ class KotlinAnnotationsForParametersTest : AbstractModelTest("/src/main/kotlin/a
}
}
}
+
+ @Test
+ fun `generic receiver with annotated bounds`() {
+ inlineModelTest(
+ """
+ |@Target(AnnotationTarget.TYPE_PARAMETER)
+ |annotation class Hello(val bar: String)
+ |fun <T: @Hello("abc") String> foo(arg: String): List<T> = TODO()
+ """.trimIndent()
+ ) {
+ with((this / "annotations" / "foo").cast<DFunction>()) {
+ val annotations = (generics.first().bounds.first() as GenericTypeConstructor)
+ .extra[Annotations]?.directAnnotations?.flatMap { it.value }
+ val driOfHello = DRI("annotations", "Hello")
+ val annotationsValues = annotations?.flatMap { it.params.values }?.map { it.toString() }?.toList()
+
+ assertEquals(listOf(driOfHello), annotations?.map { it.dri })
+ assertEquals(listOf("abc"), annotationsValues)
+ }
+ }
+ }
} \ No newline at end of file