From 8c21e86ded6bdf8b4beb86d8f27fe7c2a7c9143f Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 9 Aug 2018 19:32:42 +0200 Subject: [PATCH] Don't add unapplicable targeted annotations to the container For example, previously on an (incorrect) code like @setparam:Ann val x = 42 We added Ann to x's annotations. Not doing this seems more correct and simplifies implementation a bit. Test data is NOT changed in this commit because effective changes somewhat depend on the changes in the subsequent commits. Affected tests are at compiler/testData/diagnostics/tests/annotations/withUseSiteTarget --- .../kotlin/descriptors/annotations/AnnotationSplitter.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/descriptors/annotations/AnnotationSplitter.kt b/compiler/frontend/src/org/jetbrains/kotlin/descriptors/annotations/AnnotationSplitter.kt index fc246d8e8ed..09478676351 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/descriptors/annotations/AnnotationSplitter.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/descriptors/annotations/AnnotationSplitter.kt @@ -97,8 +97,6 @@ class AnnotationSplitter( if (useSiteTarget != null) { if (useSiteTarget in applicableTargets) map.getOrPut(useSiteTarget, { arrayListOf() }).add(annotationWithTarget) - else - other.add(annotationWithTarget) continue@outer } @@ -154,4 +152,4 @@ class AnnotationSplitter( override fun toString() = annotations.toString() } -} \ No newline at end of file +}