From fc447e2d2f9893781211f002f1e1d74f63c6d1b0 Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Mon, 7 Sep 2015 12:38:15 +0300 Subject: [PATCH] Parse some builtin annotations as modifiers But still resolve them as annotations. Mostly it's needed as begin of migration path, one day they become modifiers anyway Some tests are dropped because they supposed that `annotation` should have parameter --- .../jetbrains/kotlin/diagnostics/Errors.java | 2 +- .../org/jetbrains/kotlin/lexer/JetTokens.java | 21 +- .../jetbrains/kotlin/parsing/JetParsing.java | 5 + .../jetbrains/kotlin/psi/JetClassOrObject.kt | 5 +- .../stubs/elements/JetFileElementType.java | 2 +- .../kotlin/resolve/AnnotationResolver.java | 44 ++- .../kotlin/resolve/AnnotationUtil.kt | 27 +- .../kotlin/resolve/ModifiersChecker.kt | 8 +- .../kotlin/resolve/OverrideResolver.java | 15 +- .../DiagnosticsWithSuppression.java | 43 ++- .../lazy/descriptors/LazyClassDescriptor.java | 8 +- .../tests/annotations/AnnotationIdentifier.kt | 4 +- .../annotations/AnnotationIdentifier.txt | 2 +- .../annotations/AnnotationsForClasses.txt | 2 +- .../RecursivelyAnnotatedParameterType.kt | 2 +- .../tests/annotations/annotationModifier.kt | 12 +- .../tests/annotations/options/annotation.kt | 16 - .../tests/annotations/options/annotation.txt | 44 --- .../tests/annotations/options/brackets.kt | 3 - .../tests/annotations/options/brackets.txt | 15 - .../annotations/options/targets/accessors.kt | 2 +- .../annotations/options/targets/annotation.kt | 2 +- .../annotations/options/targets/classifier.kt | 2 +- .../options/targets/constructor.kt | 2 +- .../annotations/options/targets/empty.kt | 2 +- .../tests/annotations/options/targets/file.kt | 2 +- .../annotations/options/targets/incorrect.kt | 2 +- .../annotations/options/targets/local.kt | 2 +- .../annotations/options/targets/nested.kt | 2 +- .../annotations/options/targets/property.kt | 2 +- .../annotations/options/targets/returntype.kt | 2 +- .../tests/annotations/options/targets/type.kt | 2 +- .../annotations/options/targets/typeargs.kt | 2 +- .../annotations/options/targets/valueparam.kt | 2 +- .../tests/enum/enumWithAnnotationKeyword.kt | 2 +- .../tests/modifiers/IllegalModifiers.kt | 8 +- .../testsWithStdLib/native/constructor.kt | 8 +- .../psi/EnumEntryCommaInlineMember.txt | 9 +- .../psi/EnumEntrySemicolonInlineMember.txt | 7 +- .../psi/EnumEntrySpaceInlineMember.txt | 7 +- .../psi/EnumWithAnnotationKeyword.txt | 21 +- compiler/testData/psi/SimpleModifiers.txt | 16 +- compiler/testData/psi/SoftKeywords.txt | 28 +- .../testData/psi/annotation/Annotations.txt | 16 +- .../psi/annotation/Annotations_ERR.txt | 16 +- .../testData/psi/annotation/forParameters.txt | 9 +- .../modifiersMigration/newModifiers.kt | 60 +++ .../modifiersMigration/newModifiers.txt | 352 ++++++++++++++++++ .../modifiersMigration/oldUsages.kt | 9 + .../modifiersMigration/oldUsages.txt | 105 ++++++ .../psi/annotation/multiDeclaration.txt | 9 +- .../psi/annotation/oldAnnotationsRecovery.txt | 19 +- .../annotation/options/annotAsArgComplex.kt | 9 - .../annotation/options/annotAsArgComplex.txt | 89 ----- .../psi/annotation/options/annotation.kt | 20 - .../psi/annotation/options/annotation.txt | 188 ---------- .../testData/psi/annotation/options/java.txt | 14 +- .../psi/annotation/options/options.kt | 12 - .../psi/annotation/options/options.txt | 174 --------- ...outFileAnnotationAndPackageDeclaration.txt | 9 +- compiler/testData/psi/examples/With.txt | 9 +- .../checkers/JetDiagnosticsTestGenerated.java | 12 - .../parsing/JetParsingTestGenerated.java | 39 +- .../kotlin/builtins/KotlinBuiltIns.java | 2 +- .../descriptors/annotations/annotationUtil.kt | 23 ++ .../kotlin/renderer/DescriptorRendererImpl.kt | 12 +- .../testData/keywords/AfterClassProperty.kt | 6 + .../testData/keywords/AfterClasses.kt | 6 + .../testData/keywords/AfterFuns.kt | 6 + .../keywords/GlobalPropertyAccessors.kt | 6 + .../testData/keywords/InClassBeforeFun.kt | 6 + .../testData/keywords/InClassScope.kt | 6 + .../keywords/InTopScopeAfterPackage.kt | 6 + .../testData/keywords/PropertyAccessors.kt | 6 + .../testData/keywords/PropertyAccessors2.kt | 6 + .../testData/keywords/PropertySetter.kt | 6 + .../testData/keywords/TopScope.kt | 6 + .../infos/CapturedConstructorParameter.kt | 2 +- .../checker/infos/CapturedInInlinedClosure.kt | 4 +- .../decompiledText/Annotations.expected.kt | 6 +- .../highlighter/TypesAndAnnotations.kt | 4 +- idea/testData/stubs/AnnotationClass.expected | 7 +- .../stubs/SecondaryConstructors.expected | 7 +- idea/testData/stubs/TypeAnnotation.expected | 14 +- 84 files changed, 875 insertions(+), 856 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/annotations/options/annotation.kt delete mode 100644 compiler/testData/diagnostics/tests/annotations/options/annotation.txt delete mode 100644 compiler/testData/diagnostics/tests/annotations/options/brackets.kt delete mode 100644 compiler/testData/diagnostics/tests/annotations/options/brackets.txt create mode 100644 compiler/testData/psi/annotation/modifiersMigration/newModifiers.kt create mode 100644 compiler/testData/psi/annotation/modifiersMigration/newModifiers.txt create mode 100644 compiler/testData/psi/annotation/modifiersMigration/oldUsages.kt create mode 100644 compiler/testData/psi/annotation/modifiersMigration/oldUsages.txt delete mode 100644 compiler/testData/psi/annotation/options/annotAsArgComplex.kt delete mode 100644 compiler/testData/psi/annotation/options/annotAsArgComplex.txt delete mode 100644 compiler/testData/psi/annotation/options/annotation.kt delete mode 100644 compiler/testData/psi/annotation/options/annotation.txt delete mode 100644 compiler/testData/psi/annotation/options/options.kt delete mode 100644 compiler/testData/psi/annotation/options/options.txt create mode 100644 core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/annotationUtil.kt diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index d568c668809..23146a34aaf 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -260,7 +260,7 @@ public interface Errors { DiagnosticFactory2 CANNOT_OVERRIDE_INVISIBLE_MEMBER = DiagnosticFactory2.create(ERROR, OVERRIDE_MODIFIER); - DiagnosticFactory2 DATA_CLASS_OVERRIDE_CONFLICT = + DiagnosticFactory2 DATA_CLASS_OVERRIDE_CONFLICT = DiagnosticFactory2.create(ERROR); DiagnosticFactory1 CANNOT_INFER_VISIBILITY = diff --git a/compiler/frontend/src/org/jetbrains/kotlin/lexer/JetTokens.java b/compiler/frontend/src/org/jetbrains/kotlin/lexer/JetTokens.java index 2be60414a34..b0732ceef4c 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/lexer/JetTokens.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/lexer/JetTokens.java @@ -170,6 +170,13 @@ public interface JetTokens { JetModifierKeywordToken LATE_INIT_KEYWORD = JetModifierKeywordToken.softKeywordModifier("lateinit"); + JetModifierKeywordToken DATA_KEYWORD = JetModifierKeywordToken.softKeywordModifier("data"); + JetModifierKeywordToken INLINE_KEYWORD = JetModifierKeywordToken.softKeywordModifier("inline"); + JetModifierKeywordToken NOINLINE_KEYWORD = JetModifierKeywordToken.softKeywordModifier("noinline"); + JetModifierKeywordToken TAILREC_KEYWORD = JetModifierKeywordToken.softKeywordModifier("tailrec"); + JetModifierKeywordToken EXTERNAL_KEYWORD = JetModifierKeywordToken.softKeywordModifier("external"); + JetModifierKeywordToken ANNOTATION_KEYWORD = JetModifierKeywordToken.softKeywordModifier("annotation"); + TokenSet KEYWORDS = TokenSet.create(PACKAGE_KEYWORD, AS_KEYWORD, TYPE_ALIAS_KEYWORD, CLASS_KEYWORD, TRAIT_KEYWORD, INTERFACE_KEYWORD, THIS_KEYWORD, SUPER_KEYWORD, VAL_KEYWORD, VAR_KEYWORD, FUN_KEYWORD, FOR_KEYWORD, NULL_KEYWORD, @@ -185,7 +192,9 @@ public interface JetTokens { CATCH_KEYWORD, FINALLY_KEYWORD, OUT_KEYWORD, FINAL_KEYWORD, VARARG_KEYWORD, REIFIED_KEYWORD, DYNAMIC_KEYWORD, COMPANION_KEYWORD, CONSTRUCTOR_KEYWORD, INIT_KEYWORD, SEALED_KEYWORD, FIELD_KEYWORD, PROPERTY_KEYWORD, RECEIVER_KEYWORD, PARAM_KEYWORD, SPARAM_KEYWORD, - LATE_INIT_KEYWORD + LATE_INIT_KEYWORD, + DATA_KEYWORD, INLINE_KEYWORD, NOINLINE_KEYWORD, TAILREC_KEYWORD, EXTERNAL_KEYWORD, + ANNOTATION_KEYWORD ); /* @@ -197,9 +206,17 @@ public interface JetTokens { new JetModifierKeywordToken[] { ABSTRACT_KEYWORD, ENUM_KEYWORD, OPEN_KEYWORD, INNER_KEYWORD, OVERRIDE_KEYWORD, PRIVATE_KEYWORD, PUBLIC_KEYWORD, INTERNAL_KEYWORD, PROTECTED_KEYWORD, OUT_KEYWORD, IN_KEYWORD, FINAL_KEYWORD, VARARG_KEYWORD, - REIFIED_KEYWORD, COMPANION_KEYWORD, SEALED_KEYWORD, LATE_INIT_KEYWORD + REIFIED_KEYWORD, COMPANION_KEYWORD, SEALED_KEYWORD, LATE_INIT_KEYWORD, + DATA_KEYWORD, INLINE_KEYWORD, NOINLINE_KEYWORD, TAILREC_KEYWORD, EXTERNAL_KEYWORD, ANNOTATION_KEYWORD }; + // Please synchronize this array with org.jetbrains.kotlin.descriptors.annotations.ANNOTATION_MODIFIERS_FQ_NAMES + JetModifierKeywordToken[] ANNOTATION_MODIFIERS_KEYWORDS_ARRAY = new JetModifierKeywordToken[] { + DATA_KEYWORD, INLINE_KEYWORD, NOINLINE_KEYWORD, TAILREC_KEYWORD, EXTERNAL_KEYWORD, ANNOTATION_KEYWORD + }; + + TokenSet ANNOTATION_MODIFIERS_KEYWORDS = TokenSet.create(ANNOTATION_MODIFIERS_KEYWORDS_ARRAY); + TokenSet MODIFIER_KEYWORDS = TokenSet.create(MODIFIER_KEYWORDS_ARRAY); TokenSet VISIBILITY_MODIFIERS = TokenSet.create(PRIVATE_KEYWORD, PUBLIC_KEYWORD, INTERNAL_KEYWORD, PROTECTED_KEYWORD); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java b/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java index b9dec93f67a..12efe6ee79f 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/parsing/JetParsing.java @@ -485,6 +485,11 @@ public class JetParsing extends AbstractJetParsing { if (at(AT) && !WHITE_SPACE_OR_COMMENT_BIT_SET.contains(myBuilder.rawLookup(1))) { advance(); // AT + if (atSet(ANNOTATION_MODIFIERS_KEYWORDS)) { + myBuilder.remapCurrentToken(IDENTIFIER); + marker.rollbackTo(); + return false; + } } if (atSet(MODIFIER_KEYWORDS)) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetClassOrObject.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetClassOrObject.kt index 5fb2686f185..68df09b80c4 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetClassOrObject.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetClassOrObject.kt @@ -110,9 +110,8 @@ abstract public class JetClassOrObject : public fun getSecondaryConstructors(): List = getBody()?.getSecondaryConstructors().orEmpty() deprecated(value = "It's no more possible to determine it exactly using AST. Use ClassDescriptor.getKind() instead") - public fun isAnnotation(): Boolean = getBuiltInAnnotationEntry() != null - - public fun getBuiltInAnnotationEntry(): JetAnnotationEntry? = getAnnotation(KotlinBuiltIns.FQ_NAMES.annotation.shortName().asString()) + public fun isAnnotation(): Boolean = + getAnnotation(KotlinBuiltIns.FQ_NAMES.annotation.shortName().asString()) != null || hasModifier(JetTokens.ANNOTATION_KEYWORD) private fun getAnnotation(name: String): JetAnnotationEntry? { return getAnnotationEntries().firstOrNull() { entry -> diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/JetFileElementType.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/JetFileElementType.java index afae7de1f1e..0d1c5e48c5a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/JetFileElementType.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/elements/JetFileElementType.java @@ -36,7 +36,7 @@ import org.jetbrains.kotlin.psi.stubs.impl.KotlinFileStubImpl; import java.io.IOException; public class JetFileElementType extends IStubFileElementType { - public static final int STUB_VERSION = 53; + public static final int STUB_VERSION = 54; private static final String NAME = "kotlin.FILE"; diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationResolver.java index bdaf2f2142e..708fd81fc09 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationResolver.java @@ -16,16 +16,17 @@ package org.jetbrains.kotlin.resolve; -import com.google.common.collect.Lists; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.kotlin.builtins.KotlinBuiltIns; import org.jetbrains.kotlin.descriptors.*; -import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor; -import org.jetbrains.kotlin.descriptors.annotations.AnnotationWithTarget; -import org.jetbrains.kotlin.descriptors.annotations.Annotations; -import org.jetbrains.kotlin.descriptors.annotations.AnnotationsImpl; +import org.jetbrains.kotlin.descriptors.annotations.*; import org.jetbrains.kotlin.diagnostics.Errors; +import org.jetbrains.kotlin.lexer.JetModifierKeywordToken; +import org.jetbrains.kotlin.lexer.JetTokens; import org.jetbrains.kotlin.psi.*; +import org.jetbrains.kotlin.resolve.annotations.*; +import org.jetbrains.kotlin.resolve.annotations.AnnotationsPackage; import org.jetbrains.kotlin.resolve.calls.CallResolver; import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument; import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults; @@ -44,7 +45,6 @@ import org.jetbrains.kotlin.types.JetType; import javax.inject.Inject; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import static org.jetbrains.kotlin.diagnostics.Errors.NOT_AN_ANNOTATION_CLASS; @@ -56,16 +56,22 @@ public class AnnotationResolver { @NotNull private TypeResolver typeResolver; @NotNull private final ConstantExpressionEvaluator constantExpressionEvaluator; + @NotNull private final List modifiersAnnotations; + public AnnotationResolver( @NotNull CallResolver callResolver, @NotNull ConstantExpressionEvaluator constantExpressionEvaluator, - @NotNull StorageManager storageManager + @NotNull StorageManager storageManager, + @NotNull KotlinBuiltIns kotlinBuiltIns ) { this.callResolver = callResolver; this.constantExpressionEvaluator = constantExpressionEvaluator; this.storageManager = storageManager; + + modifiersAnnotations = AnnotationsPackage.buildMigrationAnnotationDescriptors(kotlinBuiltIns); } + // component dependency cycle @Inject public void setTypeResolver(@NotNull TypeResolver typeResolver) { @@ -120,7 +126,29 @@ public class AnnotationResolver { List annotationEntryElements = modifierList.getAnnotationEntries(); - return resolveAnnotationEntries(scope, annotationEntryElements, trace, shouldResolveArguments); + return resolveAndAppendAnnotationsFromModifiers( + resolveAnnotationEntries(scope, annotationEntryElements, trace, shouldResolveArguments), + modifierList + ); + } + + @NotNull + public Annotations resolveAndAppendAnnotationsFromModifiers( + @NotNull Annotations annotations, + @NotNull JetModifierList modifierList + ) { + List annotationFromModifiers = new ArrayList(); + + for (int i = 0; i < JetTokens.ANNOTATION_MODIFIERS_KEYWORDS_ARRAY.length; i++) { + JetModifierKeywordToken modifier = JetTokens.ANNOTATION_MODIFIERS_KEYWORDS_ARRAY[i]; + if (modifierList.hasModifier(modifier)) { + annotationFromModifiers.add(modifiersAnnotations.get(i)); + } + } + + if (annotationFromModifiers.isEmpty()) return annotations; + + return new CompositeAnnotations(annotations, new AnnotationsImpl(annotationFromModifiers)); } private Annotations resolveAnnotationEntries( diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationUtil.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationUtil.kt index 0ad8c41647c..343be1971e5 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationUtil.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationUtil.kt @@ -16,12 +16,16 @@ package org.jetbrains.kotlin.resolve.annotations -import org.jetbrains.kotlin.descriptors.CallableDescriptor -import org.jetbrains.kotlin.descriptors.DeclarationDescriptor -import org.jetbrains.kotlin.descriptors.PropertyAccessorDescriptor +import org.jetbrains.kotlin.builtins.KotlinBuiltIns +import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor +import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptorImpl +import org.jetbrains.kotlin.descriptors.annotations.Annotations +import org.jetbrains.kotlin.lexer.JetTokens import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.DescriptorUtils +import org.jetbrains.kotlin.types.JetTypeImpl public fun DeclarationDescriptor.hasInlineAnnotation(): Boolean { return getAnnotations().findAnnotation(FqName("kotlin.inline")) != null @@ -61,3 +65,20 @@ public fun AnnotationDescriptor.argumentValue(parameterName: String): Any? { .singleOrNull { it.key.getName().asString() == parameterName } ?.value?.value } + +public fun KotlinBuiltIns.buildMigrationAnnotationDescriptors(): List = + JetTokens.ANNOTATION_MODIFIERS_KEYWORDS_ARRAY.map { + modifierKeyword -> + + val name = Name.identifier(modifierKeyword.value) + val type = JetTypeImpl.create( + Annotations.EMPTY, + getBuiltInClassByNameNullable(name) ?: getAnnotationClassByName(name), + /* nullable = */false, /* arguments = */emptyList() + ) + + AnnotationDescriptorImpl( + type, + emptyMap(), SourceElement.NO_SOURCE + ) + } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt index 4de665bb46a..77b59f673b4 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt @@ -57,7 +57,13 @@ public object ModifierCheckerCore { REIFIED_KEYWORD to EnumSet.of(TYPE_PARAMETER), VARARG_KEYWORD to EnumSet.of(VALUE_PARAMETER, PROPERTY_PARAMETER), COMPANION_KEYWORD to EnumSet.of(OBJECT), - LATE_INIT_KEYWORD to EnumSet.of(MEMBER_PROPERTY) + LATE_INIT_KEYWORD to EnumSet.of(MEMBER_PROPERTY), + DATA_KEYWORD to EnumSet.of(CLASSIFIER), + INLINE_KEYWORD to EnumSet.of(FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, PROPERTY), + NOINLINE_KEYWORD to EnumSet.of(VALUE_PARAMETER), + TAILREC_KEYWORD to EnumSet.of(FUNCTION), + EXTERNAL_KEYWORD to EnumSet.of(FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER), + ANNOTATION_KEYWORD to EnumSet.of(ANNOTATION_CLASS) ) // NOTE: redundant targets must be possible! diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/OverrideResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/OverrideResolver.java index f6eb416de9d..b3afba995e7 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/OverrideResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/OverrideResolver.java @@ -34,6 +34,7 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns; import org.jetbrains.kotlin.descriptors.*; import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor; import org.jetbrains.kotlin.incremental.components.NoLookupLocation; +import org.jetbrains.kotlin.lexer.JetToken; import org.jetbrains.kotlin.lexer.JetTokens; import org.jetbrains.kotlin.name.Name; import org.jetbrains.kotlin.psi.*; @@ -668,7 +669,7 @@ public class OverrideResolver { } private void checkOverrideForComponentFunction(@NotNull final CallableMemberDescriptor componentFunction) { - final JetAnnotationEntry dataAnnotation = findDataAnnotationForDataClass(componentFunction.getContainingDeclaration()); + final PsiElement dataAnnotation = findDataAnnotationForDataClass(componentFunction.getContainingDeclaration()); checkOverridesForMemberMarkedOverride(componentFunction, false, new CheckOverrideReportStrategy() { private boolean overrideConflict = false; @@ -712,7 +713,7 @@ public class OverrideResolver { } @NotNull - private static JetAnnotationEntry findDataAnnotationForDataClass(@NotNull DeclarationDescriptor dataClass) { + private static PsiElement findDataAnnotationForDataClass(@NotNull DeclarationDescriptor dataClass) { AnnotationDescriptor annotation = dataClass.getAnnotations().findAnnotation(KotlinBuiltIns.FQ_NAMES.data); if (annotation != null) { JetAnnotationEntry entry = DescriptorToSourceUtils.getSourceFromAnnotation(annotation); @@ -720,6 +721,16 @@ public class OverrideResolver { return entry; } } + + + JetClass classDeclaration = (JetClass) DescriptorToSourceUtils.getSourceFromDescriptor(dataClass); + if (classDeclaration != null && classDeclaration.getModifierList() != null) { + PsiElement modifier = classDeclaration.getModifierList().getModifier(JetTokens.DATA_KEYWORD); + if (modifier != null) { + return modifier; + } + } + throw new IllegalStateException("No data annotation is found for data class " + dataClass); } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/DiagnosticsWithSuppression.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/DiagnosticsWithSuppression.java index 7482867dd13..bfd7ae0b562 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/DiagnosticsWithSuppression.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/diagnostics/DiagnosticsWithSuppression.java @@ -29,6 +29,7 @@ import com.intellij.util.containers.FilteringIterator; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.TestOnly; import org.jetbrains.kotlin.builtins.KotlinBuiltIns; +import org.jetbrains.kotlin.descriptors.DeclarationDescriptor; import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor; import org.jetbrains.kotlin.diagnostics.Diagnostic; import org.jetbrains.kotlin.diagnostics.Severity; @@ -203,28 +204,42 @@ public class DiagnosticsWithSuppression implements Diagnostics { private Set getSuppressingStrings(@NotNull JetAnnotated annotated) { ImmutableSet.Builder builder = ImmutableSet.builder(); - for (JetAnnotationEntry annotationEntry : annotated.getAnnotationEntries()) { - AnnotationDescriptor annotationDescriptor = context.get(BindingContext.ANNOTATION, annotationEntry); - if (annotationDescriptor == null) continue; - for (SuppressStringProvider suppressStringProvider : ADDITIONAL_SUPPRESS_STRING_PROVIDERS.get()) { - builder.addAll(suppressStringProvider.get(annotationDescriptor)); + DeclarationDescriptor descriptor = context.get(BindingContext.DECLARATION_TO_DESCRIPTOR, annotated); + + if (descriptor != null) { + for (AnnotationDescriptor annotationDescriptor : descriptor.getAnnotations()) { + processAnnotation(builder, annotationDescriptor); } + } + else { + for (JetAnnotationEntry annotationEntry : annotated.getAnnotationEntries()) { + AnnotationDescriptor annotationDescriptor = context.get(BindingContext.ANNOTATION, annotationEntry); + processAnnotation(builder, annotationDescriptor); + } + } + return builder.build(); + } - if (!KotlinBuiltIns.isSuppressAnnotation(annotationDescriptor)) continue; + private void processAnnotation(ImmutableSet.Builder builder, AnnotationDescriptor annotationDescriptor) { + if (annotationDescriptor == null) return; - // We only add strings and skip other values to facilitate recovery in presence of erroneous code - for (ConstantValue arrayValue : annotationDescriptor.getAllValueArguments().values()) { - if ((arrayValue instanceof ArrayValue)) { - for (ConstantValue value : ((ArrayValue) arrayValue).getValue()) { - if (value instanceof StringValue) { - builder.add(String.valueOf(((StringValue) value).getValue()).toLowerCase()); - } + for (SuppressStringProvider suppressStringProvider : ADDITIONAL_SUPPRESS_STRING_PROVIDERS.get()) { + builder.addAll(suppressStringProvider.get(annotationDescriptor)); + } + + if (!KotlinBuiltIns.isSuppressAnnotation(annotationDescriptor)) return; + + // We only add strings and skip other values to facilitate recovery in presence of erroneous code + for (ConstantValue arrayValue : annotationDescriptor.getAllValueArguments().values()) { + if ((arrayValue instanceof ArrayValue)) { + for (ConstantValue value : ((ArrayValue) arrayValue).getValue()) { + if (value instanceof StringValue) { + builder.add(String.valueOf(((StringValue) value).getValue()).toLowerCase()); } } } } - return builder.build(); } public static boolean isSuppressedByStrings(@NotNull Diagnostic diagnostic, @NotNull Set strings) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java index 4e1592bb9f4..f9afb4f3860 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassDescriptor.java @@ -161,7 +161,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes }); if (modifierList != null) { - this.annotations = new LazyAnnotations( + LazyAnnotations classAnnotations = new LazyAnnotations( new LazyAnnotationsContext( c.getAnnotationResolver(), storageManager, @@ -174,8 +174,10 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes } }, modifierList.getAnnotationEntries() - ); - + ); + this.annotations = c.getAnnotationResolver().resolveAndAppendAnnotationsFromModifiers( + classAnnotations, modifierList + ); } else { this.annotations = Annotations.EMPTY; diff --git a/compiler/testData/diagnostics/tests/annotations/AnnotationIdentifier.kt b/compiler/testData/diagnostics/tests/annotations/AnnotationIdentifier.kt index 4000e9831ed..ac792e5905f 100644 --- a/compiler/testData/diagnostics/tests/annotations/AnnotationIdentifier.kt +++ b/compiler/testData/diagnostics/tests/annotations/AnnotationIdentifier.kt @@ -1,6 +1,6 @@ // FILE: a.kt -annotation class annotation +annotation class annotation // FILE: test/b.kt @@ -22,4 +22,4 @@ annotation class My kotlin.annotation.annotation class His -My class Our +My class Our \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/annotations/AnnotationIdentifier.txt b/compiler/testData/diagnostics/tests/annotations/AnnotationIdentifier.txt index bd7fed2f876..bc6206bff51 100644 --- a/compiler/testData/diagnostics/tests/annotations/AnnotationIdentifier.txt +++ b/compiler/testData/diagnostics/tests/annotations/AnnotationIdentifier.txt @@ -1,6 +1,6 @@ package -annotation() public final class annotation { +kotlin.annotation.annotation() public final class annotation : kotlin.Annotation { public constructor annotation() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/annotations/AnnotationsForClasses.txt b/compiler/testData/diagnostics/tests/annotations/AnnotationsForClasses.txt index acc441b31a2..f1ac80cb0af 100644 --- a/compiler/testData/diagnostics/tests/annotations/AnnotationsForClasses.txt +++ b/compiler/testData/diagnostics/tests/annotations/AnnotationsForClasses.txt @@ -1,6 +1,6 @@ package -kotlin.annotation.annotation() java.lang.Deprecated() public final class my : kotlin.Annotation { +java.lang.Deprecated() kotlin.annotation.annotation() public final class my : kotlin.Annotation { public constructor my() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/annotations/RecursivelyAnnotatedParameterType.kt b/compiler/testData/diagnostics/tests/annotations/RecursivelyAnnotatedParameterType.kt index 2d4d8f77a20..f3227d7dccd 100644 --- a/compiler/testData/diagnostics/tests/annotations/RecursivelyAnnotatedParameterType.kt +++ b/compiler/testData/diagnostics/tests/annotations/RecursivelyAnnotatedParameterType.kt @@ -1,3 +1,3 @@ // Class constructor parameter type CAN be recursively annotated @Target(AnnotationTarget.TYPE) -annotation class RecursivelyAnnotated(val x: @RecursivelyAnnotated(1) Int) \ No newline at end of file +annotation class RecursivelyAnnotated(val x: @RecursivelyAnnotated(1) Int) diff --git a/compiler/testData/diagnostics/tests/annotations/annotationModifier.kt b/compiler/testData/diagnostics/tests/annotations/annotationModifier.kt index 46d4acfba75..6f577a35ef1 100644 --- a/compiler/testData/diagnostics/tests/annotations/annotationModifier.kt +++ b/compiler/testData/diagnostics/tests/annotations/annotationModifier.kt @@ -1,15 +1,15 @@ annotation class B class A { - annotation companion object {} + annotation companion object {} } -annotation object O {} +annotation object O {} -annotation interface T {} +annotation interface T {} -annotation fun f() = 0 +annotation fun f() = 0 -annotation val x = 0 +annotation val x = 0 -annotation var y = 0 \ No newline at end of file +annotation var y = 0 \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/annotations/options/annotation.kt b/compiler/testData/diagnostics/tests/annotations/options/annotation.kt deleted file mode 100644 index c687573ef42..00000000000 --- a/compiler/testData/diagnostics/tests/annotations/options/annotation.kt +++ /dev/null @@ -1,16 +0,0 @@ -// Annotations used for annotations :) -enum class Target { - CLASSIFIER, - FUNCTION -} - -target(Target.CLASSIFIER) -public annotation class target(vararg val allowedTargets: Target) - -target(Target.CLASSIFIER) -public annotation(AnnotationRetention.SOURCE) class annotation( - val retention: AnnotationRetention = AnnotationRetention.RUNTIME, - val repeatable: Boolean = false -) - -annotation class some \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/annotations/options/annotation.txt b/compiler/testData/diagnostics/tests/annotations/options/annotation.txt deleted file mode 100644 index 217057b1ad6..00000000000 --- a/compiler/testData/diagnostics/tests/annotations/options/annotation.txt +++ /dev/null @@ -1,44 +0,0 @@ -package - -public final enum class Target : kotlin.Enum { - enum entry CLASSIFIER - - enum entry FUNCTION - - private constructor Target() - protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any - public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: Target): kotlin.Int - public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final override /*1*/ /*fake_override*/ fun name(): kotlin.String - public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - - // Static members - public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): Target - public final /*synthesized*/ fun values(): kotlin.Array -} - -target(allowedTargets = {Target.CLASSIFIER}) annotation(retention = AnnotationRetention.SOURCE) public final class annotation { - public constructor annotation(/*0*/ retention: kotlin.annotation.AnnotationRetention = ..., /*1*/ repeatable: kotlin.Boolean = ...) - public final val repeatable: kotlin.Boolean - public final val retention: kotlin.annotation.AnnotationRetention - 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 -} - -annotation() public final class some { - public constructor some() - 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 -} - -target(allowedTargets = {Target.CLASSIFIER}) annotation() public final class target { - public constructor target(/*0*/ vararg allowedTargets: Target /*kotlin.Array*/) - public final val allowedTargets: kotlin.Array - 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/annotations/options/brackets.kt b/compiler/testData/diagnostics/tests/annotations/options/brackets.kt deleted file mode 100644 index 303fae05cfc..00000000000 --- a/compiler/testData/diagnostics/tests/annotations/options/brackets.kt +++ /dev/null @@ -1,3 +0,0 @@ -annotation() class emptyBrackets - -emptyBrackets class base diff --git a/compiler/testData/diagnostics/tests/annotations/options/brackets.txt b/compiler/testData/diagnostics/tests/annotations/options/brackets.txt deleted file mode 100644 index 210996ced2f..00000000000 --- a/compiler/testData/diagnostics/tests/annotations/options/brackets.txt +++ /dev/null @@ -1,15 +0,0 @@ -package - -emptyBrackets() public final class base { - public constructor base() - 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.annotation() public final class emptyBrackets : kotlin.Annotation { - public constructor emptyBrackets() - 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/annotations/options/targets/accessors.kt b/compiler/testData/diagnostics/tests/annotations/options/targets/accessors.kt index 2672d2e57be..4e553bc8dc3 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/targets/accessors.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/targets/accessors.kt @@ -13,4 +13,4 @@ class My(x: Int) { @base @smartget @smartset set base smartget smartset fun foo() = y -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/annotations/options/targets/annotation.kt b/compiler/testData/diagnostics/tests/annotations/options/targets/annotation.kt index a25530e72f9..cae63886e5b 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/targets/annotation.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/targets/annotation.kt @@ -17,4 +17,4 @@ base annotation class derived return local } -base val z = 0 \ No newline at end of file +base val z = 0 diff --git a/compiler/testData/diagnostics/tests/annotations/options/targets/classifier.kt b/compiler/testData/diagnostics/tests/annotations/options/targets/classifier.kt index 7549a4cc94c..b054b543ee7 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/targets/classifier.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/targets/classifier.kt @@ -18,4 +18,4 @@ base enum class My @base constructor() { return local } -base val z = 0 \ No newline at end of file +base val z = 0 diff --git a/compiler/testData/diagnostics/tests/annotations/options/targets/constructor.kt b/compiler/testData/diagnostics/tests/annotations/options/targets/constructor.kt index 6fa9014b3ca..bfc080fcce7 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/targets/constructor.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/targets/constructor.kt @@ -17,4 +17,4 @@ return local } -base val z = 0 \ No newline at end of file +base val z = 0 diff --git a/compiler/testData/diagnostics/tests/annotations/options/targets/empty.kt b/compiler/testData/diagnostics/tests/annotations/options/targets/empty.kt index 75849e1bde8..2e1b58b1bd2 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/targets/empty.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/targets/empty.kt @@ -18,4 +18,4 @@ return local } -empty val z = @empty 0 \ No newline at end of file +empty val z = @empty 0 diff --git a/compiler/testData/diagnostics/tests/annotations/options/targets/file.kt b/compiler/testData/diagnostics/tests/annotations/options/targets/file.kt index 03826b13ea2..cdd207e8249 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/targets/file.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/targets/file.kt @@ -20,4 +20,4 @@ package test package test -common class Correct \ No newline at end of file +common class Correct diff --git a/compiler/testData/diagnostics/tests/annotations/options/targets/incorrect.kt b/compiler/testData/diagnostics/tests/annotations/options/targets/incorrect.kt index d499d8a2910..364f572f93f 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/targets/incorrect.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/targets/incorrect.kt @@ -18,4 +18,4 @@ return local } -incorrect val z = @incorrect 0 \ No newline at end of file +incorrect val z = @incorrect 0 diff --git a/compiler/testData/diagnostics/tests/annotations/options/targets/local.kt b/compiler/testData/diagnostics/tests/annotations/options/targets/local.kt index db192a51665..b67e7ec4c07 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/targets/local.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/targets/local.kt @@ -17,4 +17,4 @@ return local } -base val z = 0 \ No newline at end of file +base val z = 0 diff --git a/compiler/testData/diagnostics/tests/annotations/options/targets/nested.kt b/compiler/testData/diagnostics/tests/annotations/options/targets/nested.kt index aa94be888ad..3e1b922a6b6 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/targets/nested.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/targets/nested.kt @@ -12,4 +12,4 @@ base class Outer { fun foo() { @base @meta class Local } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/annotations/options/targets/property.kt b/compiler/testData/diagnostics/tests/annotations/options/targets/property.kt index 3a797212c78..df3d44846b0 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/targets/property.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/targets/property.kt @@ -18,4 +18,4 @@ return local } -base val z = 0 \ No newline at end of file +base val z = 0 diff --git a/compiler/testData/diagnostics/tests/annotations/options/targets/returntype.kt b/compiler/testData/diagnostics/tests/annotations/options/targets/returntype.kt index 1b37c9146ff..7eefdbe48f2 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/targets/returntype.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/targets/returntype.kt @@ -6,4 +6,4 @@ annotation class typed base class My(val x: @base @typed Int, y: @base @typed Int) { val z: @base @typed Int = y fun foo(): @base @typed Int = z -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/annotations/options/targets/type.kt b/compiler/testData/diagnostics/tests/annotations/options/targets/type.kt index e72d05f670a..5fedf5c3ebe 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/targets/type.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/targets/type.kt @@ -17,4 +17,4 @@ return local } -base val z = 0 \ No newline at end of file +base val z = 0 diff --git a/compiler/testData/diagnostics/tests/annotations/options/targets/typeargs.kt b/compiler/testData/diagnostics/tests/annotations/options/targets/typeargs.kt index 31e91705afd..88b3aee5f26 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/targets/typeargs.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/targets/typeargs.kt @@ -1,3 +1,3 @@ annotation class base -val x: List<@base String>? = null \ No newline at end of file +val x: List<@base String>? = null diff --git a/compiler/testData/diagnostics/tests/annotations/options/targets/valueparam.kt b/compiler/testData/diagnostics/tests/annotations/options/targets/valueparam.kt index a64de9ac747..d0cbff6a839 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/targets/valueparam.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/targets/valueparam.kt @@ -18,4 +18,4 @@ return local } -base val z = 0 \ No newline at end of file +base val z = 0 diff --git a/compiler/testData/diagnostics/tests/enum/enumWithAnnotationKeyword.kt b/compiler/testData/diagnostics/tests/enum/enumWithAnnotationKeyword.kt index 2405fd9523a..3cc8fc2dddd 100644 --- a/compiler/testData/diagnostics/tests/enum/enumWithAnnotationKeyword.kt +++ b/compiler/testData/diagnostics/tests/enum/enumWithAnnotationKeyword.kt @@ -1,3 +1,3 @@ -data annotation enum class E { +data annotation enum class E { D } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.kt b/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.kt index 398587e6f5f..a1282a06801 100644 --- a/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.kt +++ b/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.kt @@ -97,7 +97,7 @@ abstract class IllegalModifiers6() { class IllegalModifiers7() { enum inner - annotation + annotation out in vararg @@ -105,7 +105,7 @@ class IllegalModifiers7() { val x = 1 enum inner - annotation + annotation out in vararg @@ -119,7 +119,7 @@ class IllegalModifiers8 { enum open inner - annotation + annotation override out in @@ -143,7 +143,7 @@ class IllegalModifiers10 enum open inner -annotation +annotation override out in diff --git a/compiler/testData/diagnostics/testsWithStdLib/native/constructor.kt b/compiler/testData/diagnostics/testsWithStdLib/native/constructor.kt index 4e6c6f87545..f9102b82a17 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/native/constructor.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/native/constructor.kt @@ -1,10 +1,10 @@ class A { - external constructor() {} + external constructor() {} inner class B { - external constructor() {} + external constructor() {} } - external constructor(x: Int) + external constructor(x: Int) } -class C external constructor() \ No newline at end of file +class C external constructor() \ No newline at end of file diff --git a/compiler/testData/psi/EnumEntryCommaInlineMember.txt b/compiler/testData/psi/EnumEntryCommaInlineMember.txt index a23b81db2b5..097f02268aa 100644 --- a/compiler/testData/psi/EnumEntryCommaInlineMember.txt +++ b/compiler/testData/psi/EnumEntryCommaInlineMember.txt @@ -18,14 +18,13 @@ JetFile: EnumEntryCommaInlineMember.kt OBJECT_DECLARATION_NAME PsiElement(IDENTIFIER)('FIRST') PsiElement(COMMA)(',') - PsiWhiteSpace('\n\n ') - ENUM_ENTRY - OBJECT_DECLARATION_NAME - PsiElement(IDENTIFIER)('inline') PsiErrorElement:Expecting ';' after the last enum entry or '}' to close enum class body - PsiWhiteSpace(' ') + PsiWhiteSpace('\n\n ') FUN + MODIFIER_LIST + PsiElement(inline)('inline') + PsiWhiteSpace(' ') PsiElement(fun)('fun') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('foo') diff --git a/compiler/testData/psi/EnumEntrySemicolonInlineMember.txt b/compiler/testData/psi/EnumEntrySemicolonInlineMember.txt index c7c5b4dd21c..e0d712e96be 100644 --- a/compiler/testData/psi/EnumEntrySemicolonInlineMember.txt +++ b/compiler/testData/psi/EnumEntrySemicolonInlineMember.txt @@ -21,12 +21,7 @@ JetFile: EnumEntrySemicolonInlineMember.kt PsiWhiteSpace('\n\n ') FUN MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('inline') + PsiElement(inline)('inline') PsiWhiteSpace(' ') PsiElement(fun)('fun') PsiWhiteSpace(' ') diff --git a/compiler/testData/psi/EnumEntrySpaceInlineMember.txt b/compiler/testData/psi/EnumEntrySpaceInlineMember.txt index fb6e5a22ec6..6ca12da8cf4 100644 --- a/compiler/testData/psi/EnumEntrySpaceInlineMember.txt +++ b/compiler/testData/psi/EnumEntrySpaceInlineMember.txt @@ -22,12 +22,7 @@ JetFile: EnumEntrySpaceInlineMember.kt PsiWhiteSpace('\n\n ') FUN MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('inline') + PsiElement(inline)('inline') PsiWhiteSpace(' ') PsiElement(fun)('fun') PsiWhiteSpace(' ') diff --git a/compiler/testData/psi/EnumWithAnnotationKeyword.txt b/compiler/testData/psi/EnumWithAnnotationKeyword.txt index 7a124338c7f..5bfc06139f0 100644 --- a/compiler/testData/psi/EnumWithAnnotationKeyword.txt +++ b/compiler/testData/psi/EnumWithAnnotationKeyword.txt @@ -5,19 +5,9 @@ JetFile: EnumWithAnnotationKeyword.kt CLASS MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('data') + PsiElement(data)('data') PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') + PsiElement(annotation)('annotation') PsiWhiteSpace(' ') PsiElement(enum)('enum') PsiWhiteSpace(' ') @@ -38,12 +28,7 @@ JetFile: EnumWithAnnotationKeyword.kt MODIFIER_LIST PsiElement(enum)('enum') PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') + PsiElement(annotation)('annotation') PsiWhiteSpace(' ') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE diff --git a/compiler/testData/psi/SimpleModifiers.txt b/compiler/testData/psi/SimpleModifiers.txt index edd4da37d6c..bd4aecdfc16 100644 --- a/compiler/testData/psi/SimpleModifiers.txt +++ b/compiler/testData/psi/SimpleModifiers.txt @@ -23,12 +23,7 @@ JetFile: SimpleModifiers.kt PsiWhiteSpace('\n') PsiElement(open)('open') PsiWhiteSpace('\n') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') + PsiElement(annotation)('annotation') PsiWhiteSpace('\n') PsiElement(override)('override') PsiWhiteSpace('\n') @@ -70,12 +65,7 @@ JetFile: SimpleModifiers.kt PsiWhiteSpace('\n ') PsiElement(open)('open') PsiWhiteSpace('\n ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') + PsiElement(annotation)('annotation') PsiWhiteSpace('\n ') PsiElement(override)('override') PsiWhiteSpace('\n ') @@ -173,4 +163,4 @@ JetFile: SimpleModifiers.kt PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('lazy') PsiWhiteSpace('\n') - PsiElement(RBRACE)('}') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/SoftKeywords.txt b/compiler/testData/psi/SoftKeywords.txt index 5f52968d1cf..0597b55a955 100644 --- a/compiler/testData/psi/SoftKeywords.txt +++ b/compiler/testData/psi/SoftKeywords.txt @@ -36,12 +36,7 @@ JetFile: SoftKeywords.kt PsiWhiteSpace('\n') PsiElement(open)('open') PsiWhiteSpace('\n') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') + PsiElement(annotation)('annotation') PsiWhiteSpace('\n') PsiElement(override)('override') PsiWhiteSpace('\n') @@ -116,12 +111,7 @@ JetFile: SoftKeywords.kt PsiWhiteSpace('\n ') PsiElement(open)('open') PsiWhiteSpace('\n ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') + PsiElement(annotation)('annotation') PsiWhiteSpace('\n ') PsiElement(override)('override') PsiWhiteSpace('\n ') @@ -1172,12 +1162,7 @@ JetFile: SoftKeywords.kt PsiWhiteSpace('\n ') PsiElement(open)('open') PsiWhiteSpace('\n ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') + PsiElement(annotation)('annotation') PsiWhiteSpace('\n ') PsiElement(override)('override') PsiWhiteSpace('\n ') @@ -1563,12 +1548,7 @@ JetFile: SoftKeywords.kt PsiWhiteSpace('\n ') PsiElement(open)('open') PsiWhiteSpace('\n ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') + PsiElement(annotation)('annotation') PsiWhiteSpace('\n ') PsiElement(override)('override') PsiWhiteSpace('\n ') diff --git a/compiler/testData/psi/annotation/Annotations.txt b/compiler/testData/psi/annotation/Annotations.txt index 863e9201d08..5deb5c082cb 100644 --- a/compiler/testData/psi/annotation/Annotations.txt +++ b/compiler/testData/psi/annotation/Annotations.txt @@ -25,12 +25,7 @@ JetFile: Annotations.kt PsiWhiteSpace('\n') PsiElement(open)('open') PsiWhiteSpace('\n') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') + PsiElement(annotation)('annotation') PsiWhiteSpace('\n') PsiElement(override)('override') PsiWhiteSpace('\n') @@ -271,12 +266,7 @@ JetFile: Annotations.kt PsiWhiteSpace('\n') PsiElement(open)('open') PsiWhiteSpace('\n') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') + PsiElement(annotation)('annotation') PsiWhiteSpace('\n') PsiElement(override)('override') PsiWhiteSpace('\n') @@ -346,4 +336,4 @@ JetFile: Annotations.kt CLASS_BODY PsiElement(LBRACE)('{') PsiWhiteSpace('\n') - PsiElement(RBRACE)('}') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/Annotations_ERR.txt b/compiler/testData/psi/annotation/Annotations_ERR.txt index 48b229fc3e5..e5821ea98c4 100644 --- a/compiler/testData/psi/annotation/Annotations_ERR.txt +++ b/compiler/testData/psi/annotation/Annotations_ERR.txt @@ -25,12 +25,7 @@ JetFile: Annotations_ERR.kt PsiWhiteSpace('\n') PsiElement(open)('open') PsiWhiteSpace('\n') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') + PsiElement(annotation)('annotation') PsiWhiteSpace('\n') PsiElement(override)('override') PsiWhiteSpace('\n') @@ -226,12 +221,7 @@ JetFile: Annotations_ERR.kt PsiWhiteSpace('\n') PsiElement(open)('open') PsiWhiteSpace('\n') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') + PsiElement(annotation)('annotation') PsiWhiteSpace('\n') PsiElement(override)('override') PsiWhiteSpace('\n') @@ -301,4 +291,4 @@ JetFile: Annotations_ERR.kt CLASS_BODY PsiElement(LBRACE)('{') PsiWhiteSpace('\n') - PsiElement(RBRACE)('}') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/forParameters.txt b/compiler/testData/psi/annotation/forParameters.txt index e65c5b56cfc..d025459bc3f 100644 --- a/compiler/testData/psi/annotation/forParameters.txt +++ b/compiler/testData/psi/annotation/forParameters.txt @@ -109,12 +109,7 @@ JetFile: forParameters.kt MODIFIER_LIST PsiElement(private)('private') PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('data') + PsiElement(data)('data') PsiWhiteSpace(' ') ANNOTATION_ENTRY PsiElement(AT)('@') @@ -525,4 +520,4 @@ JetFile: forParameters.kt PsiElement(LBRACE)('{') PsiElement(RBRACE)('}') PsiWhiteSpace('\n') - PsiElement(RBRACE)('}') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/modifiersMigration/newModifiers.kt b/compiler/testData/psi/annotation/modifiersMigration/newModifiers.kt new file mode 100644 index 00000000000..85ae1f4972b --- /dev/null +++ b/compiler/testData/psi/annotation/modifiersMigration/newModifiers.kt @@ -0,0 +1,60 @@ +data annotation tailrec external noinline fun bar(data x: Int) { + data inline noinline class A + + inline fun foo() {} + + noinline val x1 = 1 + + data(); + + val x2 = 2 + + data; + + val x3 = 3 + + inline + + + private + val x4 = 4 + + abstract + + data + + class Q +} + + +fun foo1() { + data() + + inline data annotation // infix call +} + +fun foo2() { + data { + + } + + inline(data) { + + } +} + + +public data inline class A { + val x: Int + inline data set + noinline get + + val y: String + inline get() = 1 + data set(q: Int) = 2 + + val z: Double inline get noinline set + + val z0: Double = 3.0 + inline get noinline set +} diff --git a/compiler/testData/psi/annotation/modifiersMigration/newModifiers.txt b/compiler/testData/psi/annotation/modifiersMigration/newModifiers.txt new file mode 100644 index 00000000000..5e713b5fae3 --- /dev/null +++ b/compiler/testData/psi/annotation/modifiersMigration/newModifiers.txt @@ -0,0 +1,352 @@ +JetFile: newModifiers.kt + PACKAGE_DIRECTIVE + + IMPORT_LIST + + FUN + MODIFIER_LIST + PsiElement(data)('data') + PsiWhiteSpace(' ') + PsiElement(annotation)('annotation') + PsiWhiteSpace(' ') + PsiElement(tailrec)('tailrec') + PsiWhiteSpace(' ') + PsiElement(external)('external') + PsiWhiteSpace(' ') + PsiElement(noinline)('noinline') + PsiWhiteSpace(' ') + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('bar') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + MODIFIER_LIST + PsiElement(data)('data') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('x') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + CLASS + MODIFIER_LIST + PsiElement(data)('data') + PsiWhiteSpace(' ') + PsiElement(inline)('inline') + PsiWhiteSpace(' ') + PsiElement(noinline)('noinline') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace('\n\n ') + FUN + MODIFIER_LIST + PsiElement(inline)('inline') + PsiWhiteSpace(' ') + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n ') + PROPERTY + MODIFIER_LIST + PsiElement(noinline)('noinline') + PsiWhiteSpace(' ') + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('x1') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace('\n\n ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('data') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiElement(SEMICOLON)(';') + PsiWhiteSpace('\n\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('x2') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('2') + PsiWhiteSpace('\n\n ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('data') + PsiElement(SEMICOLON)(';') + PsiWhiteSpace('\n\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('x3') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('3') + PsiWhiteSpace('\n\n ') + PROPERTY + MODIFIER_LIST + PsiElement(inline)('inline') + PsiWhiteSpace('\n\n\n ') + PsiElement(private)('private') + PsiWhiteSpace('\n ') + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('x4') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('4') + PsiWhiteSpace('\n\n ') + CLASS + MODIFIER_LIST + PsiElement(abstract)('abstract') + PsiWhiteSpace('\n\n ') + PsiElement(data)('data') + PsiWhiteSpace('\n\n ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Q') + PsiWhiteSpace('\n') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo1') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('data') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n\n ') + BINARY_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('inline') + PsiWhiteSpace(' ') + OPERATION_REFERENCE + PsiElement(IDENTIFIER)('data') + PsiWhiteSpace(' ') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('annotation') + PsiWhiteSpace(' ') + PsiComment(EOL_COMMENT)('// infix call') + PsiWhiteSpace('\n') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n') + FUN + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo2') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('data') + PsiWhiteSpace(' ') + FUNCTION_LITERAL_ARGUMENT + FUNCTION_LITERAL_EXPRESSION + FUNCTION_LITERAL + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n ') + BLOCK + + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n ') + CALL_EXPRESSION + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('inline') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('data') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + FUNCTION_LITERAL_ARGUMENT + FUNCTION_LITERAL_EXPRESSION + FUNCTION_LITERAL + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n ') + BLOCK + + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n\n') + CLASS + MODIFIER_LIST + PsiElement(public)('public') + PsiWhiteSpace(' ') + PsiElement(data)('data') + PsiWhiteSpace(' ') + PsiElement(inline)('inline') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('x') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiWhiteSpace('\n ') + PROPERTY_ACCESSOR + MODIFIER_LIST + PsiElement(inline)('inline') + PsiWhiteSpace(' ') + PsiElement(data)('data') + PsiWhiteSpace(' ') + PsiElement(set)('set') + PsiWhiteSpace('\n ') + PROPERTY_ACCESSOR + MODIFIER_LIST + PsiElement(noinline)('noinline') + PsiWhiteSpace(' ') + PsiElement(get)('get') + PsiWhiteSpace('\n\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('y') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('String') + PsiWhiteSpace('\n ') + PROPERTY_ACCESSOR + MODIFIER_LIST + PsiElement(inline)('inline') + PsiWhiteSpace(' ') + PsiElement(get)('get') + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiWhiteSpace('\n ') + PROPERTY_ACCESSOR + MODIFIER_LIST + PsiElement(data)('data') + PsiWhiteSpace(' ') + PsiElement(set)('set') + PsiElement(LPAR)('(') + VALUE_PARAMETER_LIST + VALUE_PARAMETER + PsiElement(IDENTIFIER)('q') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('2') + PsiWhiteSpace('\n\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('z') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Double') + PsiWhiteSpace(' ') + PROPERTY_ACCESSOR + MODIFIER_LIST + PsiElement(inline)('inline') + PsiWhiteSpace(' ') + PsiElement(get)('get') + PsiWhiteSpace(' ') + PROPERTY_ACCESSOR + MODIFIER_LIST + PsiElement(noinline)('noinline') + PsiWhiteSpace(' ') + PsiElement(set)('set') + PsiWhiteSpace('\n\n ') + PROPERTY + PsiElement(val)('val') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('z0') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Double') + PsiWhiteSpace(' ') + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + FLOAT_CONSTANT + PsiElement(FLOAT_CONSTANT)('3.0') + PsiWhiteSpace('\n ') + PROPERTY_ACCESSOR + MODIFIER_LIST + PsiElement(inline)('inline') + PsiWhiteSpace(' ') + PsiElement(get)('get') + PsiWhiteSpace(' ') + PROPERTY_ACCESSOR + MODIFIER_LIST + PsiElement(noinline)('noinline') + PsiWhiteSpace(' ') + PsiElement(set)('set') + PsiWhiteSpace('\n') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/modifiersMigration/oldUsages.kt b/compiler/testData/psi/annotation/modifiersMigration/oldUsages.kt new file mode 100644 index 00000000000..bf0d15d426d --- /dev/null +++ b/compiler/testData/psi/annotation/modifiersMigration/oldUsages.kt @@ -0,0 +1,9 @@ +@inline @tailrec class A { + @inline(1) fun foo() { + + } + + kotlin.inline fun bar() { + @kotlin.data() class Local + } +} diff --git a/compiler/testData/psi/annotation/modifiersMigration/oldUsages.txt b/compiler/testData/psi/annotation/modifiersMigration/oldUsages.txt new file mode 100644 index 00000000000..8642fd20e75 --- /dev/null +++ b/compiler/testData/psi/annotation/modifiersMigration/oldUsages.txt @@ -0,0 +1,105 @@ +JetFile: oldUsages.kt + PACKAGE_DIRECTIVE + + IMPORT_LIST + + CLASS + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('inline') + PsiWhiteSpace(' ') + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('tailrec') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('A') + PsiWhiteSpace(' ') + CLASS_BODY + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + FUN + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('inline') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + VALUE_ARGUMENT + INTEGER_CONSTANT + PsiElement(INTEGER_LITERAL)('1') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('foo') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n\n ') + FUN + MODIFIER_LIST + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('kotlin') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('inline') + PsiWhiteSpace(' ') + PsiElement(fun)('fun') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('bar') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + BLOCK + PsiElement(LBRACE)('{') + PsiWhiteSpace('\n ') + CLASS + MODIFIER_LIST + ANNOTATION_ENTRY + PsiElement(AT)('@') + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('kotlin') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('data') + VALUE_ARGUMENT_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(class)('class') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('Local') + PsiWhiteSpace('\n ') + PsiElement(RBRACE)('}') + PsiWhiteSpace('\n') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/multiDeclaration.txt b/compiler/testData/psi/annotation/multiDeclaration.txt index 5b7910204cd..486776b1d84 100644 --- a/compiler/testData/psi/annotation/multiDeclaration.txt +++ b/compiler/testData/psi/annotation/multiDeclaration.txt @@ -26,12 +26,7 @@ JetFile: multiDeclaration.kt MODIFIER_LIST PsiElement(private)('private') PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('data') + PsiElement(data)('data') PsiWhiteSpace(' ') ANNOTATION_ENTRY PsiElement(AT)('@') @@ -160,4 +155,4 @@ JetFile: multiDeclaration.kt INTEGER_CONSTANT PsiElement(INTEGER_LITERAL)('1') PsiWhiteSpace('\n') - PsiElement(RBRACE)('}') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/oldAnnotationsRecovery.txt b/compiler/testData/psi/annotation/oldAnnotationsRecovery.txt index 868086ec147..ee2fc7ca528 100644 --- a/compiler/testData/psi/annotation/oldAnnotationsRecovery.txt +++ b/compiler/testData/psi/annotation/oldAnnotationsRecovery.txt @@ -6,18 +6,13 @@ JetFile: oldAnnotationsRecovery.kt PsiErrorElement:Expecting a top level declaration PsiElement(LBRACKET)('[') MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('data') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('1') - PsiElement(RPAR)(')') + PsiElement(data)('data') + PsiErrorElement:Expecting a top level declaration + PsiElement(LPAR)('(') + PsiErrorElement:Expecting a top level declaration + PsiElement(INTEGER_LITERAL)('1') + PsiErrorElement:Expecting a top level declaration + PsiElement(RPAR)(')') PsiErrorElement:Expecting a top level declaration PsiElement(RBRACKET)(']') PsiWhiteSpace(' ') diff --git a/compiler/testData/psi/annotation/options/annotAsArgComplex.kt b/compiler/testData/psi/annotation/options/annotAsArgComplex.kt deleted file mode 100644 index 87da177827e..00000000000 --- a/compiler/testData/psi/annotation/options/annotAsArgComplex.kt +++ /dev/null @@ -1,9 +0,0 @@ -class Annotation { - fun setProblemGroup() {} - fun getQuickFixes() = 0 -} - -fun registerQuickFix(annot: Annotation) { - annot.setProblemGroup() - val fixes = annot.getQuickFixes() -} diff --git a/compiler/testData/psi/annotation/options/annotAsArgComplex.txt b/compiler/testData/psi/annotation/options/annotAsArgComplex.txt deleted file mode 100644 index ac790f3733a..00000000000 --- a/compiler/testData/psi/annotation/options/annotAsArgComplex.txt +++ /dev/null @@ -1,89 +0,0 @@ -JetFile: annotAsArgComplex.kt - PACKAGE_DIRECTIVE - - IMPORT_LIST - - CLASS - PsiElement(class)('class') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('Annotation') - PsiWhiteSpace(' ') - CLASS_BODY - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - FUN - PsiElement(fun)('fun') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('setProblemGroup') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - BLOCK - PsiElement(LBRACE)('{') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n ') - FUN - PsiElement(fun)('fun') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('getQuickFixes') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - INTEGER_CONSTANT - PsiElement(INTEGER_LITERAL)('0') - PsiWhiteSpace('\n') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n\n') - FUN - PsiElement(fun)('fun') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('registerQuickFix') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('annot') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Annotation') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - BLOCK - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annot') - PsiElement(DOT)('.') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('setProblemGroup') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n ') - PROPERTY - PsiElement(val)('val') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('fixes') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annot') - PsiElement(DOT)('.') - CALL_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('getQuickFixes') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n') - PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/options/annotation.kt b/compiler/testData/psi/annotation/options/annotation.kt deleted file mode 100644 index 05e089a8935..00000000000 --- a/compiler/testData/psi/annotation/options/annotation.kt +++ /dev/null @@ -1,20 +0,0 @@ -// Annotations used for annotations :) -enum class Target { - CLASSIFIER, - FUNCTION -} - -enum class Retention { - SOURCE, - BINARY, - RUNTIME -} - -target(Target.CLASSIFIER) -public annotation class target(vararg val allowedTargets: Target) - -target(Target.CLASSIFIER) -public annotation(Retention.SOURCE) class annotation( - val retention: Retention = Retention.RUNTIME, - val repeatable: Boolean = false -) diff --git a/compiler/testData/psi/annotation/options/annotation.txt b/compiler/testData/psi/annotation/options/annotation.txt deleted file mode 100644 index b9815410cf1..00000000000 --- a/compiler/testData/psi/annotation/options/annotation.txt +++ /dev/null @@ -1,188 +0,0 @@ -JetFile: annotation.kt - PACKAGE_DIRECTIVE - - IMPORT_LIST - - CLASS - PsiComment(EOL_COMMENT)('// Annotations used for annotations :)') - PsiWhiteSpace('\n') - MODIFIER_LIST - PsiElement(enum)('enum') - PsiWhiteSpace(' ') - PsiElement(class)('class') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('Target') - PsiWhiteSpace(' ') - CLASS_BODY - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - ENUM_ENTRY - OBJECT_DECLARATION_NAME - PsiElement(IDENTIFIER)('CLASSIFIER') - PsiElement(COMMA)(',') - PsiWhiteSpace('\n ') - ENUM_ENTRY - OBJECT_DECLARATION_NAME - PsiElement(IDENTIFIER)('FUNCTION') - PsiWhiteSpace('\n') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n\n') - CLASS - MODIFIER_LIST - PsiElement(enum)('enum') - PsiWhiteSpace(' ') - PsiElement(class)('class') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('Retention') - PsiWhiteSpace(' ') - CLASS_BODY - PsiElement(LBRACE)('{') - PsiWhiteSpace('\n ') - ENUM_ENTRY - OBJECT_DECLARATION_NAME - PsiElement(IDENTIFIER)('SOURCE') - PsiElement(COMMA)(',') - PsiWhiteSpace('\n ') - ENUM_ENTRY - OBJECT_DECLARATION_NAME - PsiElement(IDENTIFIER)('BINARY') - PsiElement(COMMA)(',') - PsiWhiteSpace('\n ') - ENUM_ENTRY - OBJECT_DECLARATION_NAME - PsiElement(IDENTIFIER)('RUNTIME') - PsiWhiteSpace('\n') - PsiElement(RBRACE)('}') - PsiWhiteSpace('\n\n') - CLASS - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('target') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Target') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('CLASSIFIER') - PsiElement(RPAR)(')') - PsiWhiteSpace(' \n') - PsiElement(public)('public') - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') - PsiWhiteSpace(' ') - PsiElement(class)('class') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('target') - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - MODIFIER_LIST - PsiElement(vararg)('vararg') - PsiWhiteSpace(' ') - PsiElement(val)('val') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('allowedTargets') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Target') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n\n') - CLASS - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('target') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Target') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('CLASSIFIER') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n') - PsiElement(public)('public') - PsiWhiteSpace(' ') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Retention') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('SOURCE') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(class)('class') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('annotation') - PRIMARY_CONSTRUCTOR - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiWhiteSpace('\n ') - VALUE_PARAMETER - PsiElement(val)('val') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('retention') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Retention') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Retention') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('RUNTIME') - PsiElement(COMMA)(',') - PsiWhiteSpace('\n ') - VALUE_PARAMETER - PsiElement(val)('val') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('repeatable') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Boolean') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - BOOLEAN_CONSTANT - PsiElement(false)('false') - PsiWhiteSpace('\n') - PsiElement(RPAR)(')') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/options/java.txt b/compiler/testData/psi/annotation/options/java.txt index 7609d622a01..a90fc1bcb8e 100644 --- a/compiler/testData/psi/annotation/options/java.txt +++ b/compiler/testData/psi/annotation/options/java.txt @@ -20,12 +20,7 @@ JetFile: java.kt PsiWhiteSpace('\n\n') CLASS MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') + PsiElement(annotation)('annotation') PsiWhiteSpace(' \n') ANNOTATION_ENTRY PsiElement(AT)('@') @@ -63,12 +58,7 @@ JetFile: java.kt PsiWhiteSpace('\n\n') CLASS MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') + PsiElement(annotation)('annotation') PsiWhiteSpace(' \n') ANNOTATION_ENTRY CONSTRUCTOR_CALLEE diff --git a/compiler/testData/psi/annotation/options/options.kt b/compiler/testData/psi/annotation/options/options.kt deleted file mode 100644 index 0cbf31c14c2..00000000000 --- a/compiler/testData/psi/annotation/options/options.kt +++ /dev/null @@ -1,12 +0,0 @@ -annotation class base - -annotation() class empty - -annotation(repeatable = true) class ann - -annotation(Retention.BINARY, false) class ann2 - -annotation(retention = Retention.RUNTIME) class ann3 - -@Target(Target.FUNCTION, Target.CLASSIFIER, Target.EXPRESSION) -annotation(Retention.SOURCE) class ann4 \ No newline at end of file diff --git a/compiler/testData/psi/annotation/options/options.txt b/compiler/testData/psi/annotation/options/options.txt deleted file mode 100644 index dd5c4902909..00000000000 --- a/compiler/testData/psi/annotation/options/options.txt +++ /dev/null @@ -1,174 +0,0 @@ -JetFile: options.kt - PACKAGE_DIRECTIVE - - IMPORT_LIST - - CLASS - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') - PsiWhiteSpace(' ') - PsiElement(class)('class') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('base') - PsiWhiteSpace('\n\n') - CLASS - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(class)('class') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('empty') - PsiWhiteSpace('\n\n') - CLASS - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - VALUE_ARGUMENT_NAME - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('repeatable') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - BOOLEAN_CONSTANT - PsiElement(true)('true') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(class)('class') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('ann') - PsiWhiteSpace('\n\n') - CLASS - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Retention') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('BINARY') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - BOOLEAN_CONSTANT - PsiElement(false)('false') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(class)('class') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('ann2') - PsiWhiteSpace('\n\n') - CLASS - MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - VALUE_ARGUMENT_NAME - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('retention') - PsiWhiteSpace(' ') - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Retention') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('RUNTIME') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(class)('class') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('ann3') - PsiWhiteSpace('\n\n') - CLASS - MODIFIER_LIST - ANNOTATION_ENTRY - PsiElement(AT)('@') - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Target') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Target') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('FUNCTION') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Target') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('CLASSIFIER') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - VALUE_ARGUMENT - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Target') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('EXPRESSION') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') - VALUE_ARGUMENT_LIST - PsiElement(LPAR)('(') - VALUE_ARGUMENT - DOT_QUALIFIED_EXPRESSION - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Retention') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('SOURCE') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(class)('class') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('ann4') \ No newline at end of file diff --git a/compiler/testData/psi/annotation/targeted/onFile/withoutFileAnnotationAndPackageDeclaration.txt b/compiler/testData/psi/annotation/targeted/onFile/withoutFileAnnotationAndPackageDeclaration.txt index 5ff571a1866..1e38eddf395 100644 --- a/compiler/testData/psi/annotation/targeted/onFile/withoutFileAnnotationAndPackageDeclaration.txt +++ b/compiler/testData/psi/annotation/targeted/onFile/withoutFileAnnotationAndPackageDeclaration.txt @@ -35,13 +35,8 @@ JetFile: withoutFileAnnotationAndPackageDeclaration.kt PsiWhiteSpace('\n\n') CLASS MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('annotation') + PsiElement(annotation)('annotation') PsiWhiteSpace(' ') PsiElement(class)('class') PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('ann') + PsiElement(IDENTIFIER)('ann') \ No newline at end of file diff --git a/compiler/testData/psi/examples/With.txt b/compiler/testData/psi/examples/With.txt index c2a73f94034..b10c2514dea 100644 --- a/compiler/testData/psi/examples/With.txt +++ b/compiler/testData/psi/examples/With.txt @@ -5,12 +5,7 @@ JetFile: With.kt FUN MODIFIER_LIST - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('inline') + PsiElement(inline)('inline') PsiWhiteSpace(' ') PsiElement(fun)('fun') PsiWhiteSpace(' ') @@ -187,4 +182,4 @@ JetFile: With.kt PsiElement(LPAR)('(') PsiElement(RPAR)(')') PsiWhiteSpace('\n\n') - PsiElement(RBRACE)('}') + PsiElement(RBRACE)('}') \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java index 8d40193c90f..5f49f886b43 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java @@ -1004,12 +1004,6 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/annotations/options"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("annotation.kt") - public void testAnnotation() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/annotation.kt"); - doTest(fileName); - } - @TestMetadata("annotationAsArg.kt") public void testAnnotationAsArg() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/annotationAsArg.kt"); @@ -1022,12 +1016,6 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest(fileName); } - @TestMetadata("brackets.kt") - public void testBrackets() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/brackets.kt"); - doTest(fileName); - } - @TestMetadata("documented.kt") public void testDocumented() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/documented.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/parsing/JetParsingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/parsing/JetParsingTestGenerated.java index 099cf41a833..7ea19fead91 100644 --- a/compiler/tests/org/jetbrains/kotlin/parsing/JetParsingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/parsing/JetParsingTestGenerated.java @@ -891,6 +891,27 @@ public class JetParsingTestGenerated extends AbstractJetParsingTest { } } + @TestMetadata("compiler/testData/psi/annotation/modifiersMigration") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ModifiersMigration extends AbstractJetParsingTest { + public void testAllFilesPresentInModifiersMigration() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/psi/annotation/modifiersMigration"), Pattern.compile("^(.*)\\.kts?$"), true); + } + + @TestMetadata("newModifiers.kt") + public void testNewModifiers() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/modifiersMigration/newModifiers.kt"); + doParsingTest(fileName); + } + + @TestMetadata("oldUsages.kt") + public void testOldUsages() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/modifiersMigration/oldUsages.kt"); + doParsingTest(fileName); + } + } + @TestMetadata("compiler/testData/psi/annotation/options") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -899,18 +920,6 @@ public class JetParsingTestGenerated extends AbstractJetParsingTest { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/psi/annotation/options"), Pattern.compile("^(.*)\\.kts?$"), true); } - @TestMetadata("annotAsArgComplex.kt") - public void testAnnotAsArgComplex() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/options/annotAsArgComplex.kt"); - doParsingTest(fileName); - } - - @TestMetadata("annotation.kt") - public void testAnnotation() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/options/annotation.kt"); - doParsingTest(fileName); - } - @TestMetadata("annotationAsArg.kt") public void testAnnotationAsArg() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/options/annotationAsArg.kt"); @@ -934,12 +943,6 @@ public class JetParsingTestGenerated extends AbstractJetParsingTest { String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/options/local.kt"); doParsingTest(fileName); } - - @TestMetadata("options.kt") - public void testOptions() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/options/options.kt"); - doParsingTest(fileName); - } } @TestMetadata("compiler/testData/psi/annotation/targeted") diff --git a/core/descriptors/src/org/jetbrains/kotlin/builtins/KotlinBuiltIns.java b/core/descriptors/src/org/jetbrains/kotlin/builtins/KotlinBuiltIns.java index c60f34ea41c..a9a1f3f43c5 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/builtins/KotlinBuiltIns.java +++ b/core/descriptors/src/org/jetbrains/kotlin/builtins/KotlinBuiltIns.java @@ -247,7 +247,7 @@ public class KotlinBuiltIns { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @NotNull - private ClassDescriptor getAnnotationClassByName(@NotNull Name simpleName) { + public ClassDescriptor getAnnotationClassByName(@NotNull Name simpleName) { ClassifierDescriptor classifier = annotationPackageFragment.getMemberScope().getClassifier(simpleName, NoLookupLocation.FROM_BUILTINS); assert classifier instanceof ClassDescriptor : "Must be a class descriptor " + simpleName + ", but was " + diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/annotationUtil.kt b/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/annotationUtil.kt new file mode 100644 index 00000000000..f73c66babed --- /dev/null +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/annotationUtil.kt @@ -0,0 +1,23 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.descriptors.annotations + +import org.jetbrains.kotlin.name.FqName + +// Please synchronize this set with JetTokens.ANNOTATION_MODIFIERS_KEYWORDS_ARRAY +public val ANNOTATION_MODIFIERS_FQ_NAMES: Set = + arrayOf("data", "inline", "noinline", "tailrec", "external", "annotation.annotation").map { FqName("kotlin.$it") }.toSet() diff --git a/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt b/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt index 1ce68202c76..9fc8be4d233 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt @@ -18,6 +18,7 @@ package org.jetbrains.kotlin.renderer import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.descriptors.annotations.ANNOTATION_MODIFIERS_FQ_NAMES import org.jetbrains.kotlin.descriptors.annotations.Annotated import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget @@ -30,6 +31,7 @@ import org.jetbrains.kotlin.resolve.constants.AnnotationValue import org.jetbrains.kotlin.resolve.constants.ArrayValue import org.jetbrains.kotlin.resolve.constants.ConstantValue import org.jetbrains.kotlin.resolve.constants.KClassValue +import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe import org.jetbrains.kotlin.resolve.descriptorUtil.hasDefaultValue import org.jetbrains.kotlin.types.* import org.jetbrains.kotlin.types.ErrorUtils.UninferredParameterTypeConstructor @@ -342,7 +344,12 @@ internal class DescriptorRendererImpl( var hasTargetedAnnotations = false val annotationsBuilder = StringBuilder { - for ((annotation, target) in annotated.getAnnotations().getAllAnnotations()) { + // Sort is needed just to fix some order when annotations resolved from modifiers + // See AnnotationResolver.resolveAndAppendAnnotationsFromModifiers for clarification + // This hack can be removed when modifiers will be resolved without annotations + + val sortedAnnotations = annotated.getAnnotations().getAllAnnotations().sortedBy { p -> p.annotation.isBuiltinModifier() } + for ((annotation, target) in sortedAnnotations) { val annotationClass = annotation.getType().getConstructor().getDeclarationDescriptor() as ClassDescriptor if (!excluded.contains(DescriptorUtils.getFqNameSafe(annotationClass))) { @@ -367,6 +374,9 @@ internal class DescriptorRendererImpl( } } + private fun AnnotationDescriptor.isBuiltinModifier() + = (type.constructor.declarationDescriptor as ClassDescriptor).fqNameSafe in ANNOTATION_MODIFIERS_FQ_NAMES + override fun renderAnnotation(annotation: AnnotationDescriptor, target: AnnotationUseSiteTarget?): String { return StringBuilder { if (target != null) { diff --git a/idea/idea-completion/testData/keywords/AfterClassProperty.kt b/idea/idea-completion/testData/keywords/AfterClassProperty.kt index 6e046108750..6589fa488f5 100644 --- a/idea/idea-completion/testData/keywords/AfterClassProperty.kt +++ b/idea/idea-completion/testData/keywords/AfterClassProperty.kt @@ -36,4 +36,10 @@ class MouseMovedEventArgs // EXIST: companion object // EXIST: sealed // EXIST: lateinit +// EXIST: data +// EXIST: inline +// EXIST: noinline +// EXIST: tailrec +// EXIST: external +// EXIST: annotation // NOTHING_ELSE diff --git a/idea/idea-completion/testData/keywords/AfterClasses.kt b/idea/idea-completion/testData/keywords/AfterClasses.kt index 7c41e063ed9..f4e25d7aadf 100644 --- a/idea/idea-completion/testData/keywords/AfterClasses.kt +++ b/idea/idea-completion/testData/keywords/AfterClasses.kt @@ -39,5 +39,11 @@ class B { // EXIST: companion object // EXIST: sealed // EXIST: lateinit +// EXIST: data +// EXIST: inline +// EXIST: noinline +// EXIST: tailrec +// EXIST: external +// EXIST: annotation /*TODO*/ // NOTHING_ELSE diff --git a/idea/idea-completion/testData/keywords/AfterFuns.kt b/idea/idea-completion/testData/keywords/AfterFuns.kt index 5cc1b77316d..705fecf76e4 100644 --- a/idea/idea-completion/testData/keywords/AfterFuns.kt +++ b/idea/idea-completion/testData/keywords/AfterFuns.kt @@ -39,4 +39,10 @@ class A { // EXIST: companion object // EXIST: sealed // EXIST: lateinit +// EXIST: data +// EXIST: inline +// EXIST: noinline +// EXIST: tailrec +// EXIST: external +// EXIST: annotation // NOTHING_ELSE diff --git a/idea/idea-completion/testData/keywords/GlobalPropertyAccessors.kt b/idea/idea-completion/testData/keywords/GlobalPropertyAccessors.kt index fd01faf53e2..affef029778 100644 --- a/idea/idea-completion/testData/keywords/GlobalPropertyAccessors.kt +++ b/idea/idea-completion/testData/keywords/GlobalPropertyAccessors.kt @@ -39,5 +39,11 @@ var a : Int // EXIST: companion object // EXIST: sealed // EXIST: lateinit +// EXIST: data +// EXIST: inline +// EXIST: noinline +// EXIST: tailrec +// EXIST: external +// EXIST: annotation /*TODO*/ // NOTHING_ELSE diff --git a/idea/idea-completion/testData/keywords/InClassBeforeFun.kt b/idea/idea-completion/testData/keywords/InClassBeforeFun.kt index 3759955ad03..29f21795145 100644 --- a/idea/idea-completion/testData/keywords/InClassBeforeFun.kt +++ b/idea/idea-completion/testData/keywords/InClassBeforeFun.kt @@ -37,4 +37,10 @@ public class Test { // EXIST: companion object // EXIST: sealed // EXIST: lateinit +// EXIST: data +// EXIST: inline +// EXIST: noinline +// EXIST: tailrec +// EXIST: external +// EXIST: annotation // NOTHING_ELSE diff --git a/idea/idea-completion/testData/keywords/InClassScope.kt b/idea/idea-completion/testData/keywords/InClassScope.kt index 4ac6c6a13eb..97ac5c8cd30 100644 --- a/idea/idea-completion/testData/keywords/InClassScope.kt +++ b/idea/idea-completion/testData/keywords/InClassScope.kt @@ -31,4 +31,10 @@ class TestClass { // EXIST: companion object // EXIST: sealed // EXIST: lateinit +// EXIST: data +// EXIST: inline +// EXIST: noinline +// EXIST: tailrec +// EXIST: external +// EXIST: annotation // NOTHING_ELSE diff --git a/idea/idea-completion/testData/keywords/InTopScopeAfterPackage.kt b/idea/idea-completion/testData/keywords/InTopScopeAfterPackage.kt index 5da4807ab10..aa4f91728a6 100644 --- a/idea/idea-completion/testData/keywords/InTopScopeAfterPackage.kt +++ b/idea/idea-completion/testData/keywords/InTopScopeAfterPackage.kt @@ -30,5 +30,11 @@ package Test // EXIST: companion object // EXIST: sealed // EXIST: lateinit +// EXIST: data +// EXIST: inline +// EXIST: noinline +// EXIST: tailrec +// EXIST: external +// EXIST: annotation /*TODO*/ // NOTHING_ELSE diff --git a/idea/idea-completion/testData/keywords/PropertyAccessors.kt b/idea/idea-completion/testData/keywords/PropertyAccessors.kt index 6de811c7ebe..79627e5157c 100644 --- a/idea/idea-completion/testData/keywords/PropertyAccessors.kt +++ b/idea/idea-completion/testData/keywords/PropertyAccessors.kt @@ -35,4 +35,10 @@ class Some { // EXIST: companion object // EXIST: sealed // EXIST: lateinit +// EXIST: data +// EXIST: inline +// EXIST: noinline +// EXIST: tailrec +// EXIST: external +// EXIST: annotation // NOTHING_ELSE diff --git a/idea/idea-completion/testData/keywords/PropertyAccessors2.kt b/idea/idea-completion/testData/keywords/PropertyAccessors2.kt index a339a66b8ee..0917d6002cb 100644 --- a/idea/idea-completion/testData/keywords/PropertyAccessors2.kt +++ b/idea/idea-completion/testData/keywords/PropertyAccessors2.kt @@ -35,4 +35,10 @@ class Some { // EXIST: companion object // EXIST: sealed // EXIST: lateinit +// EXIST: data +// EXIST: inline +// EXIST: noinline +// EXIST: tailrec +// EXIST: external +// EXIST: annotation // NOTHING_ELSE diff --git a/idea/idea-completion/testData/keywords/PropertySetter.kt b/idea/idea-completion/testData/keywords/PropertySetter.kt index 3a7db32d8c6..f6965ac71dd 100644 --- a/idea/idea-completion/testData/keywords/PropertySetter.kt +++ b/idea/idea-completion/testData/keywords/PropertySetter.kt @@ -37,4 +37,10 @@ class Some { // EXIST: companion object // EXIST: sealed // EXIST: lateinit +// EXIST: data +// EXIST: inline +// EXIST: noinline +// EXIST: tailrec +// EXIST: external +// EXIST: annotation // NOTHING_ELSE diff --git a/idea/idea-completion/testData/keywords/TopScope.kt b/idea/idea-completion/testData/keywords/TopScope.kt index 73ebd21b19f..0413d506723 100644 --- a/idea/idea-completion/testData/keywords/TopScope.kt +++ b/idea/idea-completion/testData/keywords/TopScope.kt @@ -29,5 +29,11 @@ // EXIST: companion object // EXIST: sealed // EXIST: lateinit +// EXIST: data +// EXIST: inline +// EXIST: noinline +// EXIST: tailrec +// EXIST: external +// EXIST: annotation /*TODO*/ // NOTHING_ELSE diff --git a/idea/testData/checker/infos/CapturedConstructorParameter.kt b/idea/testData/checker/infos/CapturedConstructorParameter.kt index 9a0bd10c07d..b2f46824663 100644 --- a/idea/testData/checker/infos/CapturedConstructorParameter.kt +++ b/idea/testData/checker/infos/CapturedConstructorParameter.kt @@ -1,7 +1,7 @@ interface T class T1(t: Int): T -inline fun run(f: () -> T) = f() +inline fun run(f: () -> T) = f() class Delegate(d: Int) { diff --git a/idea/testData/checker/infos/CapturedInInlinedClosure.kt b/idea/testData/checker/infos/CapturedInInlinedClosure.kt index a8a075f5258..60d1402a7b6 100644 --- a/idea/testData/checker/infos/CapturedInInlinedClosure.kt +++ b/idea/testData/checker/infos/CapturedInInlinedClosure.kt @@ -1,4 +1,4 @@ -inline fun run(f: () -> T) = f() +inline fun run(f: () -> T) = f() fun run2(f: () -> Unit) = f() fun inline() { @@ -90,7 +90,7 @@ fun objectExpression() { } } -inline fun withNoInlineParam(noinline task1: () -> Unit, task2: () -> Unit) { +inline fun withNoInlineParam(noinline task1: () -> Unit, task2: () -> Unit) { task1() task2() } diff --git a/idea/testData/decompiler/decompiledText/Annotations.expected.kt b/idea/testData/decompiler/decompiledText/Annotations.expected.kt index 93a46c82790..1de98c93b17 100644 --- a/idea/testData/decompiler/decompiledText/Annotations.expected.kt +++ b/idea/testData/decompiler/decompiledText/Annotations.expected.kt @@ -3,8 +3,8 @@ package test -kotlin.data dependency.A dependency.B dependency.C public final class Annotations public constructor() { - kotlin.inline dependency.A dependency.B dependency.C public final val p: @[dependency.B] kotlin.Int /* compiled code */ +dependency.A dependency.B dependency.C kotlin.data public final class Annotations public constructor() { + dependency.A dependency.B dependency.C kotlin.inline public final val p: @[dependency.B] kotlin.Int /* compiled code */ - kotlin.inline dependency.A dependency.B dependency.C public final fun f(dependency.A dependency.B dependency.C kotlin.Deprecated i: @[dependency.A] kotlin.Int): kotlin.Unit { /* compiled code */ } + dependency.A dependency.B dependency.C kotlin.inline public final fun f(dependency.A dependency.B dependency.C kotlin.Deprecated i: @[dependency.A] kotlin.Int): kotlin.Unit { /* compiled code */ } } \ No newline at end of file diff --git a/idea/testData/highlighter/TypesAndAnnotations.kt b/idea/testData/highlighter/TypesAndAnnotations.kt index c2907ebea85..cff78f90f8d 100644 --- a/idea/testData/highlighter/TypesAndAnnotations.kt +++ b/idea/testData/highlighter/TypesAndAnnotations.kt @@ -4,8 +4,8 @@ interface TheTrait { class TheClass : TheTrait { } -annotation class magnificent -annotation class Deprecated +annotation class magnificent +annotation class Deprecated @Deprecated magnificent abstract class AbstractClass<T> { diff --git a/idea/testData/stubs/AnnotationClass.expected b/idea/testData/stubs/AnnotationClass.expected index 74a06f90d3c..03b373d2a49 100644 --- a/idea/testData/stubs/AnnotationClass.expected +++ b/idea/testData/stubs/AnnotationClass.expected @@ -2,9 +2,4 @@ PsiJetFileStubImpl[package=] PACKAGE_DIRECTIVE: IMPORT_LIST: CLASS:[fqName=Test, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=Test, superNames=[]] - MODIFIER_LIST:[] - ANNOTATION_ENTRY:[hasValueArguments=false, shortName=annotation] - CONSTRUCTOR_CALLEE: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=annotation] + MODIFIER_LIST:[annotation] diff --git a/idea/testData/stubs/SecondaryConstructors.expected b/idea/testData/stubs/SecondaryConstructors.expected index 080524dd1d3..278b03e45a1 100644 --- a/idea/testData/stubs/SecondaryConstructors.expected +++ b/idea/testData/stubs/SecondaryConstructors.expected @@ -77,9 +77,4 @@ PsiJetFileStubImpl[package=test] MODIFIER_LIST:[internal] VALUE_PARAMETER_LIST: CLASS:[fqName=test.anno, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=anno, superNames=[]] - MODIFIER_LIST:[] - ANNOTATION_ENTRY:[hasValueArguments=false, shortName=annotation] - CONSTRUCTOR_CALLEE: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=annotation] + MODIFIER_LIST:[annotation] diff --git a/idea/testData/stubs/TypeAnnotation.expected b/idea/testData/stubs/TypeAnnotation.expected index b85e0320508..ecf82fcfa4f 100644 --- a/idea/testData/stubs/TypeAnnotation.expected +++ b/idea/testData/stubs/TypeAnnotation.expected @@ -2,19 +2,9 @@ PsiJetFileStubImpl[package=] PACKAGE_DIRECTIVE: IMPORT_LIST: CLASS:[fqName=a, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=a, superNames=[]] - MODIFIER_LIST:[] - ANNOTATION_ENTRY:[hasValueArguments=false, shortName=annotation] - CONSTRUCTOR_CALLEE: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=annotation] + MODIFIER_LIST:[annotation] CLASS:[fqName=b, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=b, superNames=[]] - MODIFIER_LIST:[] - ANNOTATION_ENTRY:[hasValueArguments=false, shortName=annotation] - CONSTRUCTOR_CALLEE: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=annotation] + MODIFIER_LIST:[annotation] PRIMARY_CONSTRUCTOR: VALUE_PARAMETER_LIST: VALUE_PARAMETER:[fqName=b.e, hasDefaultValue=false, hasValOrVar=true, isMutable=false, name=e]