Prohibit non-const expressions through varargs in annotations

Fixes #KT-23153 for Kotlin 1.3

 The problem was in the type check of expression type against expected type. When feature `AssigningArraysToVarargsInNamedFormInAnnotations` (KT-20171) appeared, expected type could be wrong, which led to failed type check
This commit is contained in:
Mikhail Zarechenskiy
2018-03-12 02:10:25 +03:00
parent 4ebd11a7ae
commit 6086cd2cf4
12 changed files with 209 additions and 60 deletions
@@ -24536,6 +24536,18 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("assignNonConstSingleArrayElementAsVarargInAnnotation.kt")
public void testAssignNonConstSingleArrayElementAsVarargInAnnotation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/varargs/assignNonConstSingleArrayElementAsVarargInAnnotation.kt");
doTest(fileName);
}
@TestMetadata("assignNonConstSingleArrayElementAsVarargInAnnotationError.kt")
public void testAssignNonConstSingleArrayElementAsVarargInAnnotationError() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/varargs/assignNonConstSingleArrayElementAsVarargInAnnotationError.kt");
doTest(fileName);
}
@TestMetadata("assigningArraysToVarargsInAnnotations.kt")
public void testAssigningArraysToVarargsInAnnotations() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/varargs/assigningArraysToVarargsInAnnotations.kt");