Fix exception at accidentally wrong annotation argument type
#KT-13740 Fixed
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -1518,6 +1518,10 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
KotlinType expectedType = bindingContext.getType(expression);
|
KotlinType expectedType = bindingContext.getType(expression);
|
||||||
|
if (expectedType == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return compileTimeValue.toConstantValue(expectedType);
|
return compileTimeValue.toConstantValue(expectedType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
annotation class A(val a: IntArray = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>arrayOf(1)<!>)
|
||||||
|
annotation class B(val a: IntArray = intArrayOf(1))
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public final annotation class A : kotlin.Annotation {
|
||||||
|
public constructor A(/*0*/ a: kotlin.IntArray = ...)
|
||||||
|
public final val a: kotlin.IntArray
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final annotation class B : kotlin.Annotation {
|
||||||
|
public constructor B(/*0*/ a: kotlin.IntArray = ...)
|
||||||
|
public final val a: kotlin.IntArray
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
@@ -12519,6 +12519,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("arrayInAnnotationArgumentType.kt")
|
||||||
|
public void testArrayInAnnotationArgumentType() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/modifiers/const/arrayInAnnotationArgumentType.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("constInteraction.kt")
|
@TestMetadata("constInteraction.kt")
|
||||||
public void testConstInteraction() throws Exception {
|
public void testConstInteraction() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/modifiers/const/constInteraction.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/modifiers/const/constInteraction.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user