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
This commit is contained in:
Alexander Udalov
2018-08-09 19:32:42 +02:00
parent 0e5544a491
commit 8c21e86ded
@@ -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()
}
}
}