diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index b64de99c748..d2b53cac075 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -163,6 +163,8 @@ public interface Errors { DiagnosticFactory1 EXPANDED_TYPE_CANNOT_BE_CONSTRUCTED = DiagnosticFactory1.create(ERROR); DiagnosticFactory1 EXPANDED_TYPE_CANNOT_BE_INHERITED = DiagnosticFactory1.create(ERROR); + DiagnosticFactory0 MODIFIER_LIST_NOT_ALLOWED = DiagnosticFactory0.create(ERROR); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Errors in declarations diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index 0feb8f11de0..17c3a810311 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -521,6 +521,8 @@ public class DefaultErrorMessages { MAP.put(EXPANDED_TYPE_CANNOT_BE_CONSTRUCTED, "Expanded type {0} contains non-invariant projections in top-level arguments and cannot be constructed", RENDER_TYPE); MAP.put(EXPANDED_TYPE_CANNOT_BE_INHERITED, "Expanded type {0} contains non-invariant projections in top-level arguments and cannot be inherited from", RENDER_TYPE); + MAP.put(MODIFIER_LIST_NOT_ALLOWED, "Modifiers and annotations are not allowed here, because there are other modifiers or annotations outside of parenthesis"); + MAP.put(TOO_MANY_ARGUMENTS, "Too many arguments for {0}", FQ_NAMES_IN_TYPES); MAP.put(CONSTANT_EXPECTED_TYPE_MISMATCH, "The {0} literal does not conform to the expected type {1}", STRING, RENDER_TYPE); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/lexer/KtTokens.java b/compiler/frontend/src/org/jetbrains/kotlin/lexer/KtTokens.java index 5e43d2c965e..298444da338 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/lexer/KtTokens.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/lexer/KtTokens.java @@ -232,7 +232,7 @@ public interface KtTokens { TokenSet TYPE_MODIFIER_KEYWORDS = TokenSet.create(SUSPEND_KEYWORD); TokenSet TYPE_ARGUMENT_MODIFIER_KEYWORDS = TokenSet.create(IN_KEYWORD, OUT_KEYWORD); - TokenSet RESERVED_VALUE_PARAMETER_MODIFIER_KEYWORDS = TokenSet.create(OUT_KEYWORD, VARARG_KEYWORD); // lazy, out, ref + TokenSet RESERVED_VALUE_PARAMETER_MODIFIER_KEYWORDS = TokenSet.create(OUT_KEYWORD, VARARG_KEYWORD); TokenSet VISIBILITY_MODIFIERS = TokenSet.create(PRIVATE_KEYWORD, PUBLIC_KEYWORD, INTERNAL_KEYWORD, PROTECTED_KEYWORD); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/parsing/KotlinParsing.java b/compiler/frontend/src/org/jetbrains/kotlin/parsing/KotlinParsing.java index f5a6905a9b5..84e4e140fad 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/parsing/KotlinParsing.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/parsing/KotlinParsing.java @@ -461,8 +461,8 @@ public class KotlinParsing extends AbstractKotlinParsing { return doParseModifierList(tokenConsumer, MODIFIER_KEYWORDS, annotationParsingMode, noModifiersBefore); } - private boolean parseValueParameterModifierList() { - return doParseModifierList(null, RESERVED_VALUE_PARAMETER_MODIFIER_KEYWORDS, DEFAULT, NO_MODIFIER_BEFORE_FOR_VALUE_PARAMETER); + private boolean parseFunctionTypeValueParameterModifierList() { + return doParseModifierList(null, RESERVED_VALUE_PARAMETER_MODIFIER_KEYWORDS, NO_ANNOTATIONS, NO_MODIFIER_BEFORE_FOR_VALUE_PARAMETER); } private boolean parseTypeModifierList() { @@ -2196,7 +2196,7 @@ public class KotlinParsing extends AbstractKotlinParsing { if (isFunctionTypeContents) { if (!tryParseValueParameter(typeRequired)) { PsiBuilder.Marker valueParameter = mark(); - parseValueParameterModifierList(); // lazy, out, ref + parseFunctionTypeValueParameterModifierList(); parseTypeRef(); closeDeclarationWithCommentBinders(valueParameter, VALUE_PARAMETER, false); } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtNullableType.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtNullableType.java index 6f8e2f8ab7f..519dd730a1d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtNullableType.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtNullableType.java @@ -57,4 +57,16 @@ public class KtNullableType extends KtElementImplStub getAnnotationEntries() { + KtModifierList modifierList = getModifierList(); + return modifierList != null ? modifierList.getAnnotationEntries() + : Collections.emptyList(); + } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeResolver.kt index 5a8400f6cc9..2cd1a0a41df 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeResolver.kt @@ -24,6 +24,7 @@ import org.jetbrains.kotlin.context.TypeLazinessToken import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor import org.jetbrains.kotlin.descriptors.annotations.Annotations +import org.jetbrains.kotlin.descriptors.annotations.composeAnnotations import org.jetbrains.kotlin.descriptors.impl.VariableDescriptorImpl import org.jetbrains.kotlin.diagnostics.Errors import org.jetbrains.kotlin.diagnostics.Errors.* @@ -34,6 +35,7 @@ import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.codeFragmentUtil.debugTypeInfo import org.jetbrains.kotlin.psi.codeFragmentUtil.suppressDiagnosticsInDebugMode import org.jetbrains.kotlin.psi.debugText.getDebugText +import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes import org.jetbrains.kotlin.resolve.PossiblyBareType.bare import org.jetbrains.kotlin.resolve.PossiblyBareType.type import org.jetbrains.kotlin.resolve.bindingContextUtil.recordScope @@ -131,10 +133,10 @@ class TypeResolver( } private fun doResolvePossiblyBareType(c: TypeResolutionContext, typeReference: KtTypeReference): PossiblyBareType { - val annotations = annotationResolver.resolveAnnotationsWithoutArguments(c.scope, typeReference.getAnnotationEntries(), c.trace) - val typeElement = typeReference.typeElement + val annotations = resolveTypeAnnotations(c, typeReference) + val type = resolveTypeElement(c, annotations, typeReference.modifierList, typeElement) c.trace.recordScope(c.scope, typeReference) @@ -147,6 +149,29 @@ class TypeResolver( return type } + internal fun KtElementImplStub<*>.getAllModifierLists(): Array = + getStubOrPsiChildren(KtStubElementTypes.MODIFIER_LIST, KtStubElementTypes.MODIFIER_LIST.arrayFactory) + + private fun resolveTypeAnnotations(c: TypeResolutionContext, modifierListsOwner: KtElementImplStub<*>): Annotations { + val modifierLists = modifierListsOwner.getAllModifierLists() + + var result = Annotations.EMPTY + var isSplitModifierList = false + + for (modifierList in modifierLists) { + if (isSplitModifierList) { + c.trace.report(MODIFIER_LIST_NOT_ALLOWED.on(modifierList)) + } + + val annotations = annotationResolver.resolveAnnotationsWithoutArguments(c.scope, modifierList.annotationEntries, c.trace) + result = composeAnnotations(result, annotations) + + isSplitModifierList = true + } + + return result + } + /** * This function is light version of ForceResolveUtil.forceResolveAllContents * We can't use ForceResolveUtil.forceResolveAllContents here because it runs ForceResolveUtil.forceResolveAllContents(getConstructor()), @@ -176,12 +201,12 @@ class TypeResolver( } } - private fun resolveTypeElement(c: TypeResolutionContext, annotations: Annotations, modifiers: KtModifierList?, typeElement: KtTypeElement?): PossiblyBareType { + private fun resolveTypeElement(c: TypeResolutionContext, annotations: Annotations, outerModifierList: KtModifierList?, typeElement: KtTypeElement?): PossiblyBareType { var result: PossiblyBareType? = null - val hasSuspendModifier = modifiers?.hasModifier(KtTokens.SUSPEND_KEYWORD) ?: false - val suspendModifier = modifiers?.getModifier(KtTokens.SUSPEND_KEYWORD) - if (hasSuspendModifier && typeElement !is KtFunctionType) { + val hasSuspendModifier = outerModifierList?.hasModifier(KtTokens.SUSPEND_KEYWORD) ?: false + val suspendModifier = outerModifierList?.getModifier(KtTokens.SUSPEND_KEYWORD) + if (hasSuspendModifier && !typeElement.canHaveFunctionTypeModifiers()) { c.trace.report(Errors.WRONG_MODIFIER_TARGET.on(suspendModifier!!, KtTokens.SUSPEND_KEYWORD, "non-functional type")) } else if (hasSuspendModifier) { @@ -208,8 +233,15 @@ class TypeResolver( } override fun visitNullableType(nullableType: KtNullableType) { - val innerType = nullableType.getInnerType() - val baseType = resolveTypeElement(c, annotations, modifiers, innerType) + val innerModifierList = nullableType.modifierList + if (innerModifierList != null && outerModifierList != null) { + c.trace.report(MODIFIER_LIST_NOT_ALLOWED.on(innerModifierList)) + } + + val innerAnnotations = composeAnnotations(annotations, resolveTypeAnnotations(c, nullableType)) + + val innerType = nullableType.innerType + val baseType = resolveTypeElement(c, innerAnnotations, outerModifierList ?: innerModifierList, innerType) if (baseType.isNullable || innerType is KtNullableType || innerType is KtDynamicType) { c.trace.report(REDUNDANT_NULLABLE.on(nullableType)) } @@ -319,6 +351,9 @@ class TypeResolver( return result ?: type(ErrorUtils.createErrorType(typeElement?.getDebugText() ?: "No type element")) } + private fun KtTypeElement?.canHaveFunctionTypeModifiers(): Boolean = + this is KtFunctionType + private fun resolveTypeForTypeParameter( c: TypeResolutionContext, annotations: Annotations, typeParameter: TypeParameterDescriptor, diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt index 3a131a26a05..cba861faa00 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt @@ -23,6 +23,7 @@ import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.visitors.IrElementVisitor import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid +import org.jetbrains.kotlin.renderer.AnnotationArgumentsRenderingPolicy import org.jetbrains.kotlin.renderer.DescriptorRenderer import org.jetbrains.kotlin.utils.Printer @@ -45,7 +46,7 @@ class DumpIrTreeVisitor(out: Appendable): IrElementVisitor { companion object { val ANNOTATIONS_RENDERER = DescriptorRenderer.withOptions { verbose = true - includeAnnotationArguments = true + annotationArgumentsRenderingPolicy = AnnotationArgumentsRenderingPolicy.UNLESS_EMPTY } } diff --git a/compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.kt b/compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.kt index f6292d2abbb..fb3c9f567f8 100644 --- a/compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.kt +++ b/compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.kt @@ -12,7 +12,7 @@ fun inParamNested(fn1: (fn2: (@Ann n: Int)->Unit)->Unit) {} fun inReturn(): (@Ann x: Int)->Unit = {} -class A : (@Ann Int)->Unit { +class A : (@Ann Int)->Unit { override fun invoke(p1: Int) { var lambda: (@Ann x: Int)->Unit = {} } @@ -24,6 +24,6 @@ class A : (@Ann Int)->Unit { @Target(AnnotationTarget.TYPE) annotation class TypeAnn -val onType: (@TypeAnn A).(@Ann a: @TypeAnn A, @TypeAnn A)->@TypeAnn A? = { null } +val onType: (@TypeAnn A).(@Ann a: @TypeAnn A, @TypeAnn A)->@TypeAnn A? = { null } fun (@TypeAnn A).extFun(@Ann a: @TypeAnn A): @TypeAnn A? = null \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.txt b/compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.txt index 5edb5bc631d..cc539fb4035 100644 --- a/compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.txt +++ b/compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.txt @@ -1,14 +1,14 @@ package public val inVal: (x: kotlin.Int) -> kotlin.Unit -public val onType: (@TypeAnn A).(a: @TypeAnn A, A) -> @TypeAnn A? +public val onType: (@TypeAnn A).(a: @TypeAnn A, @TypeAnn A) -> @TypeAnn A? public fun f(/*0*/ @Ann x: kotlin.Int): kotlin.Unit public fun inParam(/*0*/ fn: (x: kotlin.Int) -> kotlin.Unit): kotlin.Unit public fun inParamNested(/*0*/ fn1: (fn2: (n: kotlin.Int) -> kotlin.Unit) -> kotlin.Unit): kotlin.Unit public fun inReturn(): (x: kotlin.Int) -> kotlin.Unit public fun @TypeAnn A.extFun(/*0*/ @Ann a: @TypeAnn A): @TypeAnn A? -public final class A : (kotlin.Int) -> kotlin.Unit { +public final class A : (@Ann kotlin.Int) -> kotlin.Unit { public constructor A() public final val prop: (x: kotlin.Int) -> kotlin.Unit public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/annotations/options/targets/funtypeargs.kt b/compiler/testData/diagnostics/tests/annotations/options/targets/funtypeargs.kt index 416e85b4867..e73805383bf 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/targets/funtypeargs.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/targets/funtypeargs.kt @@ -4,7 +4,7 @@ annotation class special @Target(AnnotationTarget.TYPE) annotation class base -fun transform(i: Int, tr: (@special Int) -> Int): Int = @special tr(@special i) +fun transform(i: Int, tr: (@special Int) -> Int): Int = @special tr(@special i) fun foo(i: Int): Int { val j = @special i + 1 diff --git a/compiler/testData/diagnostics/tests/annotations/options/targets/funtypeargs.txt b/compiler/testData/diagnostics/tests/annotations/options/targets/funtypeargs.txt index b13607a4888..d0fbdee071a 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/targets/funtypeargs.txt +++ b/compiler/testData/diagnostics/tests/annotations/options/targets/funtypeargs.txt @@ -1,7 +1,7 @@ package public fun foo(/*0*/ i: kotlin.Int): kotlin.Int -public fun transform(/*0*/ i: kotlin.Int, /*1*/ tr: (kotlin.Int) -> kotlin.Int): kotlin.Int +public fun transform(/*0*/ i: kotlin.Int, /*1*/ tr: (@special kotlin.Int) -> kotlin.Int): kotlin.Int @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class base : kotlin.Annotation { public constructor base() diff --git a/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/nullableSuspendFunction.kt b/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/nullableSuspendFunction.kt new file mode 100644 index 00000000000..9afee179d71 --- /dev/null +++ b/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/nullableSuspendFunction.kt @@ -0,0 +1,9 @@ +val test1: (suspend () -> Unit)? = null +val test2: suspend (() -> Unit)? = null +val test3: suspend ( (() -> Unit)? ) = null + +fun foo() { + test1?.invoke() + test2?.invoke() + test3?.invoke() +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/nullableSuspendFunction.txt b/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/nullableSuspendFunction.txt new file mode 100644 index 00000000000..c9fd035b42d --- /dev/null +++ b/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/nullableSuspendFunction.txt @@ -0,0 +1,6 @@ +package + +public val test1: (suspend () -> kotlin.Unit)? = null +public val test2: (suspend () -> kotlin.Unit)? = null +public val test3: (suspend () -> kotlin.Unit)? = null +public fun foo(): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/parenthesizedTypes/annotationsOnNullableParenthesizedTypes.kt b/compiler/testData/diagnostics/tests/parenthesizedTypes/annotationsOnNullableParenthesizedTypes.kt new file mode 100644 index 00000000000..a33e3c04054 --- /dev/null +++ b/compiler/testData/diagnostics/tests/parenthesizedTypes/annotationsOnNullableParenthesizedTypes.kt @@ -0,0 +1,29 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +interface AnnotationsOnNullableParenthesizedTypes { + fun B<(@A C)?>.receiverArgument() {} + + fun parameter(a: (@A C)?) {} + + fun parameterArgument(a: B<(@A C)?>) {} + + fun returnValue(): (@A C)? + + fun returnTypeParameterValue(): (@A T)? + + fun returnArgument(): B<(@A C)?> + + val lambdaType: (@A() (() -> C))? + + val lambdaParameter: ((@A C)?) -> C + + val lambdaReturnValue: () -> (@A C)? + + val lambdaReceiver: (@A C)?.() -> C +} + +@Target(AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER) +annotation class A + +interface B +interface C \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/parenthesizedTypes/annotationsOnNullableParenthesizedTypes.txt b/compiler/testData/diagnostics/tests/parenthesizedTypes/annotationsOnNullableParenthesizedTypes.txt new file mode 100644 index 00000000000..229562780b4 --- /dev/null +++ b/compiler/testData/diagnostics/tests/parenthesizedTypes/annotationsOnNullableParenthesizedTypes.txt @@ -0,0 +1,36 @@ +package + +@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER}) public final annotation class A : kotlin.Annotation { + public constructor 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 +} + +public interface AnnotationsOnNullableParenthesizedTypes { + public abstract val lambdaParameter: (@A C?) -> C + public abstract val lambdaReceiver: (@A C?).() -> C + public abstract val lambdaReturnValue: () -> @A C? + public abstract val lambdaType: @A() (() -> C)? + 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 fun parameter(/*0*/ a: @A C?): kotlin.Unit + public open fun parameterArgument(/*0*/ a: B<@A C?>): kotlin.Unit + public abstract fun returnArgument(): B<@A C?> + public abstract fun returnTypeParameterValue(): @A T? + public abstract fun returnValue(): @A C? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public open fun B<@A C?>.receiverArgument(): kotlin.Unit +} + +public interface B { + 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 interface C { + 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 +} diff --git a/compiler/testData/diagnostics/tests/parenthesizedTypes/annotationsOnParenthesizedTypes.kt b/compiler/testData/diagnostics/tests/parenthesizedTypes/annotationsOnParenthesizedTypes.kt new file mode 100644 index 00000000000..ab5e5e046e6 --- /dev/null +++ b/compiler/testData/diagnostics/tests/parenthesizedTypes/annotationsOnParenthesizedTypes.kt @@ -0,0 +1,31 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +interface AnnotationsOnParenthesizedTypes { + fun B<(@A C)>.receiverArgument() {} + + fun parameter(a: (@A C)) {} + + fun parameterArgument(a: B<(@A C)>) {} + + fun returnValue(): (@A C) + + fun returnTypeParameterValue(): (@A T) + + fun returnArgument(): B<(@A C)> + + val lambdaType: (@A() (() -> C)) + + val lambdaParameter: ((@A C)) -> C + + val lambdaReturnValue: () -> (@A C) + + val lambdaReceiver: (@A C).() -> C + + val lambdaParameterNP: (@A C) -> C +} + +@Target(AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER) +annotation class A + +interface B +interface C \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/parenthesizedTypes/annotationsOnParenthesizedTypes.txt b/compiler/testData/diagnostics/tests/parenthesizedTypes/annotationsOnParenthesizedTypes.txt new file mode 100644 index 00000000000..43330b052c0 --- /dev/null +++ b/compiler/testData/diagnostics/tests/parenthesizedTypes/annotationsOnParenthesizedTypes.txt @@ -0,0 +1,37 @@ +package + +@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER}) public final annotation class A : kotlin.Annotation { + public constructor 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 +} + +public interface AnnotationsOnParenthesizedTypes { + public abstract val lambdaParameter: (@A C) -> C + public abstract val lambdaParameterNP: (@A C) -> C + public abstract val lambdaReceiver: (@A C).() -> C + public abstract val lambdaReturnValue: () -> @A C + public abstract val lambdaType: @A() () -> C + 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 fun parameter(/*0*/ a: @A C): kotlin.Unit + public open fun parameterArgument(/*0*/ a: B<@A C>): kotlin.Unit + public abstract fun returnArgument(): B<@A C> + public abstract fun returnTypeParameterValue(): @A T + public abstract fun returnValue(): @A C + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public open fun B<@A C>.receiverArgument(): kotlin.Unit +} + +public interface B { + 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 interface C { + 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 +} diff --git a/compiler/testData/diagnostics/tests/parenthesizedTypes/splitModifierList.kt b/compiler/testData/diagnostics/tests/parenthesizedTypes/splitModifierList.kt new file mode 100644 index 00000000000..1058b5576f6 --- /dev/null +++ b/compiler/testData/diagnostics/tests/parenthesizedTypes/splitModifierList.kt @@ -0,0 +1,16 @@ +@Target(AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER) +annotation class A + +@Target(AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER) +annotation class B + +typealias Test0 = @A @B Int +typealias Test1 = @A() (@A Int) +typealias Test2 = @A() (@B Int) +typealias Test3 = @A() (@A Int) -> Int +typealias Test4 = @A() (@B Int)? +typealias Test5 = @A() ( (@B Int)? ) +typealias Test6 = (@A @B Int) +typealias Test7 = (@A @B Int)? +typealias Test8 = (@A() (@B Int)? ) +typealias Test9 = (@A() (@B Int) )? \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/parenthesizedTypes/splitModifierList.txt b/compiler/testData/diagnostics/tests/parenthesizedTypes/splitModifierList.txt new file mode 100644 index 00000000000..c1834dedfae --- /dev/null +++ b/compiler/testData/diagnostics/tests/parenthesizedTypes/splitModifierList.txt @@ -0,0 +1,25 @@ +package + +@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER}) public final annotation class A : kotlin.Annotation { + public constructor 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 +} + +@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER}) public final annotation class B : kotlin.Annotation { + public constructor B() + 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 typealias Test0 = @A @B kotlin.Int +public typealias Test1 = @A @A kotlin.Int +public typealias Test2 = @A @B kotlin.Int +public typealias Test3 = @A() (@A kotlin.Int) -> kotlin.Int +public typealias Test4 = @A @B kotlin.Int? +public typealias Test5 = @A @B kotlin.Int? +public typealias Test6 = @A @B kotlin.Int +public typealias Test7 = @A @B kotlin.Int? +public typealias Test8 = @A @B kotlin.Int? +public typealias Test9 = @A @B kotlin.Int? diff --git a/compiler/testData/psi/FunctionTypes.txt b/compiler/testData/psi/FunctionTypes.txt index 19e774c5160..eec73bb7ae7 100644 --- a/compiler/testData/psi/FunctionTypes.txt +++ b/compiler/testData/psi/FunctionTypes.txt @@ -15,19 +15,19 @@ JetFile: FunctionTypes.kt VALUE_PARAMETER_LIST PsiElement(LPAR)('(') VALUE_PARAMETER - MODIFIER_LIST - ANNOTATION - PsiElement(AT)('@') - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') TYPE_REFERENCE + MODIFIER_LIST + ANNOTATION + PsiElement(AT)('@') + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') USER_TYPE REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('a') diff --git a/compiler/testData/psi/TypeModifiersParenthesized.kt b/compiler/testData/psi/TypeModifiersParenthesized.kt new file mode 100644 index 00000000000..4f60e90b418 --- /dev/null +++ b/compiler/testData/psi/TypeModifiersParenthesized.kt @@ -0,0 +1,50 @@ +fun B<(@A C)>.receiverArgument() +fun B<(@A C)?>.receiverArgumentN() + +fun parameter(a: (@A C)) +fun parameterN(a: (@A C)?) + +fun parameterArgument(a: B<(@A C)>) +fun parameterArgumentN(a: B<(@A C)?>) + +fun returnValue(): (@A C) +fun returnValueN(): (@A C)? + +fun returnTypeParameterValue(): (@A T) +fun returnTypeParameterValueN(): (@A T)? + +fun returnArgument(): B<(@A C)> +fun returnArgumentN(): B<(@A C)>? + +val lambdaType: (@A() (() -> C)) +val lambdaTypeN: (@A() (() -> C))? + +val lambdaParameter: ((@A C)) -> C +val lambdaParameterN: ((@A C))? -> C + +val lambdaReturnValue: () -> (@A C) +val lambdaReturnValueN: () -> (@A C)? + +val lambdaReceiver: (@A C).() -> C +val lambdaReceiverN: (@A C)?.() -> C + +val suspendT: suspend T +val suspendTN: suspend T? + +val suspendFun: suspend () -> Unit +val suspendFunN: (suspend () -> Unit)? + +val suspendExtFun: suspend Any.() -> Unit +val suspendExtFunN: (suspend Any.() -> Unit)? + +val suspendFunReturnValueN: suspend () -> Unit? +val suspendFunNReturnValueN: (suspend () -> Unit?)? + +val suspendExtFunReceiverN: suspend Any?.() -> Unit +val suspendExtFunNReceiverN: (suspend Any?.() -> Unit)? + +val suspendFunReturnValueN: suspend () -> Unit? +val suspendFunNReturnValueN: (suspend () -> Unit?)? + +val suspendExtFunReceiverN: suspend Any?.() -> Unit +val suspendExtFunNReceiverN: (suspend Any?.() -> Unit)? diff --git a/compiler/testData/psi/TypeModifiersParenthesized.txt b/compiler/testData/psi/TypeModifiersParenthesized.txt new file mode 100644 index 00000000000..0133b3d0952 --- /dev/null +++ b/compiler/testData/psi/TypeModifiersParenthesized.txt @@ -0,0 +1,1026 @@ +JetFile: TypeModifiersParenthesized.kt + PACKAGE_DIRECTIVE + + IMPORT_LIST + + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(GT)('>') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('receiverArgument') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + NULLABLE_TYPE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiElement(GT)('>') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('receiverArgumentN') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('parameter') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('parameterN') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('parameterArgument') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(GT)('>') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('parameterArgumentN') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + NULLABLE_TYPE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiElement(GT)('>') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('returnValue') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('returnValueN') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiWhiteSpace('\n\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_PARAMETER_LIST + PsiElement(LT)('<') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('T') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('returnTypeParameterValue') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_PARAMETER_LIST + PsiElement(LT)('<') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('T') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('returnTypeParameterValueN') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiWhiteSpace('\n\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('returnArgument') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(GT)('>') + PsiWhiteSpace('\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('returnArgumentN') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(GT)('>') + PsiElement(QUEST)('?') + PsiWhiteSpace('\n\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('lambdaType') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('lambdaTypeN') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiWhiteSpace('\n\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('lambdaParameter') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('lambdaParameterN') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + PsiElement(LPAR)('(') + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiWhiteSpace(' ') + PsiErrorElement:Property getter or setter expected + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('C') + PsiWhiteSpace('\n\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('lambdaReturnValue') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('lambdaReturnValueN') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiWhiteSpace('\n\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('lambdaReceiver') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('lambdaReceiverN') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + NULLABLE_TYPE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiWhiteSpace('\n\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('suspendT') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('suspendTN') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + NULLABLE_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(QUEST)('?') + PsiWhiteSpace('\n\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('suspendFun') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('suspendFunN') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + PsiElement(LPAR)('(') + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiWhiteSpace('\n\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('suspendExtFun') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Any') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('suspendExtFunN') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + PsiElement(LPAR)('(') + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Any') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiWhiteSpace('\n\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('suspendFunReturnValueN') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(QUEST)('?') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('suspendFunNReturnValueN') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + PsiElement(LPAR)('(') + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(QUEST)('?') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiWhiteSpace('\n\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('suspendExtFunReceiverN') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + NULLABLE_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Any') + PsiElement(QUEST)('?') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('suspendExtFunNReceiverN') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + PsiElement(LPAR)('(') + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + NULLABLE_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Any') + PsiElement(QUEST)('?') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiWhiteSpace('\n\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('suspendFunReturnValueN') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(QUEST)('?') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('suspendFunNReturnValueN') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + PsiElement(LPAR)('(') + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(QUEST)('?') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') + PsiWhiteSpace('\n\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('suspendExtFunReceiverN') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + NULLABLE_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Any') + PsiElement(QUEST)('?') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('suspendExtFunNReceiverN') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + NULLABLE_TYPE + PsiElement(LPAR)('(') + MODIFIER_LIST + PsiElement(suspend)('suspend') + PsiWhiteSpace(' ') + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + NULLABLE_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Any') + PsiElement(QUEST)('?') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Unit') + PsiElement(RPAR)(')') + PsiElement(QUEST)('?') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/annotationsOnParenthesizedTypes.kt b/compiler/testData/psi/annotation/annotationsOnParenthesizedTypes.kt new file mode 100644 index 00000000000..7cd3eab0cbf --- /dev/null +++ b/compiler/testData/psi/annotation/annotationsOnParenthesizedTypes.kt @@ -0,0 +1,22 @@ +fun B<(@A C)>.receiverArgument() {} + +fun parameter(a: (@A C)) {} + +fun parameterArgument(a: B<(@A C)>) {} + +fun returnValue(): (@A C) + +fun returnTypeParameterValue(): (@A T) + +fun returnArgument(): B<(@A C)> + +val lambdaType: (@A() (() -> C)) + +val lambdaParameter: ((@A C)) -> C +val lambdaParameterNP: (@A C) -> C + +val lambdaReturnValue: () -> (@A C) + +val lambdaReceiver: (@A C).() -> C + +val lambdaParameterNP: (@A C) -> C \ No newline at end of file diff --git a/compiler/testData/psi/annotation/annotationsOnParenthesizedTypes.txt b/compiler/testData/psi/annotation/annotationsOnParenthesizedTypes.txt new file mode 100644 index 00000000000..6a35da0e0e3 --- /dev/null +++ b/compiler/testData/psi/annotation/annotationsOnParenthesizedTypes.txt @@ -0,0 +1,401 @@ +JetFile: annotationsOnParenthesizedTypes.kt + PACKAGE_DIRECTIVE + + IMPORT_LIST + + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(GT)('>') + PsiElement(DOT)('.') + PsiElement(IDENTIFIER)('receiverArgument') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('parameter') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('parameterArgument') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('a') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(GT)('>') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('returnValue') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + TYPE_PARAMETER_LIST + PsiElement(LT)('<') + TYPE_PARAMETER + PsiElement(IDENTIFIER)('T') + PsiElement(GT)('>') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('returnTypeParameterValue') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('returnArgument') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(GT)('>') + PsiWhiteSpace('\n\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('lambdaType') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('lambdaParameter') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiWhiteSpace('\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('lambdaParameterNP') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiWhiteSpace('\n\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('lambdaReturnValue') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('lambdaReceiver') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + PsiElement(LPAR)('(') + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiWhiteSpace('\n\n') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('lambdaParameterNP') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('C') \ No newline at end of file diff --git a/compiler/tests-common/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt b/compiler/tests-common/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt index 125c7fec2d6..ef8fef0c21a 100644 --- a/compiler/tests-common/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt +++ b/compiler/tests-common/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt @@ -33,10 +33,7 @@ import org.jetbrains.kotlin.load.kotlin.reflect.ReflectKotlinClass import org.jetbrains.kotlin.load.kotlin.reflect.RuntimeModuleData import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.renderer.DescriptorRenderer -import org.jetbrains.kotlin.renderer.DescriptorRendererModifier -import org.jetbrains.kotlin.renderer.OverrideRenderingPolicy -import org.jetbrains.kotlin.renderer.ParameterNameRenderingPolicy +import org.jetbrains.kotlin.renderer.* import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.scopes.ChainedMemberScope import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter @@ -67,7 +64,7 @@ abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdir() { parameterNameRenderingPolicy = ParameterNameRenderingPolicy.NONE includePropertyConstant = false verbose = true - includeAnnotationArguments = true + annotationArgumentsRenderingPolicy = AnnotationArgumentsRenderingPolicy.UNLESS_EMPTY renderDefaultAnnotationArguments = true modifiers = DescriptorRendererModifier.ALL } diff --git a/compiler/tests-common/org/jetbrains/kotlin/renderer/AbstractDescriptorRendererTest.kt b/compiler/tests-common/org/jetbrains/kotlin/renderer/AbstractDescriptorRendererTest.kt index 68cc5e1435e..10e09b33b86 100644 --- a/compiler/tests-common/org/jetbrains/kotlin/renderer/AbstractDescriptorRendererTest.kt +++ b/compiler/tests-common/org/jetbrains/kotlin/renderer/AbstractDescriptorRendererTest.kt @@ -143,7 +143,7 @@ abstract class AbstractDescriptorRendererTest : KotlinTestWithEnvironment() { val renderer = DescriptorRenderer.withOptions { classifierNamePolicy = ClassifierNamePolicy.FULLY_QUALIFIED modifiers = DescriptorRendererModifier.ALL - includeAnnotationArguments = true + annotationArgumentsRenderingPolicy = AnnotationArgumentsRenderingPolicy.UNLESS_EMPTY } val renderedDescriptors = descriptors.map { renderer.render(it) }.joinToString(separator = "\n") diff --git a/compiler/tests-common/org/jetbrains/kotlin/resolve/annotation/AbstractAnnotationDescriptorResolveTest.java b/compiler/tests-common/org/jetbrains/kotlin/resolve/annotation/AbstractAnnotationDescriptorResolveTest.java index 6feeca1cf84..249bc92cfe1 100644 --- a/compiler/tests-common/org/jetbrains/kotlin/resolve/annotation/AbstractAnnotationDescriptorResolveTest.java +++ b/compiler/tests-common/org/jetbrains/kotlin/resolve/annotation/AbstractAnnotationDescriptorResolveTest.java @@ -37,10 +37,7 @@ import org.jetbrains.kotlin.name.Name; import org.jetbrains.kotlin.psi.KtAnnotationEntry; import org.jetbrains.kotlin.psi.KtAnnotationUseSiteTarget; import org.jetbrains.kotlin.psi.KtFile; -import org.jetbrains.kotlin.renderer.ClassifierNamePolicy; -import org.jetbrains.kotlin.renderer.DescriptorRenderer; -import org.jetbrains.kotlin.renderer.DescriptorRendererModifier; -import org.jetbrains.kotlin.renderer.DescriptorRendererOptions; +import org.jetbrains.kotlin.renderer.*; import org.jetbrains.kotlin.resolve.BindingContext; import org.jetbrains.kotlin.resolve.DescriptorUtils; import org.jetbrains.kotlin.resolve.scopes.MemberScope; @@ -62,7 +59,7 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends KotlinTest @Override public Unit invoke(DescriptorRendererOptions options) { options.setVerbose(true); - options.setIncludeAnnotationArguments(true); + options.setAnnotationArgumentsRenderingPolicy(AnnotationArgumentsRenderingPolicy.UNLESS_EMPTY); options.setClassifierNamePolicy(ClassifierNamePolicy.SHORT.INSTANCE); options.setModifiers(DescriptorRendererModifier.ALL); return Unit.INSTANCE; diff --git a/compiler/tests-common/org/jetbrains/kotlin/test/util/RecursiveDescriptorComparator.java b/compiler/tests-common/org/jetbrains/kotlin/test/util/RecursiveDescriptorComparator.java index c0cc6819764..22d4ace0798 100644 --- a/compiler/tests-common/org/jetbrains/kotlin/test/util/RecursiveDescriptorComparator.java +++ b/compiler/tests-common/org/jetbrains/kotlin/test/util/RecursiveDescriptorComparator.java @@ -60,7 +60,7 @@ public class RecursiveDescriptorComparator { options.setIncludePropertyConstant(true); options.setClassifierNamePolicy(ClassifierNamePolicy.FULLY_QUALIFIED.INSTANCE); options.setVerbose(true); - options.setIncludeAnnotationArguments(true); + options.setAnnotationArgumentsRenderingPolicy(AnnotationArgumentsRenderingPolicy.UNLESS_EMPTY); options.setModifiers(DescriptorRendererModifier.ALL); return Unit.INSTANCE; } diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 023171ad530..52fb76151cb 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -4596,6 +4596,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { doTest(fileName); } + @TestMetadata("nullableSuspendFunction.kt") + public void testNullableSuspendFunction() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/nullableSuspendFunction.kt"); + doTest(fileName); + } + @TestMetadata("suspendFunctionNIsUnresolved.kt") public void testSuspendFunctionNIsUnresolved() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/suspendFunctionNIsUnresolved.kt"); @@ -14729,6 +14735,33 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { } } + @TestMetadata("compiler/testData/diagnostics/tests/parenthesizedTypes") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ParenthesizedTypes extends AbstractDiagnosticsTest { + public void testAllFilesPresentInParenthesizedTypes() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/parenthesizedTypes"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + + @TestMetadata("annotationsOnNullableParenthesizedTypes.kt") + public void testAnnotationsOnNullableParenthesizedTypes() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/parenthesizedTypes/annotationsOnNullableParenthesizedTypes.kt"); + doTest(fileName); + } + + @TestMetadata("annotationsOnParenthesizedTypes.kt") + public void testAnnotationsOnParenthesizedTypes() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/parenthesizedTypes/annotationsOnParenthesizedTypes.kt"); + doTest(fileName); + } + + @TestMetadata("splitModifierList.kt") + public void testSplitModifierList() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/parenthesizedTypes/splitModifierList.kt"); + doTest(fileName); + } + } + @TestMetadata("compiler/testData/diagnostics/tests/platformTypes") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/AbstractCompileJavaAgainstKotlinTest.java b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/AbstractCompileJavaAgainstKotlinTest.java index 856d9811f5b..bd914f89fdd 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/AbstractCompileJavaAgainstKotlinTest.java +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/AbstractCompileJavaAgainstKotlinTest.java @@ -23,10 +23,7 @@ import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles; import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment; import org.jetbrains.kotlin.descriptors.PackageViewDescriptor; import org.jetbrains.kotlin.name.FqName; -import org.jetbrains.kotlin.renderer.DescriptorRenderer; -import org.jetbrains.kotlin.renderer.DescriptorRendererModifier; -import org.jetbrains.kotlin.renderer.DescriptorRendererOptions; -import org.jetbrains.kotlin.renderer.ParameterNameRenderingPolicy; +import org.jetbrains.kotlin.renderer.*; import org.jetbrains.kotlin.resolve.lazy.JvmResolveUtil; import org.jetbrains.kotlin.test.ConfigurationKind; import org.jetbrains.kotlin.test.TestCaseWithTmpdir; @@ -55,7 +52,7 @@ public abstract class AbstractCompileJavaAgainstKotlinTest extends TestCaseWithT options.setWithDefinedIn(false); options.setParameterNameRenderingPolicy(ParameterNameRenderingPolicy.NONE); options.setVerbose(true); - options.setIncludeAnnotationArguments(true); + options.setAnnotationArgumentsRenderingPolicy(AnnotationArgumentsRenderingPolicy.UNLESS_EMPTY); options.setExcludedAnnotationClasses(Collections.singleton(new FqName(Retention.class.getName()))); options.setModifiers(DescriptorRendererModifier.ALL); return Unit.INSTANCE; diff --git a/compiler/tests/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java index 4a71ed0c775..57f8a86f5f3 100644 --- a/compiler/tests/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/parsing/ParsingTestGenerated.java @@ -806,6 +806,12 @@ public class ParsingTestGenerated extends AbstractParsingTest { doParsingTest(fileName); } + @TestMetadata("TypeModifiersParenthesized.kt") + public void testTypeModifiersParenthesized() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/psi/TypeModifiersParenthesized.kt"); + doParsingTest(fileName); + } + @TestMetadata("TypeModifiers_ERR.kt") public void testTypeModifiers_ERR() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/psi/TypeModifiers_ERR.kt"); @@ -862,6 +868,12 @@ public class ParsingTestGenerated extends AbstractParsingTest { doParsingTest(fileName); } + @TestMetadata("annotationsOnParenthesizedTypes.kt") + public void testAnnotationsOnParenthesizedTypes() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/psi/annotation/annotationsOnParenthesizedTypes.kt"); + doParsingTest(fileName); + } + @TestMetadata("AnnotationsOnPatterns.kt") public void testAnnotationsOnPatterns() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/psi/annotation/AnnotationsOnPatterns.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/renderer/AbstractFunctionDescriptorInExpressionRendererTest.kt b/compiler/tests/org/jetbrains/kotlin/renderer/AbstractFunctionDescriptorInExpressionRendererTest.kt index 039cf0337ae..c0333fe5321 100644 --- a/compiler/tests/org/jetbrains/kotlin/renderer/AbstractFunctionDescriptorInExpressionRendererTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/renderer/AbstractFunctionDescriptorInExpressionRendererTest.kt @@ -57,7 +57,7 @@ abstract class AbstractFunctionDescriptorInExpressionRendererTest : KotlinTestWi classifierNamePolicy = ClassifierNamePolicy.FULLY_QUALIFIED modifiers = DescriptorRendererModifier.ALL verbose = true - includeAnnotationArguments = true + annotationArgumentsRenderingPolicy = AnnotationArgumentsRenderingPolicy.UNLESS_EMPTY } val renderedDescriptors = descriptors.map { renderer.render(it) }.joinToString(separator = "\n") diff --git a/compiler/tests/org/jetbrains/kotlin/serialization/builtins/AbstractBuiltInsWithJDKMembersTest.kt b/compiler/tests/org/jetbrains/kotlin/serialization/builtins/AbstractBuiltInsWithJDKMembersTest.kt index 358f55d0496..ea64efa92b7 100644 --- a/compiler/tests/org/jetbrains/kotlin/serialization/builtins/AbstractBuiltInsWithJDKMembersTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/serialization/builtins/AbstractBuiltInsWithJDKMembersTest.kt @@ -20,6 +20,7 @@ import org.jetbrains.kotlin.builtins.BuiltInsPackageFragment import org.jetbrains.kotlin.builtins.KotlinBuiltIns.* import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl +import org.jetbrains.kotlin.renderer.AnnotationArgumentsRenderingPolicy import org.jetbrains.kotlin.renderer.DescriptorRenderer import org.jetbrains.kotlin.renderer.DescriptorRendererModifier import org.jetbrains.kotlin.renderer.OverrideRenderingPolicy @@ -36,7 +37,7 @@ abstract class AbstractBuiltInsWithJDKMembersTest : KotlinTestWithEnvironment() withDefinedIn = false overrideRenderingPolicy = OverrideRenderingPolicy.RENDER_OPEN_OVERRIDE verbose = true - includeAnnotationArguments = true + annotationArgumentsRenderingPolicy = AnnotationArgumentsRenderingPolicy.UNLESS_EMPTY modifiers = DescriptorRendererModifier.ALL }) diff --git a/compiler/tests/org/jetbrains/kotlin/serialization/builtins/LoadBuiltinsTest.java b/compiler/tests/org/jetbrains/kotlin/serialization/builtins/LoadBuiltinsTest.java index 2ed43a090a5..0134afdb0e6 100644 --- a/compiler/tests/org/jetbrains/kotlin/serialization/builtins/LoadBuiltinsTest.java +++ b/compiler/tests/org/jetbrains/kotlin/serialization/builtins/LoadBuiltinsTest.java @@ -33,10 +33,7 @@ import org.jetbrains.kotlin.descriptors.PackageFragmentProvider; import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl; import org.jetbrains.kotlin.name.FqName; import org.jetbrains.kotlin.psi.KtFile; -import org.jetbrains.kotlin.renderer.DescriptorRenderer; -import org.jetbrains.kotlin.renderer.DescriptorRendererModifier; -import org.jetbrains.kotlin.renderer.DescriptorRendererOptions; -import org.jetbrains.kotlin.renderer.OverrideRenderingPolicy; +import org.jetbrains.kotlin.renderer.*; import org.jetbrains.kotlin.resolve.lazy.LazyResolveTestUtilsKt; import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyPackageDescriptor; import org.jetbrains.kotlin.serialization.deserialization.AdditionalClassPartsProvider; @@ -73,7 +70,7 @@ public class LoadBuiltinsTest extends KotlinTestWithEnvironment { options.setWithDefinedIn(false); options.setOverrideRenderingPolicy(OverrideRenderingPolicy.RENDER_OPEN_OVERRIDE); options.setVerbose(true); - options.setIncludeAnnotationArguments(true); + options.setAnnotationArgumentsRenderingPolicy(AnnotationArgumentsRenderingPolicy.UNLESS_EMPTY); options.setModifiers(DescriptorRendererModifier.ALL); return Unit.INSTANCE; } diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/AnnotationsImpl.kt b/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/AnnotationsImpl.kt index 3aa70facff2..5b5265032b9 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/AnnotationsImpl.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/AnnotationsImpl.kt @@ -38,7 +38,7 @@ class AnnotationsImpl : Annotations { this.annotations = targetedAnnotations.filter { it.target == null }.map { it.annotation } } - override fun isEmpty() = annotations.isEmpty() + override fun isEmpty() = targetedAnnotations.isEmpty() override fun findAnnotation(fqName: FqName) = annotations.firstOrNull { val descriptor = it.type.constructor.declarationDescriptor diff --git a/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRenderer.kt b/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRenderer.kt index 8c4cd9936ff..f95a964c5a6 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRenderer.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRenderer.kt @@ -166,6 +166,15 @@ abstract class DescriptorRenderer { } } +enum class AnnotationArgumentsRenderingPolicy( + val includeAnnotationArguments: Boolean = false, + val includeEmptyAnnotationArguments: Boolean = false +) { + NO_ARGUMENTS(), + UNLESS_EMPTY(true), + ALWAYS_PARENTHESIZED(true, true) +} + interface DescriptorRendererOptions { var classifierNamePolicy: ClassifierNamePolicy var withDefinedIn: Boolean @@ -185,7 +194,11 @@ interface DescriptorRendererOptions { var textFormat: RenderingFormat var excludedAnnotationClasses: Set var excludedTypeAnnotationClasses: Set - var includeAnnotationArguments: Boolean + + var annotationArgumentsRenderingPolicy: AnnotationArgumentsRenderingPolicy + val includeAnnotationArguments: Boolean get() = annotationArgumentsRenderingPolicy.includeAnnotationArguments + val includeEmptyAnnotationArguments: Boolean get() = annotationArgumentsRenderingPolicy.includeEmptyAnnotationArguments + var includePropertyConstant: Boolean var parameterNameRenderingPolicy: ParameterNameRenderingPolicy var withoutTypeParameters: Boolean diff --git a/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt b/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt index 4325dd34bc1..3b07163553d 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt @@ -47,7 +47,10 @@ internal class DescriptorRendererImpl( } private val functionTypeAnnotationsRenderer: DescriptorRendererImpl by lazy { - this.withOptions { excludedTypeAnnotationClasses += listOf(KotlinBuiltIns.FQ_NAMES.extensionFunctionType) } as DescriptorRendererImpl + this.withOptions { + excludedTypeAnnotationClasses += listOf(KotlinBuiltIns.FQ_NAMES.extensionFunctionType) + annotationArgumentsRenderingPolicy = AnnotationArgumentsRenderingPolicy.ALWAYS_PARENTHESIZED + } as DescriptorRendererImpl } private val functionTypeParameterTypesRenderer: DescriptorRenderer by lazy { this.withOptions { excludedTypeAnnotationClasses += listOf(KotlinBuiltIns.FQ_NAMES.parameterName) } @@ -413,7 +416,7 @@ internal class DescriptorRendererImpl( if (includeAnnotationArguments) { val arguments = renderAndSortAnnotationArguments(annotation) - if (arguments.isNotEmpty()) { + if (includeEmptyAnnotationArguments || arguments.isNotEmpty()) { arguments.joinTo(this, ", ", "(", ")") } } diff --git a/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererOptionsImpl.kt b/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererOptionsImpl.kt index b8d7f91ab27..1d3d83d9ab7 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererOptionsImpl.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererOptionsImpl.kt @@ -98,7 +98,7 @@ internal class DescriptorRendererOptionsImpl : DescriptorRendererOptions { ExcludedTypeAnnotations.annotationsForNullabilityAndMutability + ExcludedTypeAnnotations.internalAnnotationsForResolve) - override var includeAnnotationArguments: Boolean by property(false) + override var annotationArgumentsRenderingPolicy by property(AnnotationArgumentsRenderingPolicy.NO_ARGUMENTS) override var alwaysRenderModifiers by property(false) diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/MemberComparator.java b/core/descriptors/src/org/jetbrains/kotlin/resolve/MemberComparator.java index c04df53254a..a06a0205353 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/MemberComparator.java +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/MemberComparator.java @@ -20,6 +20,7 @@ import kotlin.Unit; import kotlin.jvm.functions.Function1; import org.jetbrains.kotlin.descriptors.*; import org.jetbrains.kotlin.name.Name; +import org.jetbrains.kotlin.renderer.AnnotationArgumentsRenderingPolicy; import org.jetbrains.kotlin.renderer.DescriptorRenderer; import org.jetbrains.kotlin.renderer.DescriptorRendererModifier; import org.jetbrains.kotlin.renderer.DescriptorRendererOptions; @@ -39,7 +40,7 @@ public class MemberComparator implements Comparator { public Unit invoke(DescriptorRendererOptions options) { options.setWithDefinedIn(false); options.setVerbose(true); - options.setIncludeAnnotationArguments(true); + options.setAnnotationArgumentsRenderingPolicy(AnnotationArgumentsRenderingPolicy.UNLESS_EMPTY); options.setModifiers(DescriptorRendererModifier.ALL); return Unit.INSTANCE; } diff --git a/idea/ide-common/src/org/jetbrains/kotlin/idea/util/IdeDescriptorRenderers.kt b/idea/ide-common/src/org/jetbrains/kotlin/idea/util/IdeDescriptorRenderers.kt index 313c7551805..f4c7b3b338b 100644 --- a/idea/ide-common/src/org/jetbrains/kotlin/idea/util/IdeDescriptorRenderers.kt +++ b/idea/ide-common/src/org/jetbrains/kotlin/idea/util/IdeDescriptorRenderers.kt @@ -16,10 +16,7 @@ package org.jetbrains.kotlin.idea.util -import org.jetbrains.kotlin.renderer.ClassifierNamePolicy -import org.jetbrains.kotlin.renderer.DescriptorRenderer -import org.jetbrains.kotlin.renderer.DescriptorRendererModifier -import org.jetbrains.kotlin.renderer.OverrideRenderingPolicy +import org.jetbrains.kotlin.renderer.* import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.isDynamic import org.jetbrains.kotlin.types.typeUtil.builtIns @@ -52,7 +49,7 @@ object IdeDescriptorRenderers { unitReturnType = false modifiers = DescriptorRendererModifier.ALL renderUnabbreviatedType = false - includeAnnotationArguments = true + annotationArgumentsRenderingPolicy = AnnotationArgumentsRenderingPolicy.UNLESS_EMPTY } @JvmField val SOURCE_CODE: DescriptorRenderer = BASE.withOptions { diff --git a/idea/testData/checker/regression/AnnotationOnParameterOfFunctionType.kt b/idea/testData/checker/regression/AnnotationOnParameterOfFunctionType.kt index c84533f984c..1ff9aa4bcf4 100644 --- a/idea/testData/checker/regression/AnnotationOnParameterOfFunctionType.kt +++ b/idea/testData/checker/regression/AnnotationOnParameterOfFunctionType.kt @@ -1,4 +1,4 @@ -fun intercept(block: (@A K, (K) -> V) -> V) { +fun intercept(block: (@A K, (K) -> V) -> V) { } diff --git a/idea/testData/decompiler/stubBuilder/AnnotationsOnNullableTypes/AnnotationsOnNullableTypes.txt b/idea/testData/decompiler/stubBuilder/AnnotationsOnNullableTypes/AnnotationsOnNullableTypes.txt index 515d977c5e6..8f449b4a3c4 100644 --- a/idea/testData/decompiler/stubBuilder/AnnotationsOnNullableTypes/AnnotationsOnNullableTypes.txt +++ b/idea/testData/decompiler/stubBuilder/AnnotationsOnNullableTypes/AnnotationsOnNullableTypes.txt @@ -14,6 +14,12 @@ PsiJetFileStubImpl[package=] VALUE_PARAMETER_LIST VALUE_PARAMETER[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=null] TYPE_REFERENCE + MODIFIER_LIST[] + ANNOTATION_ENTRY[hasValueArguments=false, shortName=A] + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=A] NULLABLE_TYPE USER_TYPE REFERENCE_EXPRESSION[referencedName=C] diff --git a/idea/testData/decompiler/stubBuilder/AnnotationsOnParenthesizedTypes/AnnotationsOnParenthesizedTypes.kt b/idea/testData/decompiler/stubBuilder/AnnotationsOnParenthesizedTypes/AnnotationsOnParenthesizedTypes.kt new file mode 100644 index 00000000000..82f4e8dfc44 --- /dev/null +++ b/idea/testData/decompiler/stubBuilder/AnnotationsOnParenthesizedTypes/AnnotationsOnParenthesizedTypes.kt @@ -0,0 +1,29 @@ +public class AnnotationsOnParenthesizedTypes { + fun B<(@A C)>.receiverArgument() {} + + fun parameter(a: (@A C)) {} + + fun parameterArgument(a: B<(@A C)>) {} + + fun returnValue(): (@A C) = null!! + + fun returnTypeParameterValue(): (@A T) = null!! + + fun returnArgument(): B<(@A C)> = null!! + + val lambdaType: (@A() (() -> C)) = null!! + + val lambdaParameter: ((@A C)) -> C = null!! + + val lambdaReturnValue: () -> (@A C) = null!! + + val lambdaReceiver: (@A C).() -> C = null!! + + val lambdaTypeWithNullableReceiver: (@A C)?.() -> C = null!! +} + +@Target(AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER) +annotation class A + +interface B +interface C \ No newline at end of file diff --git a/idea/testData/decompiler/stubBuilder/AnnotationsOnParenthesizedTypes/AnnotationsOnParenthesizedTypes.txt b/idea/testData/decompiler/stubBuilder/AnnotationsOnParenthesizedTypes/AnnotationsOnParenthesizedTypes.txt new file mode 100644 index 00000000000..550881e14c9 --- /dev/null +++ b/idea/testData/decompiler/stubBuilder/AnnotationsOnParenthesizedTypes/AnnotationsOnParenthesizedTypes.txt @@ -0,0 +1,198 @@ +PsiJetFileStubImpl[package=] + PACKAGE_DIRECTIVE + IMPORT_LIST + CLASS[fqName=AnnotationsOnParenthesizedTypes, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=AnnotationsOnParenthesizedTypes, superNames=[]] + MODIFIER_LIST[public final] + PRIMARY_CONSTRUCTOR + MODIFIER_LIST[public] + VALUE_PARAMETER_LIST + CLASS_BODY + PROPERTY[fqName=AnnotationsOnParenthesizedTypes.lambdaParameter, hasDelegate=false, hasDelegateExpression=false, hasInitializer=false, hasReturnTypeRef=true, isExtension=false, isTopLevel=false, isVar=false, name=lambdaParameter] + MODIFIER_LIST[public final] + TYPE_REFERENCE + FUNCTION_TYPE + VALUE_PARAMETER_LIST + VALUE_PARAMETER[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=null] + TYPE_REFERENCE + MODIFIER_LIST[] + ANNOTATION_ENTRY[hasValueArguments=false, shortName=A] + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=A] + USER_TYPE + REFERENCE_EXPRESSION[referencedName=C] + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=C] + PROPERTY[fqName=AnnotationsOnParenthesizedTypes.lambdaReceiver, hasDelegate=false, hasDelegateExpression=false, hasInitializer=false, hasReturnTypeRef=true, isExtension=false, isTopLevel=false, isVar=false, name=lambdaReceiver] + MODIFIER_LIST[public final] + TYPE_REFERENCE + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + MODIFIER_LIST[] + ANNOTATION_ENTRY[hasValueArguments=false, shortName=A] + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=A] + USER_TYPE + REFERENCE_EXPRESSION[referencedName=C] + VALUE_PARAMETER_LIST + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=C] + PROPERTY[fqName=AnnotationsOnParenthesizedTypes.lambdaReturnValue, hasDelegate=false, hasDelegateExpression=false, hasInitializer=false, hasReturnTypeRef=true, isExtension=false, isTopLevel=false, isVar=false, name=lambdaReturnValue] + MODIFIER_LIST[public final] + TYPE_REFERENCE + FUNCTION_TYPE + VALUE_PARAMETER_LIST + TYPE_REFERENCE + MODIFIER_LIST[] + ANNOTATION_ENTRY[hasValueArguments=false, shortName=A] + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=A] + USER_TYPE + REFERENCE_EXPRESSION[referencedName=C] + PROPERTY[fqName=AnnotationsOnParenthesizedTypes.lambdaType, hasDelegate=false, hasDelegateExpression=false, hasInitializer=false, hasReturnTypeRef=true, isExtension=false, isTopLevel=false, isVar=false, name=lambdaType] + MODIFIER_LIST[public final] + TYPE_REFERENCE + MODIFIER_LIST[] + ANNOTATION_ENTRY[hasValueArguments=false, shortName=A] + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=A] + FUNCTION_TYPE + VALUE_PARAMETER_LIST + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=C] + PROPERTY[fqName=AnnotationsOnParenthesizedTypes.lambdaTypeWithNullableReceiver, hasDelegate=false, hasDelegateExpression=false, hasInitializer=false, hasReturnTypeRef=true, isExtension=false, isTopLevel=false, isVar=false, name=lambdaTypeWithNullableReceiver] + MODIFIER_LIST[public final] + TYPE_REFERENCE + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + MODIFIER_LIST[] + ANNOTATION_ENTRY[hasValueArguments=false, shortName=A] + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=A] + NULLABLE_TYPE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=C] + VALUE_PARAMETER_LIST + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=C] + FUN[fqName=AnnotationsOnParenthesizedTypes.parameter, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=parameter] + MODIFIER_LIST[public final] + VALUE_PARAMETER_LIST + VALUE_PARAMETER[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=a] + TYPE_REFERENCE + MODIFIER_LIST[] + ANNOTATION_ENTRY[hasValueArguments=false, shortName=A] + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=A] + USER_TYPE + REFERENCE_EXPRESSION[referencedName=C] + TYPE_REFERENCE + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=kotlin] + REFERENCE_EXPRESSION[referencedName=Unit] + FUN[fqName=AnnotationsOnParenthesizedTypes.parameterArgument, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=parameterArgument] + MODIFIER_LIST[public final] + VALUE_PARAMETER_LIST + VALUE_PARAMETER[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=a] + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=B] + TYPE_ARGUMENT_LIST + TYPE_PROJECTION[projectionKind=NONE] + TYPE_REFERENCE + MODIFIER_LIST[] + ANNOTATION_ENTRY[hasValueArguments=false, shortName=A] + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=A] + USER_TYPE + REFERENCE_EXPRESSION[referencedName=C] + TYPE_REFERENCE + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=kotlin] + REFERENCE_EXPRESSION[referencedName=Unit] + FUN[fqName=AnnotationsOnParenthesizedTypes.returnArgument, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=returnArgument] + MODIFIER_LIST[public final] + VALUE_PARAMETER_LIST + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=B] + TYPE_ARGUMENT_LIST + TYPE_PROJECTION[projectionKind=NONE] + TYPE_REFERENCE + MODIFIER_LIST[] + ANNOTATION_ENTRY[hasValueArguments=false, shortName=A] + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=A] + USER_TYPE + REFERENCE_EXPRESSION[referencedName=C] + FUN[fqName=AnnotationsOnParenthesizedTypes.returnTypeParameterValue, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=true, isExtension=false, isTopLevel=false, name=returnTypeParameterValue] + MODIFIER_LIST[public final] + TYPE_PARAMETER_LIST + TYPE_PARAMETER[fqName=null, isInVariance=false, isOutVariance=false, name=T] + VALUE_PARAMETER_LIST + TYPE_REFERENCE + MODIFIER_LIST[] + ANNOTATION_ENTRY[hasValueArguments=false, shortName=A] + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=A] + USER_TYPE + REFERENCE_EXPRESSION[referencedName=T] + FUN[fqName=AnnotationsOnParenthesizedTypes.returnValue, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=returnValue] + MODIFIER_LIST[public final] + VALUE_PARAMETER_LIST + TYPE_REFERENCE + MODIFIER_LIST[] + ANNOTATION_ENTRY[hasValueArguments=false, shortName=A] + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=A] + USER_TYPE + REFERENCE_EXPRESSION[referencedName=C] + FUN[fqName=AnnotationsOnParenthesizedTypes.receiverArgument, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=true, isTopLevel=false, name=receiverArgument] + MODIFIER_LIST[public final] + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=B] + TYPE_ARGUMENT_LIST + TYPE_PROJECTION[projectionKind=NONE] + TYPE_REFERENCE + MODIFIER_LIST[] + ANNOTATION_ENTRY[hasValueArguments=false, shortName=A] + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=A] + USER_TYPE + REFERENCE_EXPRESSION[referencedName=C] + VALUE_PARAMETER_LIST + TYPE_REFERENCE + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION[referencedName=kotlin] + REFERENCE_EXPRESSION[referencedName=Unit] diff --git a/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/ClsStubBuilderTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/ClsStubBuilderTestGenerated.java index bdeb80ebf6b..b84aa7e45a3 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/ClsStubBuilderTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/ClsStubBuilderTestGenerated.java @@ -60,6 +60,12 @@ public class ClsStubBuilderTestGenerated extends AbstractClsStubBuilderTest { doTest(fileName); } + @TestMetadata("AnnotationsOnParenthesizedTypes") + public void testAnnotationsOnParenthesizedTypes() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/decompiler/stubBuilder/AnnotationsOnParenthesizedTypes/"); + doTest(fileName); + } + @TestMetadata("AnonymousReturnWithGenericType") public void testAnonymousReturnWithGenericType() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/decompiler/stubBuilder/AnonymousReturnWithGenericType/");