Resolve annotations on multi-declaration for parameter
This commit is contained in:
+1
@@ -399,6 +399,7 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
|
||||
if (multiParameter != null && loopRange != null) {
|
||||
JetType elementType = expectedParameterType == null ? ErrorUtils.createErrorType("Loop range has no type") : expectedParameterType;
|
||||
TransientReceiver iteratorNextAsReceiver = new TransientReceiver(elementType);
|
||||
components.annotationResolver.resolveAnnotationsWithArguments(loopScope, multiParameter.getModifierList(), context.trace);
|
||||
components.multiDeclarationResolver.defineLocalVariablesFromMultiDeclaration(
|
||||
loopScope, multiParameter, iteratorNextAsReceiver, loopRange, context
|
||||
);
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
annotation class Ann(val x: Int)
|
||||
|
||||
data class A(val x: Int, val y: Int)
|
||||
|
||||
fun bar(): Array<A> = null!!
|
||||
|
||||
fun foo() {
|
||||
for (Ann(1) i in 1..100) {}
|
||||
for (Ann(2) i in 1..100) {}
|
||||
|
||||
for (Ann(3) (x, @Ann(4) y) in bar()) {}
|
||||
|
||||
for (<!UNRESOLVED_REFERENCE!>Err<!> (x,y) in bar()) {}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package
|
||||
|
||||
internal fun bar(): kotlin.Array<A>
|
||||
internal fun foo(): kotlin.Unit
|
||||
|
||||
kotlin.data() internal final class A {
|
||||
public constructor A(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int)
|
||||
internal final val x: kotlin.Int
|
||||
internal final val y: kotlin.Int
|
||||
internal final /*synthesized*/ fun component1(): kotlin.Int
|
||||
internal final /*synthesized*/ fun component2(): kotlin.Int
|
||||
public final /*synthesized*/ fun copy(/*0*/ x: kotlin.Int = ..., /*1*/ y: kotlin.Int = ...): A
|
||||
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
|
||||
}
|
||||
|
||||
internal final annotation class Ann : kotlin.Annotation {
|
||||
public constructor Ann(/*0*/ x: kotlin.Int)
|
||||
internal final val x: kotlin.Int
|
||||
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
|
||||
}
|
||||
@@ -699,6 +699,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forParameterAnnotationResolve.kt")
|
||||
public void testForParameterAnnotationResolve() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/forParameterAnnotationResolve.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("invalidTypesInAnnotationConstructor.kt")
|
||||
public void testInvalidTypesInAnnotationConstructor() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/invalidTypesInAnnotationConstructor.kt");
|
||||
|
||||
Reference in New Issue
Block a user