KT-15677 KT-15775
Update parser & descriptor renderer to handle parenthesized types and function types properly. Resolve annotations in parenthesized types. AnnotationsImpl.isEmpty() returned false for targeted annotations only (e.g., 'fun @receiver:Ann C?.foo()'). Properly keep track of targeted annotations.
This commit is contained in:
@@ -163,6 +163,8 @@ public interface Errors {
|
||||
DiagnosticFactory1<KtElement, KotlinType> EXPANDED_TYPE_CANNOT_BE_CONSTRUCTED = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory1<KtTypeElement, KotlinType> EXPANDED_TYPE_CANNOT_BE_INHERITED = DiagnosticFactory1.create(ERROR);
|
||||
|
||||
DiagnosticFactory0<KtModifierList> MODIFIER_LIST_NOT_ALLOWED = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Errors in declarations
|
||||
|
||||
+2
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -57,4 +57,16 @@ public class KtNullableType extends KtElementImplStub<KotlinPlaceHolderStub<KtNu
|
||||
public KtTypeElement getInnerType() {
|
||||
return KtStubbedPsiUtil.getStubOrPsiChild(this, KtStubElementTypes.TYPE_ELEMENT_TYPES, KtTypeElement.ARRAY_FACTORY);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public KtModifierList getModifierList() {
|
||||
return getStubOrPsiChild(KtStubElementTypes.MODIFIER_LIST);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<KtAnnotationEntry> getAnnotationEntries() {
|
||||
KtModifierList modifierList = getModifierList();
|
||||
return modifierList != null ? modifierList.getAnnotationEntries()
|
||||
: Collections.<KtAnnotationEntry>emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<out KtDeclarationModifierList> =
|
||||
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,
|
||||
|
||||
@@ -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<Unit, String> {
|
||||
companion object {
|
||||
val ANNOTATIONS_RENDERER = DescriptorRenderer.withOptions {
|
||||
verbose = true
|
||||
includeAnnotationArguments = true
|
||||
annotationArgumentsRenderingPolicy = AnnotationArgumentsRenderingPolicy.UNLESS_EMPTY
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ fun inParamNested(fn1: (fn2: (<!UNSUPPORTED!>@Ann<!> n: Int)->Unit)->Unit) {}
|
||||
|
||||
fun inReturn(): (<!UNSUPPORTED!>@Ann<!> x: Int)->Unit = {}
|
||||
|
||||
class A : (@<!DEBUG_INFO_MISSING_UNRESOLVED!>Ann<!> Int)->Unit {
|
||||
class A : (@Ann Int)->Unit {
|
||||
override fun invoke(p1: Int) {
|
||||
var lambda: (<!UNSUPPORTED!>@Ann<!> x: Int)->Unit = {}
|
||||
}
|
||||
@@ -24,6 +24,6 @@ class A : (@<!DEBUG_INFO_MISSING_UNRESOLVED!>Ann<!> Int)->Unit {
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class TypeAnn
|
||||
|
||||
val onType: (@TypeAnn A).(<!UNSUPPORTED!>@Ann<!> a: @TypeAnn A, @<!DEBUG_INFO_MISSING_UNRESOLVED!>TypeAnn<!> A)->@TypeAnn A? = <!EXPECTED_PARAMETERS_NUMBER_MISMATCH!>{<!> null }
|
||||
val onType: (@TypeAnn A).(<!UNSUPPORTED!>@Ann<!> a: @TypeAnn A, @TypeAnn A)->@TypeAnn A? = <!EXPECTED_PARAMETERS_NUMBER_MISMATCH!>{<!> null }
|
||||
|
||||
fun (@TypeAnn A).extFun(@Ann a: @TypeAnn A): @TypeAnn A? = null
|
||||
+2
-2
@@ -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
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ annotation class special
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class base
|
||||
|
||||
fun transform(i: Int, tr: (@<!DEBUG_INFO_MISSING_UNRESOLVED!>special<!> Int) -> Int): Int = @special tr(@special i)
|
||||
fun transform(i: Int, tr: (<!WRONG_ANNOTATION_TARGET!>@special<!> Int) -> Int): Int = @special tr(@special i)
|
||||
|
||||
fun foo(i: Int): Int {
|
||||
val j = @special i + 1
|
||||
|
||||
+1
-1
@@ -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()
|
||||
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
val test1: (suspend () -> Unit)? = null
|
||||
val test2: <!WRONG_MODIFIER_TARGET!>suspend<!> (() -> Unit)? = null
|
||||
val test3: <!WRONG_MODIFIER_TARGET!>suspend<!> ( (() -> Unit)? ) = null
|
||||
|
||||
fun foo() {
|
||||
test1?.<!ILLEGAL_SUSPEND_FUNCTION_CALL!>invoke<!>()
|
||||
test2?.<!ILLEGAL_SUSPEND_FUNCTION_CALL!>invoke<!>()
|
||||
test3?.<!ILLEGAL_SUSPEND_FUNCTION_CALL!>invoke<!>()
|
||||
}
|
||||
Vendored
+6
@@ -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
|
||||
Vendored
+29
@@ -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 <T> 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<T>
|
||||
interface C
|
||||
Vendored
+36
@@ -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 </*0*/ T> 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</*0*/ T> {
|
||||
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
|
||||
}
|
||||
+31
@@ -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 <T> 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<T>
|
||||
interface C
|
||||
+37
@@ -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 </*0*/ T> 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</*0*/ T> {
|
||||
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
|
||||
}
|
||||
@@ -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() (<!MODIFIER_LIST_NOT_ALLOWED!>@A<!> Int)
|
||||
typealias Test2 = @A() (<!MODIFIER_LIST_NOT_ALLOWED!>@B<!> Int)
|
||||
typealias Test3 = @A() (@A Int) -> Int
|
||||
typealias Test4 = @A() (<!MODIFIER_LIST_NOT_ALLOWED!>@B<!> Int)?
|
||||
typealias Test5 = @A() ( (<!MODIFIER_LIST_NOT_ALLOWED!>@B<!> Int)? )
|
||||
typealias Test6 = (@A @B Int)
|
||||
typealias Test7 = (@A @B Int)?
|
||||
typealias Test8 = (@A() (<!MODIFIER_LIST_NOT_ALLOWED!>@B<!> Int)? )
|
||||
typealias Test9 = (@A() (<!MODIFIER_LIST_NOT_ALLOWED!>@B<!> Int) )?
|
||||
@@ -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?
|
||||
+12
-12
@@ -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')
|
||||
|
||||
@@ -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 <T> returnTypeParameterValue(): (@A T)
|
||||
fun <T> 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)?
|
||||
+1026
File diff suppressed because it is too large
Load Diff
@@ -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 <T> 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
|
||||
@@ -0,0 +1,401 @@
|
||||
JetFile: annotationsOnParenthesizedTypes.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
IMPORT_LIST
|
||||
<empty 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')
|
||||
+2
-5
@@ -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
|
||||
}
|
||||
|
||||
+1
-1
@@ -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")
|
||||
|
||||
|
||||
+2
-5
@@ -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;
|
||||
|
||||
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
+2
-5
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
|
||||
+1
-1
@@ -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")
|
||||
|
||||
|
||||
+2
-1
@@ -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
|
||||
})
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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<FqName>
|
||||
var excludedTypeAnnotationClasses: Set<FqName>
|
||||
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
|
||||
|
||||
@@ -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, ", ", "(", ")")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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<DeclarationDescriptor> {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
fun <K, V> intercept(<warning>block</warning>: (@A K, (K) -> V) -> V) {
|
||||
fun <K, V> intercept(<warning>block</warning>: (<error>@A</error> K, (K) -> V) -> V) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
Vendored
+6
@@ -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]
|
||||
|
||||
+29
@@ -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 <T> 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<T>
|
||||
interface C
|
||||
+198
@@ -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]
|
||||
+6
@@ -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/");
|
||||
|
||||
Reference in New Issue
Block a user