mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
Update annotation rendering in diagnostics
Disable annotation rendering in default type and descriptor renderers. Preserve annotations in Android and Serialization plugins. Update error texts in ide tests. Nullability annotations in Java descriptors are rendered with context-dependent renderer. #KT-20258 Fixed
This commit is contained in:
@@ -826,6 +826,11 @@ public class FirDiagnosticsSmokeTestGenerated extends AbstractFirDiagnosticsSmok
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("annotationRenderingInTypes.kt")
|
||||
public void testAnnotationRenderingInTypes() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/annotationRenderingInTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("AnnotationsForClasses.kt")
|
||||
public void testAnnotationsForClasses() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/AnnotationsForClasses.kt");
|
||||
@@ -1418,6 +1423,74 @@ public class FirDiagnosticsSmokeTestGenerated extends AbstractFirDiagnosticsSmok
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/annotations/rendering")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Rendering extends AbstractFirDiagnosticsSmokeTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInRendering() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/annotations/rendering"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("cannotOverrideInvisibleMember.kt")
|
||||
public void testCannotOverrideInvisibleMember() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/cannotOverrideInvisibleMember.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("conflictingOverloads.kt")
|
||||
public void testConflictingOverloads() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/conflictingOverloads.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("differentNamesForParameter.kt")
|
||||
public void testDifferentNamesForParameter() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/differentNamesForParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberProjectedOut.kt")
|
||||
public void testMemberProjectedOut() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/memberProjectedOut.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multipleInheritedDefaults.kt")
|
||||
public void testMultipleInheritedDefaults() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/multipleInheritedDefaults.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("notImplementedMembers.kt")
|
||||
public void testNotImplementedMembers() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/notImplementedMembers.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("tooManyArguments.kt")
|
||||
public void testTooManyArguments() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/tooManyArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeMismatchDueToTypeProjections.kt")
|
||||
public void testTypeMismatchDueToTypeProjections() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchDueToTypeProjections.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeMismatchOnOverride.kt")
|
||||
public void testTypeMismatchOnOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchOnOverride.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeMismatchOnOverrideJavaNullable.kt")
|
||||
public void testTypeMismatchOnOverrideJavaNullable() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchOnOverrideJavaNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unusedValue.kt")
|
||||
public void testUnusedValue() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/unusedValue.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.frontend.java.di
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.builtins.jvm.JvmBuiltIns
|
||||
import org.jetbrains.kotlin.builtins.jvm.JvmBuiltInsPackageFragmentProvider
|
||||
import org.jetbrains.kotlin.config.AnalysisFlags
|
||||
import org.jetbrains.kotlin.config.JvmAnalysisFlags
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
@@ -44,6 +43,7 @@ import org.jetbrains.kotlin.load.kotlin.VirtualFileFinderFactory
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.resolve.*
|
||||
import org.jetbrains.kotlin.resolve.jvm.JavaDescriptorResolver
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmDiagnosticComponents
|
||||
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
|
||||
import org.jetbrains.kotlin.resolve.lazy.KotlinCodeAnalyzer
|
||||
import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactory
|
||||
@@ -128,6 +128,7 @@ fun StorageComponentContainer.configureJavaSpecificComponents(
|
||||
)
|
||||
|
||||
useImpl<FilesByFacadeFqNameIndexer>()
|
||||
useImpl<JvmDiagnosticComponents>()
|
||||
}
|
||||
|
||||
fun ComponentProvider.initJvmBuiltInsForTopDownAnalysis() {
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.resolve.jvm
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.load.java.AnnotationTypeQualifierResolver
|
||||
import org.jetbrains.kotlin.load.java.NULLABILITY_ANNOTATIONS
|
||||
import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.platform.PlatformSpecificDiagnosticComponents
|
||||
|
||||
class JvmDiagnosticComponents(
|
||||
private val typeQualifierResolver: AnnotationTypeQualifierResolver
|
||||
) : PlatformSpecificDiagnosticComponents {
|
||||
override fun isNullabilityAnnotation(
|
||||
annotationDescriptor: AnnotationDescriptor,
|
||||
containingDeclaration: DeclarationDescriptor
|
||||
): Boolean {
|
||||
if (containingDeclaration !is JavaCallableMemberDescriptor) {
|
||||
return false
|
||||
}
|
||||
return annotationDescriptor.fqName?.let { it in NULLABILITY_ANNOTATIONS } == true
|
||||
|| typeQualifierResolver.resolveTypeQualifierAnnotation(annotationDescriptor) != null
|
||||
}
|
||||
}
|
||||
@@ -11,12 +11,12 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.impl.source.tree.LeafPsiElement;
|
||||
import kotlin.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.analyzer.ModuleInfo;
|
||||
import org.jetbrains.kotlin.cfg.WhenMissingCase;
|
||||
import org.jetbrains.kotlin.config.LanguageFeature;
|
||||
import org.jetbrains.kotlin.config.LanguageVersion;
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.DeclarationWithDiagnosticComponents;
|
||||
import org.jetbrains.kotlin.lexer.KtKeywordToken;
|
||||
import org.jetbrains.kotlin.lexer.KtModifierKeywordToken;
|
||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
@@ -475,7 +475,7 @@ public interface Errors {
|
||||
DiagnosticFactory3.create(ERROR, VISIBILITY_MODIFIER);
|
||||
DiagnosticFactory3<KtModifierListOwner, Visibility, CallableMemberDescriptor, DeclarationDescriptor> CANNOT_CHANGE_ACCESS_PRIVILEGE =
|
||||
DiagnosticFactory3.create(ERROR, VISIBILITY_MODIFIER);
|
||||
DiagnosticFactory2<KtNamedDeclaration, CallableMemberDescriptor, CallableMemberDescriptor> RETURN_TYPE_MISMATCH_ON_OVERRIDE =
|
||||
DiagnosticFactory2<KtNamedDeclaration, CallableMemberDescriptor, DeclarationWithDiagnosticComponents> RETURN_TYPE_MISMATCH_ON_OVERRIDE =
|
||||
DiagnosticFactory2.create(ERROR, DECLARATION_RETURN_TYPE);
|
||||
DiagnosticFactory2<KtNamedDeclaration, CallableMemberDescriptor, CallableMemberDescriptor> PROPERTY_TYPE_MISMATCH_ON_OVERRIDE =
|
||||
DiagnosticFactory2.create(ERROR, DECLARATION_RETURN_TYPE);
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.diagnostics.rendering
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.platform.PlatformSpecificDiagnosticComponents
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
||||
|
||||
data class DeclarationWithDiagnosticComponents(
|
||||
val declaration: DeclarationDescriptor,
|
||||
val diagnosticComponents: PlatformSpecificDiagnosticComponents
|
||||
) : Iterable<Any> {
|
||||
override fun iterator() =
|
||||
sequenceOf(declaration, diagnosticComponents).iterator()
|
||||
}
|
||||
|
||||
class AnnotationsWhitelistDescriptorRenderer(
|
||||
private val baseRenderer: DescriptorRenderer,
|
||||
private val toParameterRenderer: DescriptorRenderer.() -> DiagnosticParameterRenderer<DeclarationDescriptor>
|
||||
) : DiagnosticParameterRenderer<DeclarationWithDiagnosticComponents> {
|
||||
override fun render(obj: DeclarationWithDiagnosticComponents, renderingContext: RenderingContext): String {
|
||||
val (descriptor, diagnosticComponents) = obj
|
||||
return baseRenderer.withOptions {
|
||||
annotationFilter = { annotation ->
|
||||
diagnosticComponents.isNullabilityAnnotation(annotation, descriptor)
|
||||
}
|
||||
}.toParameterRenderer().render(descriptor, renderingContext)
|
||||
}
|
||||
}
|
||||
|
||||
fun DescriptorRenderer.withAnnotationsWhitelist(
|
||||
toParameterRenderer: DescriptorRenderer.() -> DiagnosticParameterRenderer<DeclarationDescriptor> = DescriptorRenderer::asRenderer
|
||||
) = AnnotationsWhitelistDescriptorRenderer(this, toParameterRenderer)
|
||||
@@ -84,7 +84,8 @@ public class DefaultErrorMessages {
|
||||
MAP.put(EXTENSION_FUNCTION_SHADOWED_BY_MEMBER_PROPERTY_WITH_INVOKE,
|
||||
"Extension function is shadowed by a member property ''{0}'' with {1}", NAME, COMPACT_WITH_MODIFIERS);
|
||||
|
||||
MAP.put(INACCESSIBLE_TYPE, "Type {0} is inaccessible in this context due to: {1}", RENDER_TYPE, commaSeparated(FQ_NAMES_IN_TYPES));
|
||||
MAP.put(INACCESSIBLE_TYPE, "Type {0} is inaccessible in this context due to: {1}", RENDER_TYPE, commaSeparated(
|
||||
FQ_NAMES_IN_TYPES_WITH_ANNOTATIONS));
|
||||
|
||||
MAP.put(REDECLARATION, "Conflicting declarations: {0}", commaSeparated(COMPACT_WITH_MODIFIERS));
|
||||
MAP.put(PACKAGE_OR_CLASSIFIER_REDECLARATION, "Redeclaration: {0}", STRING);
|
||||
@@ -762,7 +763,7 @@ public class DefaultErrorMessages {
|
||||
MAP.put(CANNOT_CHANGE_ACCESS_PRIVILEGE, "Cannot change access privilege ''{0}'' for ''{1}'' in ''{2}''", VISIBILITY, NAME, NAME);
|
||||
|
||||
MAP.put(RETURN_TYPE_MISMATCH_ON_OVERRIDE, "Return type of ''{0}'' is not a subtype of the return type of the overridden member ''{1}''",
|
||||
NAME, FQ_NAMES_IN_TYPES);
|
||||
NAME, FQ_NAMES_IN_TYPES_ANNOTATIONS_WHITELIST);
|
||||
MAP.put(RETURN_TYPE_MISMATCH_ON_INHERITANCE, "''{0}'' clashes with ''{1}'': return types are incompatible",
|
||||
SHORT_NAMES_IN_TYPES, SHORT_NAMES_IN_TYPES);
|
||||
|
||||
@@ -784,7 +785,8 @@ public class DefaultErrorMessages {
|
||||
MAP.put(PROPERTY_TYPE_MISMATCH_BY_DELEGATION, "Type of property ''{0}'' is not a subtype of overridden by delegation ''{1}''",
|
||||
SHORT_NAMES_IN_TYPES, SHORT_NAMES_IN_TYPES);
|
||||
|
||||
MAP.put(VAR_OVERRIDDEN_BY_VAL, "Var-property {0} cannot be overridden by val-property {1}", FQ_NAMES_IN_TYPES, FQ_NAMES_IN_TYPES);
|
||||
MAP.put(VAR_OVERRIDDEN_BY_VAL, "Var-property {0} cannot be overridden by val-property {1}", FQ_NAMES_IN_TYPES,
|
||||
FQ_NAMES_IN_TYPES);
|
||||
|
||||
MAP.put(CONFLICTING_INHERITED_MEMBERS, "{0} inherits conflicting members: {1}", NAME, commaSeparated(FQ_NAMES_IN_TYPES));
|
||||
MAP.put(ABSTRACT_MEMBER_NOT_IMPLEMENTED, "{0} is not abstract and does not implement abstract member {1}", RENDER_CLASS_OR_OBJECT,
|
||||
@@ -921,7 +923,8 @@ public class DefaultErrorMessages {
|
||||
|
||||
MAP.put(DIFFERENT_NAMES_FOR_THE_SAME_PARAMETER_IN_SUPERTYPES,
|
||||
"Names of the parameter #{1} conflict in the following members of supertypes: ''{0}''. " +
|
||||
"This may cause problems when calling this function with named arguments.", commaSeparated(FQ_NAMES_IN_TYPES), TO_STRING);
|
||||
"This may cause problems when calling this function with named arguments.", commaSeparated(
|
||||
FQ_NAMES_IN_TYPES), TO_STRING);
|
||||
|
||||
MAP.put(NAME_FOR_AMBIGUOUS_PARAMETER, "Named argument is not allowed for a parameter with an ambiguous name");
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.impl.TypeAliasConstructorDescriptor
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.TabledDescriptorRenderer.newTable
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.TabledDescriptorRenderer.newText
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.platform.isCommon
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
@@ -157,7 +158,25 @@ object Renderers {
|
||||
val RENDER_CLASS_OR_OBJECT_NAME = Renderer<ClassifierDescriptorWithTypeParameters> { it.renderKindWithName() }
|
||||
|
||||
@JvmField
|
||||
val RENDER_TYPE = SmartTypeRenderer(DescriptorRenderer.FQ_NAMES_IN_TYPES.withOptions { parameterNamesInFunctionalTypes = false })
|
||||
val RENDER_TYPE = SmartTypeRenderer(DescriptorRenderer.FQ_NAMES_IN_TYPES.withOptions {
|
||||
parameterNamesInFunctionalTypes = false
|
||||
})
|
||||
|
||||
@JvmField
|
||||
val RENDER_TYPE_WITH_ANNOTATIONS = SmartTypeRenderer(DescriptorRenderer.FQ_NAMES_IN_TYPES_WITH_ANNOTATIONS.withOptions {
|
||||
parameterNamesInFunctionalTypes = false
|
||||
})
|
||||
|
||||
@JvmField
|
||||
val TYPE_PROJECTION = Renderer<TypeProjection> { projection ->
|
||||
when {
|
||||
projection.isStarProjection -> "*"
|
||||
projection.projectionKind == Variance.INVARIANT ->
|
||||
RENDER_TYPE.render(projection.type, RenderingContext.of(projection.type))
|
||||
else ->
|
||||
"${projection.projectionKind} ${RENDER_TYPE.render(projection.type, RenderingContext.of(projection.type))}"
|
||||
}
|
||||
}
|
||||
|
||||
@JvmField
|
||||
val RENDER_POSITION_VARIANCE = Renderer { variance: Variance ->
|
||||
@@ -504,7 +523,10 @@ object Renderers {
|
||||
newText().normal(
|
||||
typeParameter.name.wrapIntoQuotes() +
|
||||
" cannot capture " +
|
||||
"${capturedTypeConstructor.projection.toString().wrapIntoQuotes()}. " +
|
||||
"${result.typeProjectionRenderer.render(
|
||||
capturedTypeConstructor.projection,
|
||||
RenderingContext.of(capturedTypeConstructor.projection)
|
||||
).wrapIntoQuotes()}. " +
|
||||
explanation
|
||||
)
|
||||
)
|
||||
@@ -527,11 +549,18 @@ object Renderers {
|
||||
}
|
||||
}
|
||||
|
||||
private fun renderTypes(types: Collection<KotlinType>, context: RenderingContext) =
|
||||
StringUtil.join(types, { RENDER_TYPE.render(it, context) }, ", ")
|
||||
private fun renderTypes(
|
||||
types: Collection<KotlinType>,
|
||||
typeRenderer: DiagnosticParameterRenderer<KotlinType>,
|
||||
context: RenderingContext
|
||||
): String {
|
||||
return StringUtil.join(types, { typeRenderer.render(it, context) }, ", ")
|
||||
}
|
||||
|
||||
@JvmField
|
||||
val RENDER_COLLECTION_OF_TYPES = ContextDependentRenderer<Collection<KotlinType>> { types, context -> renderTypes(types, context) }
|
||||
val RENDER_COLLECTION_OF_TYPES = ContextDependentRenderer<Collection<KotlinType>> { types, context ->
|
||||
renderTypes(types, RENDER_TYPE, context)
|
||||
}
|
||||
|
||||
enum class ConstraintSystemRenderingVerbosity {
|
||||
COMPACT,
|
||||
@@ -634,13 +663,13 @@ object Renderers {
|
||||
if (TypeUtils.noExpectedType(inferenceErrorData.expectedType)) {
|
||||
append(inferenceErrorData.expectedType)
|
||||
} else {
|
||||
append(RENDER_TYPE.render(inferenceErrorData.expectedType, context))
|
||||
append(RENDER_TYPE_WITH_ANNOTATIONS.render(inferenceErrorData.expectedType, context))
|
||||
}
|
||||
append("\nArgument types:\n")
|
||||
if (inferenceErrorData.receiverArgumentType != null) {
|
||||
append(RENDER_TYPE.render(inferenceErrorData.receiverArgumentType, context)).append(".")
|
||||
append(RENDER_TYPE_WITH_ANNOTATIONS.render(inferenceErrorData.receiverArgumentType, context)).append(".")
|
||||
}
|
||||
append("(").append(renderTypes(inferenceErrorData.valueArgumentsTypes, context)).append(")")
|
||||
append("(").append(renderTypes(inferenceErrorData.valueArgumentsTypes, RENDER_TYPE_WITH_ANNOTATIONS, context)).append(")")
|
||||
}
|
||||
|
||||
private fun String.wrapIntoQuotes(): String = "'$this'"
|
||||
@@ -662,6 +691,10 @@ object Renderers {
|
||||
@JvmField
|
||||
val FQ_NAMES_IN_TYPES = DescriptorRenderer.FQ_NAMES_IN_TYPES.asRenderer()
|
||||
@JvmField
|
||||
val FQ_NAMES_IN_TYPES_ANNOTATIONS_WHITELIST = DescriptorRenderer.FQ_NAMES_IN_TYPES_WITH_ANNOTATIONS.withAnnotationsWhitelist()
|
||||
@JvmField
|
||||
val FQ_NAMES_IN_TYPES_WITH_ANNOTATIONS = DescriptorRenderer.FQ_NAMES_IN_TYPES_WITH_ANNOTATIONS.asRenderer()
|
||||
@JvmField
|
||||
val COMPACT = DescriptorRenderer.COMPACT.asRenderer()
|
||||
@JvmField
|
||||
val COMPACT_WITHOUT_SUPERTYPES = DescriptorRenderer.COMPACT_WITHOUT_SUPERTYPES.asRenderer()
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.diagnostics.rendering.TabledDescriptorRenderer.Table
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.TabledDescriptorRenderer.TextRenderer.TextElement;
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.constraintPosition.ConstraintPosition;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
import org.jetbrains.kotlin.types.TypeProjection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
@@ -157,6 +158,11 @@ public class TabledDescriptorRenderer {
|
||||
return Renderers.RENDER_TYPE;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public DiagnosticParameterRenderer<TypeProjection> getTypeProjectionRenderer() {
|
||||
return Renderers.TYPE_PROJECTION;
|
||||
}
|
||||
|
||||
protected void renderText(TextRenderer textRenderer, StringBuilder result) {
|
||||
for (TextElement element : textRenderer.elements) {
|
||||
result.append(element.text);
|
||||
|
||||
@@ -77,7 +77,7 @@ private fun collectClassifiersFqNames(objectsToRender: Collection<Any?>): Set<Fq
|
||||
collectMentionedClassifiersFqNames(objectsToRender, this)
|
||||
}
|
||||
|
||||
private fun collectMentionedClassifiersFqNames(contextObjects: Collection<Any?>, result: MutableSet<FqNameUnsafe>) {
|
||||
private fun collectMentionedClassifiersFqNames(contextObjects: Iterable<Any?>, result: MutableSet<FqNameUnsafe>) {
|
||||
fun KotlinType.addMentionedTypeConstructor() {
|
||||
constructor.declarationDescriptor?.let { result.add(it.fqNameUnsafe) }
|
||||
}
|
||||
@@ -90,7 +90,7 @@ private fun collectMentionedClassifiersFqNames(contextObjects: Collection<Any?>,
|
||||
}
|
||||
}
|
||||
|
||||
contextObjects.filterIsInstance<Collection<*>>().forEach {
|
||||
contextObjects.filterIsInstance<Iterable<*>>().forEach {
|
||||
collectMentionedClassifiersFqNames(it, result)
|
||||
}
|
||||
contextObjects.filterIsInstance<ClassifierDescriptor>().forEach {
|
||||
|
||||
@@ -30,8 +30,10 @@ import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.FAKE_OVERR
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory2
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticFactoryWithPsiElement
|
||||
import org.jetbrains.kotlin.diagnostics.Errors.*
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.DeclarationWithDiagnosticComponents
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.platform.PlatformSpecificDiagnosticComponents
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils.classCanHaveAbstractFakeOverride
|
||||
import org.jetbrains.kotlin.resolve.OverridingUtil.OverrideCompatibilityInfo.Result.OVERRIDABLE
|
||||
@@ -47,7 +49,8 @@ class OverrideResolver(
|
||||
private val trace: BindingTrace,
|
||||
private val overridesBackwardCompatibilityHelper: OverridesBackwardCompatibilityHelper,
|
||||
private val languageVersionSettings: LanguageVersionSettings,
|
||||
private val kotlinTypeRefiner: KotlinTypeRefiner
|
||||
private val kotlinTypeRefiner: KotlinTypeRefiner,
|
||||
private val platformSpecificDiagnosticComponents: PlatformSpecificDiagnosticComponents
|
||||
) {
|
||||
|
||||
fun check(c: TopDownAnalysisContext) {
|
||||
@@ -289,7 +292,9 @@ class OverrideResolver(
|
||||
override fun returnTypeMismatchOnOverride(overriding: CallableMemberDescriptor, overridden: CallableMemberDescriptor) {
|
||||
if (!typeMismatchError) {
|
||||
typeMismatchError = true
|
||||
trace.report(RETURN_TYPE_MISMATCH_ON_OVERRIDE.on(member, declared, overridden))
|
||||
trace.report(RETURN_TYPE_MISMATCH_ON_OVERRIDE.on(
|
||||
member, declared, DeclarationWithDiagnosticComponents(overridden, platformSpecificDiagnosticComponents)
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
25
compiler/testData/diagnostics/tests/annotations/annotationRenderingInTypes.kt
vendored
Normal file
25
compiler/testData/diagnostics/tests/annotations/annotationRenderingInTypes.kt
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// !RENDER_DIAGNOSTICS_MESSAGES
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_ANONYMOUS_PARAMETER
|
||||
|
||||
fun f1(x: String) {}
|
||||
fun f2(f: () -> Unit) {}
|
||||
fun test1() = f2(<!TYPE_MISMATCH("() -> Unit", "KFunction1<String, Unit>")!>::f1<!>)
|
||||
|
||||
|
||||
@Target(AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.TYPE)
|
||||
annotation class Ann
|
||||
|
||||
fun <@Ann R : @Ann Any> f3(a: Array<@Ann R>): Array<@Ann R?> = null!!
|
||||
|
||||
fun test2(a: @Ann Array<in @Ann Int>) {
|
||||
val r: Array<in Int?> = <!TYPE_INFERENCE_CANNOT_CAPTURE_TYPES("'R' cannot capture 'in Int'. Type parameter has an upper bound 'Any' that cannot be satisfied capturing 'in' projection")!>f3<!>(a)
|
||||
}
|
||||
|
||||
|
||||
var test3: Int = 0
|
||||
set(s: <!WRONG_SETTER_PARAMETER_TYPE("Int", "String")!>@Ann String<!>) {}
|
||||
|
||||
|
||||
fun f4(fn: (@Ann Int, @Ann Int) -> Unit) {}
|
||||
|
||||
val test4 = f4 { <!EXPECTED_PARAMETERS_NUMBER_MISMATCH("2", "Int, Int")!>single<!> -> }
|
||||
17
compiler/testData/diagnostics/tests/annotations/annotationRenderingInTypes.txt
vendored
Normal file
17
compiler/testData/diagnostics/tests/annotations/annotationRenderingInTypes.txt
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
package
|
||||
|
||||
public var test3: kotlin.Int
|
||||
public val test4: kotlin.Unit
|
||||
public fun f1(/*0*/ x: kotlin.String): kotlin.Unit
|
||||
public fun f2(/*0*/ f: () -> kotlin.Unit): kotlin.Unit
|
||||
public fun </*0*/ @Ann R : @Ann kotlin.Any> f3(/*0*/ a: kotlin.Array<@Ann R>): kotlin.Array<@Ann R?>
|
||||
public fun f4(/*0*/ fn: (@Ann kotlin.Int, @Ann kotlin.Int) -> kotlin.Unit): kotlin.Unit
|
||||
public fun test1(): kotlin.Unit
|
||||
public fun test2(/*0*/ a: @Ann kotlin.Array<in @Ann kotlin.Int>): kotlin.Unit
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.TYPE}) public final annotation class Ann : kotlin.Annotation {
|
||||
public constructor Ann()
|
||||
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
|
||||
}
|
||||
15
compiler/testData/diagnostics/tests/annotations/rendering/cannotOverrideInvisibleMember.kt
vendored
Normal file
15
compiler/testData/diagnostics/tests/annotations/rendering/cannotOverrideInvisibleMember.kt
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
// !DIAGNOSTICS: -INCOMPATIBLE_MODIFIERS
|
||||
// !RENDER_DIAGNOSTICS_MESSAGES
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS)
|
||||
annotation class A
|
||||
|
||||
@A
|
||||
open class B1 {
|
||||
@A
|
||||
private open fun foo() {}
|
||||
}
|
||||
|
||||
class D1 : B1() {
|
||||
<!CANNOT_OVERRIDE_INVISIBLE_MEMBER("public open fun foo(): Unit defined in D1", "private open fun foo(): Unit defined in B1")!>override<!> fun foo() {}
|
||||
}
|
||||
24
compiler/testData/diagnostics/tests/annotations/rendering/cannotOverrideInvisibleMember.txt
vendored
Normal file
24
compiler/testData/diagnostics/tests/annotations/rendering/cannotOverrideInvisibleMember.txt
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
package
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS}) public final annotation class A : kotlin.Annotation {
|
||||
public constructor A()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@A public open class B1 {
|
||||
public constructor B1()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@A private open fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class D1 : B1 {
|
||||
public constructor D1()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
10
compiler/testData/diagnostics/tests/annotations/rendering/conflictingOverloads.kt
vendored
Normal file
10
compiler/testData/diagnostics/tests/annotations/rendering/conflictingOverloads.kt
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
// !RENDER_DIAGNOSTICS_MESSAGES
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.VALUE_PARAMETER)
|
||||
annotation class An
|
||||
|
||||
@An
|
||||
data class A(@An val x: @An Int) {
|
||||
<!CONFLICTING_OVERLOADS("public final fun copy(x: Int): Int defined in A")!>@An
|
||||
fun copy(@An x: @An Int)<!> = x
|
||||
}
|
||||
19
compiler/testData/diagnostics/tests/annotations/rendering/conflictingOverloads.txt
vendored
Normal file
19
compiler/testData/diagnostics/tests/annotations/rendering/conflictingOverloads.txt
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
package
|
||||
|
||||
@An public final data class A {
|
||||
public constructor A(/*0*/ @An x: @An kotlin.Int)
|
||||
public final val x: @An kotlin.Int
|
||||
public final operator /*synthesized*/ fun component1(): @An kotlin.Int
|
||||
@An public final fun copy(/*0*/ @An x: @An kotlin.Int): @An kotlin.Int
|
||||
public final /*synthesized*/ fun copy(/*0*/ @An x: @An kotlin.Int = ...): A
|
||||
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.VALUE_PARAMETER}) public final annotation class An : kotlin.Annotation {
|
||||
public constructor An()
|
||||
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
|
||||
}
|
||||
18
compiler/testData/diagnostics/tests/annotations/rendering/differentNamesForParameter.kt
vendored
Normal file
18
compiler/testData/diagnostics/tests/annotations/rendering/differentNamesForParameter.kt
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// !RENDER_DIAGNOSTICS_MESSAGES
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.VALUE_PARAMETER)
|
||||
annotation class An
|
||||
|
||||
@An
|
||||
interface A {
|
||||
@An
|
||||
fun foo(@An a : @An Int)
|
||||
}
|
||||
|
||||
@An
|
||||
interface B {
|
||||
@An
|
||||
fun foo(@An b : @An Int)
|
||||
}
|
||||
|
||||
<!DIFFERENT_NAMES_FOR_THE_SAME_PARAMETER_IN_SUPERTYPES("public abstract fun foo(a: Int): Unit defined in A, public abstract fun foo(b: Int): Unit defined in B", "1")!>interface C<!> : A, B
|
||||
29
compiler/testData/diagnostics/tests/annotations/rendering/differentNamesForParameter.txt
vendored
Normal file
29
compiler/testData/diagnostics/tests/annotations/rendering/differentNamesForParameter.txt
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
package
|
||||
|
||||
@An public interface A {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@An public abstract fun foo(/*0*/ @An a: @An kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.VALUE_PARAMETER}) public final annotation class An : kotlin.Annotation {
|
||||
public constructor An()
|
||||
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
|
||||
}
|
||||
|
||||
@An public interface B {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@An public abstract fun foo(/*0*/ @An b: @An kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface C : A, B {
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@An public abstract override /*2*/ /*fake_override*/ fun foo(/*0*/ @An a: @An kotlin.Int): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
15
compiler/testData/diagnostics/tests/annotations/rendering/memberProjectedOut.kt
vendored
Normal file
15
compiler/testData/diagnostics/tests/annotations/rendering/memberProjectedOut.kt
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !RENDER_DIAGNOSTICS_MESSAGES
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS)
|
||||
annotation class A
|
||||
|
||||
@A
|
||||
class C<T> {
|
||||
@A
|
||||
operator fun set(x: @A Int, y: @A T) {}
|
||||
}
|
||||
|
||||
fun test(a: C<out CharSequence>) {
|
||||
<!MEMBER_PROJECTED_OUT("public final operator fun set(x: Int, y: T): Unit defined in C", "C<out CharSequence>")!>a[1]<!> = 25
|
||||
}
|
||||
18
compiler/testData/diagnostics/tests/annotations/rendering/memberProjectedOut.txt
vendored
Normal file
18
compiler/testData/diagnostics/tests/annotations/rendering/memberProjectedOut.txt
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
package
|
||||
|
||||
public fun test(/*0*/ a: C<out kotlin.CharSequence>): kotlin.Unit
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS}) public final annotation class A : kotlin.Annotation {
|
||||
public constructor A()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@A public final class C</*0*/ T> {
|
||||
public constructor C</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
@A public final operator fun set(/*0*/ x: @A kotlin.Int, /*1*/ y: @A T): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
26
compiler/testData/diagnostics/tests/annotations/rendering/multipleInheritedDefaults.kt
vendored
Normal file
26
compiler/testData/diagnostics/tests/annotations/rendering/multipleInheritedDefaults.kt
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// !RENDER_DIAGNOSTICS_MESSAGES
|
||||
// !DIAGNOSTICS: -ABSTRACT_MEMBER_NOT_IMPLEMENTED
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.PROPERTY, AnnotationTarget.EXPRESSION)
|
||||
@Retention( AnnotationRetention.SOURCE)
|
||||
annotation class An
|
||||
|
||||
@An
|
||||
interface A {
|
||||
@An
|
||||
fun foo(@An a: @An Int = @An 1)
|
||||
}
|
||||
|
||||
@An
|
||||
interface B {
|
||||
@An
|
||||
fun foo(@An a: @An Int = @An 2)
|
||||
}
|
||||
|
||||
<!MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES_WHEN_NO_EXPLICIT_OVERRIDE("value-parameter a: Int = ... defined in AB1.foo")!>class AB1<!> : A, B
|
||||
|
||||
@An
|
||||
class AB2 : A, B {
|
||||
@An
|
||||
override fun foo(<!MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES("value-parameter a: Int = ... defined in AB2.foo")!>@An a: @An Int<!>) {}
|
||||
}
|
||||
38
compiler/testData/diagnostics/tests/annotations/rendering/multipleInheritedDefaults.txt
vendored
Normal file
38
compiler/testData/diagnostics/tests/annotations/rendering/multipleInheritedDefaults.txt
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
package
|
||||
|
||||
@An public interface A {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@An public abstract fun foo(/*0*/ @An a: @An kotlin.Int = ...): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class AB1 : A, B {
|
||||
public constructor AB1()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@An public abstract override /*2*/ /*fake_override*/ fun foo(/*0*/ @An a: @An kotlin.Int = ...): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@An public final class AB2 : A, B {
|
||||
public constructor AB2()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@An public open override /*2*/ fun foo(/*0*/ @An a: @An kotlin.Int = ...): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.PROPERTY, AnnotationTarget.EXPRESSION}) @kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) public final annotation class An : kotlin.Annotation {
|
||||
public constructor An()
|
||||
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
|
||||
}
|
||||
|
||||
@An public interface B {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@An public abstract fun foo(/*0*/ @An a: @An kotlin.Int = ...): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
48
compiler/testData/diagnostics/tests/annotations/rendering/notImplementedMembers.kt
vendored
Normal file
48
compiler/testData/diagnostics/tests/annotations/rendering/notImplementedMembers.kt
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
// !RENDER_DIAGNOSTICS_MESSAGES
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.PROPERTY)
|
||||
annotation class An
|
||||
|
||||
@An
|
||||
interface A {
|
||||
@An
|
||||
fun a(@An arg: @An Int)
|
||||
}
|
||||
|
||||
@An
|
||||
interface B {
|
||||
@An
|
||||
fun <T> a(@An arg: @An Int)
|
||||
}
|
||||
|
||||
<!CONFLICTING_INHERITED_MEMBERS("C", "public abstract fun a(arg: Int): Unit defined in A, public abstract fun <T> a(arg: Int): Unit defined in B")!>interface C<!> : A, B
|
||||
|
||||
@An
|
||||
abstract class D {
|
||||
@An
|
||||
abstract val d: @An Int
|
||||
}
|
||||
|
||||
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED("Class 'E'", "public abstract val d: Int defined in D")!>class E<!> : D(), A
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED("Class 'F'", "public abstract fun a(arg: Int): Unit defined in A")!>class F<!> : A
|
||||
|
||||
@An
|
||||
interface G {
|
||||
@An
|
||||
fun a(@An arg: @An Int)
|
||||
}
|
||||
|
||||
@An
|
||||
interface AI : A {
|
||||
@An
|
||||
override fun a(@An arg: @An Int) {}
|
||||
}
|
||||
|
||||
@An
|
||||
interface GI : G {
|
||||
@An
|
||||
override fun a(@An arg: @An Int) {}
|
||||
}
|
||||
|
||||
<!MANY_IMPL_MEMBER_NOT_IMPLEMENTED("Class 'AG1'", "public open fun a(arg: Int): Unit defined in AG1")!>class AG1<!>(val a: A, val g: G) : A by a, G by g
|
||||
<!MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED("Class 'AG2'", "public open fun a(arg: Int): Unit defined in AI")!>class AG2<!>() : AI, GI
|
||||
93
compiler/testData/diagnostics/tests/annotations/rendering/notImplementedMembers.txt
vendored
Normal file
93
compiler/testData/diagnostics/tests/annotations/rendering/notImplementedMembers.txt
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
package
|
||||
|
||||
@An public interface A {
|
||||
@An public abstract fun a(/*0*/ @An arg: @An kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class AG1 : A, G {
|
||||
public constructor AG1(/*0*/ a: A, /*1*/ g: G)
|
||||
public final val a: A
|
||||
public final val g: G
|
||||
@An public open override /*2*/ /*delegation*/ fun a(/*0*/ @An arg: @An kotlin.Int): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class AG2 : AI, GI {
|
||||
public constructor AG2()
|
||||
@An public open override /*2*/ /*fake_override*/ fun a(/*0*/ @An arg: @An kotlin.Int): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@An public interface AI : A {
|
||||
@An public open override /*1*/ fun a(/*0*/ @An arg: @An kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.PROPERTY}) public final annotation class An : kotlin.Annotation {
|
||||
public constructor An()
|
||||
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
|
||||
}
|
||||
|
||||
@An public interface B {
|
||||
@An public abstract fun </*0*/ T> a(/*0*/ @An arg: @An kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface C : A, B {
|
||||
@An public abstract override /*1*/ /*fake_override*/ fun a(/*0*/ @An arg: @An kotlin.Int): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@An public abstract class D {
|
||||
public constructor D()
|
||||
@An public abstract val d: @An kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class E : D, A {
|
||||
public constructor E()
|
||||
@An public abstract override /*1*/ /*fake_override*/ val d: @An kotlin.Int
|
||||
@An public abstract override /*1*/ /*fake_override*/ fun a(/*0*/ @An arg: @An kotlin.Int): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class F : A {
|
||||
public constructor F()
|
||||
@An public abstract override /*1*/ /*fake_override*/ fun a(/*0*/ @An arg: @An kotlin.Int): kotlin.Unit
|
||||
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
|
||||
}
|
||||
|
||||
@An public interface G {
|
||||
@An public abstract fun a(/*0*/ @An arg: @An kotlin.Int): kotlin.Unit
|
||||
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
|
||||
}
|
||||
|
||||
@An public interface GI : G {
|
||||
@An public open override /*1*/ fun a(/*0*/ @An arg: @An kotlin.Int): kotlin.Unit
|
||||
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
|
||||
}
|
||||
11
compiler/testData/diagnostics/tests/annotations/rendering/tooManyArguments.kt
vendored
Normal file
11
compiler/testData/diagnostics/tests/annotations/rendering/tooManyArguments.kt
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
// !RENDER_DIAGNOSTICS_MESSAGES
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS)
|
||||
annotation class Ann(val s: String = "")
|
||||
|
||||
@Ann("s")
|
||||
fun foo() {}
|
||||
|
||||
val bar = foo(
|
||||
<!TOO_MANY_ARGUMENTS("public fun foo(): Unit defined in root package in file tooManyArguments.kt")!>15<!>
|
||||
)
|
||||
12
compiler/testData/diagnostics/tests/annotations/rendering/tooManyArguments.txt
vendored
Normal file
12
compiler/testData/diagnostics/tests/annotations/rendering/tooManyArguments.txt
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
package
|
||||
|
||||
public val bar: kotlin.Unit
|
||||
@Ann(s = "s") public fun foo(): kotlin.Unit
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS}) public final annotation class Ann : kotlin.Annotation {
|
||||
public constructor Ann(/*0*/ s: kotlin.String = ...)
|
||||
public final val s: kotlin.String
|
||||
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
|
||||
}
|
||||
17
compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchDueToTypeProjections.kt
vendored
Normal file
17
compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchDueToTypeProjections.kt
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !RENDER_DIAGNOSTICS_MESSAGES
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS)
|
||||
annotation class A
|
||||
|
||||
@A
|
||||
class C<T> {
|
||||
@A
|
||||
operator fun plus(x: Out<@A T>): @A C<@A T> = this
|
||||
}
|
||||
|
||||
class Out<out F>
|
||||
|
||||
fun test(a: C<out CharSequence>, y: Out<CharSequence>) {
|
||||
a + <!TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS("Out<Nothing>", "Out<CharSequence>", "C<out CharSequence>", "public final operator fun plus(x: Out<T>): C<T> defined in C")!>y<!>
|
||||
}
|
||||
25
compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchDueToTypeProjections.txt
vendored
Normal file
25
compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchDueToTypeProjections.txt
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
package
|
||||
|
||||
public fun test(/*0*/ a: C<out kotlin.CharSequence>, /*1*/ y: Out<kotlin.CharSequence>): kotlin.Unit
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS}) public final annotation class A : kotlin.Annotation {
|
||||
public constructor A()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@A public final class C</*0*/ T> {
|
||||
public constructor C</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
@A public final operator fun plus(/*0*/ x: Out<@A T>): @A C<@A T>
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Out</*0*/ out F> {
|
||||
public constructor Out</*0*/ out F>()
|
||||
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
|
||||
}
|
||||
26
compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchOnOverride.kt
vendored
Normal file
26
compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchOnOverride.kt
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// !RENDER_DIAGNOSTICS_MESSAGES
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.VALUE_PARAMETER)
|
||||
annotation class An
|
||||
|
||||
@An
|
||||
interface A {
|
||||
@An
|
||||
val p1: @An String
|
||||
@An
|
||||
var p2: @An String
|
||||
@An
|
||||
fun test(@An arg: @An String): @An String
|
||||
}
|
||||
|
||||
@An
|
||||
interface B : A {
|
||||
override val p1: <!PROPERTY_TYPE_MISMATCH_ON_OVERRIDE("p1", "public abstract val p1: String defined in A")!>Int<!>
|
||||
@An
|
||||
override <!VAR_OVERRIDDEN_BY_VAL("public abstract val p2: String defined in B", "public abstract var p2: String defined in A")!>val<!> p2: @An String
|
||||
override fun test(arg: String): <!RETURN_TYPE_MISMATCH_ON_OVERRIDE("test", "public abstract fun test(arg: String): String defined in A")!>Int<!>
|
||||
}
|
||||
|
||||
interface C : A {
|
||||
override var p2: <!VAR_TYPE_MISMATCH_ON_OVERRIDE("p2", "public abstract var p2: String defined in A")!>Int<!>
|
||||
}
|
||||
35
compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchOnOverride.txt
vendored
Normal file
35
compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchOnOverride.txt
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
package
|
||||
|
||||
@An public interface A {
|
||||
@An public abstract val p1: @An kotlin.String
|
||||
@An public abstract var p2: @An kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
@An public abstract fun test(/*0*/ @An arg: @An kotlin.String): @An kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.VALUE_PARAMETER}) public final annotation class An : kotlin.Annotation {
|
||||
public constructor An()
|
||||
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
|
||||
}
|
||||
|
||||
@An public interface B : A {
|
||||
public abstract override /*1*/ val p1: kotlin.Int
|
||||
@An public abstract override /*1*/ val p2: @An kotlin.String
|
||||
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 abstract override /*1*/ fun test(/*0*/ arg: kotlin.String): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface C : A {
|
||||
@An public abstract override /*1*/ /*fake_override*/ val p1: @An kotlin.String
|
||||
public abstract override /*1*/ var p2: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
@An public abstract override /*1*/ /*fake_override*/ fun test(/*0*/ @An arg: @An kotlin.String): @An kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
42
compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchOnOverrideJavaNullable.kt
vendored
Normal file
42
compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchOnOverrideJavaNullable.kt
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
// !RENDER_DIAGNOSTICS_MESSAGES
|
||||
// JAVAC_SKIP
|
||||
|
||||
// FILE: A.java
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
@javax.annotation.meta.TypeQualifier
|
||||
public @interface MyTypeQualifier {}
|
||||
|
||||
@An
|
||||
public interface A {
|
||||
@NotNull
|
||||
@An
|
||||
@MyTypeQualifier
|
||||
String foo();
|
||||
}
|
||||
|
||||
// FILE: k.kt
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.VALUE_PARAMETER)
|
||||
annotation class An
|
||||
|
||||
class B : A {
|
||||
override fun foo(): <!RETURN_TYPE_MISMATCH_ON_OVERRIDE("foo", "@NotNull @MyTypeQualifier public abstract fun foo(): String defined in A")!>String?<!> = null
|
||||
}
|
||||
|
||||
@An
|
||||
public interface C {
|
||||
@NotNull
|
||||
@An
|
||||
fun foo(): String
|
||||
}
|
||||
|
||||
class D : C {
|
||||
override fun foo(): <!RETURN_TYPE_MISMATCH_ON_OVERRIDE("foo", "public abstract fun foo(): String defined in C")!>String?<!> = null
|
||||
}
|
||||
38
compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchOnOverrideJavaNullable.txt
vendored
Normal file
38
compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchOnOverrideJavaNullable.txt
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
package
|
||||
|
||||
@An public interface A {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@org.jetbrains.annotations.NotNull @An @MyTypeQualifier public abstract fun foo(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.VALUE_PARAMETER}) public final annotation class An : kotlin.Annotation {
|
||||
public constructor An()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class B : A {
|
||||
public constructor B()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ fun foo(): kotlin.String?
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@An public interface C {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@org.jetbrains.annotations.NotNull @An public abstract fun foo(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class D : C {
|
||||
public constructor D()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ fun foo(): kotlin.String?
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
12
compiler/testData/diagnostics/tests/annotations/rendering/unusedValue.kt
vendored
Normal file
12
compiler/testData/diagnostics/tests/annotations/rendering/unusedValue.kt
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// !RENDER_DIAGNOSTICS_MESSAGES
|
||||
// !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE
|
||||
|
||||
@Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.LOCAL_VARIABLE)
|
||||
annotation class A
|
||||
|
||||
@A
|
||||
fun test() {
|
||||
@A
|
||||
var b: @A Int = 0
|
||||
<!UNUSED_VALUE("15", "var b: Int defined in test")!>b =<!> 15
|
||||
}
|
||||
10
compiler/testData/diagnostics/tests/annotations/rendering/unusedValue.txt
vendored
Normal file
10
compiler/testData/diagnostics/tests/annotations/rendering/unusedValue.txt
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
package
|
||||
|
||||
@A public fun test(): kotlin.Unit
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.LOCAL_VARIABLE}) public final annotation class A : kotlin.Annotation {
|
||||
public constructor A()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -828,6 +828,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("annotationRenderingInTypes.kt")
|
||||
public void testAnnotationRenderingInTypes() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/annotationRenderingInTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("AnnotationsForClasses.kt")
|
||||
public void testAnnotationsForClasses() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/AnnotationsForClasses.kt");
|
||||
@@ -1425,6 +1430,74 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/annotations/rendering")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Rendering extends AbstractDiagnosticsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInRendering() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/annotations/rendering"), Pattern.compile("^(.*)\\.kts?$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("cannotOverrideInvisibleMember.kt")
|
||||
public void testCannotOverrideInvisibleMember() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/cannotOverrideInvisibleMember.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("conflictingOverloads.kt")
|
||||
public void testConflictingOverloads() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/conflictingOverloads.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("differentNamesForParameter.kt")
|
||||
public void testDifferentNamesForParameter() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/differentNamesForParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberProjectedOut.kt")
|
||||
public void testMemberProjectedOut() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/memberProjectedOut.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multipleInheritedDefaults.kt")
|
||||
public void testMultipleInheritedDefaults() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/multipleInheritedDefaults.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("notImplementedMembers.kt")
|
||||
public void testNotImplementedMembers() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/notImplementedMembers.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("tooManyArguments.kt")
|
||||
public void testTooManyArguments() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/tooManyArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeMismatchDueToTypeProjections.kt")
|
||||
public void testTypeMismatchDueToTypeProjections() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchDueToTypeProjections.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeMismatchOnOverride.kt")
|
||||
public void testTypeMismatchOnOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchOnOverride.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeMismatchOnOverrideJavaNullable.kt")
|
||||
public void testTypeMismatchOnOverrideJavaNullable() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchOnOverrideJavaNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unusedValue.kt")
|
||||
public void testUnusedValue() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/unusedValue.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -828,6 +828,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("annotationRenderingInTypes.kt")
|
||||
public void testAnnotationRenderingInTypes() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/annotationRenderingInTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("AnnotationsForClasses.kt")
|
||||
public void testAnnotationsForClasses() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/AnnotationsForClasses.kt");
|
||||
@@ -1420,6 +1425,74 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/annotations/rendering")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Rendering extends AbstractDiagnosticsUsingJavacTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInRendering() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/annotations/rendering"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("cannotOverrideInvisibleMember.kt")
|
||||
public void testCannotOverrideInvisibleMember() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/cannotOverrideInvisibleMember.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("conflictingOverloads.kt")
|
||||
public void testConflictingOverloads() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/conflictingOverloads.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("differentNamesForParameter.kt")
|
||||
public void testDifferentNamesForParameter() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/differentNamesForParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberProjectedOut.kt")
|
||||
public void testMemberProjectedOut() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/memberProjectedOut.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multipleInheritedDefaults.kt")
|
||||
public void testMultipleInheritedDefaults() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/multipleInheritedDefaults.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("notImplementedMembers.kt")
|
||||
public void testNotImplementedMembers() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/notImplementedMembers.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("tooManyArguments.kt")
|
||||
public void testTooManyArguments() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/tooManyArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeMismatchDueToTypeProjections.kt")
|
||||
public void testTypeMismatchDueToTypeProjections() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchDueToTypeProjections.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeMismatchOnOverride.kt")
|
||||
public void testTypeMismatchOnOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchOnOverride.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeMismatchOnOverrideJavaNullable.kt")
|
||||
public void testTypeMismatchOnOverrideJavaNullable() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/typeMismatchOnOverrideJavaNullable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("unusedValue.kt")
|
||||
public void testUnusedValue() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/annotations/rendering/unusedValue.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/annotations/withUseSiteTarget")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.platform
|
||||
|
||||
import org.jetbrains.kotlin.container.DefaultImplementation
|
||||
import org.jetbrains.kotlin.container.PlatformSpecificExtension
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
|
||||
@DefaultImplementation(impl = PlatformSpecificDiagnosticComponents.Default::class)
|
||||
interface PlatformSpecificDiagnosticComponents : PlatformSpecificExtension<PlatformSpecificDiagnosticComponents> {
|
||||
fun isNullabilityAnnotation(
|
||||
annotationDescriptor: AnnotationDescriptor,
|
||||
containingDeclaration: DeclarationDescriptor
|
||||
): Boolean
|
||||
|
||||
object Default : PlatformSpecificDiagnosticComponents {
|
||||
override fun isNullabilityAnnotation(
|
||||
annotationDescriptor: AnnotationDescriptor,
|
||||
containingDeclaration: DeclarationDescriptor
|
||||
): Boolean = false
|
||||
}
|
||||
}
|
||||
@@ -142,6 +142,11 @@ abstract class DescriptorRenderer {
|
||||
|
||||
@JvmField
|
||||
val FQ_NAMES_IN_TYPES: DescriptorRenderer = withOptions {
|
||||
modifiers = DescriptorRendererModifier.ALL_EXCEPT_ANNOTATIONS
|
||||
}
|
||||
|
||||
@JvmField
|
||||
val FQ_NAMES_IN_TYPES_WITH_ANNOTATIONS: DescriptorRenderer = withOptions {
|
||||
modifiers = DescriptorRendererModifier.ALL
|
||||
}
|
||||
|
||||
@@ -301,7 +306,7 @@ enum class DescriptorRendererModifier(val includeByDefault: Boolean) {
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
val DEFAULTS = values().filter { it.includeByDefault }.toSet()
|
||||
val ALL_EXCEPT_ANNOTATIONS = values().filter { it.includeByDefault }.toSet()
|
||||
|
||||
@JvmField
|
||||
val ALL = values().toSet()
|
||||
|
||||
@@ -69,7 +69,7 @@ internal class DescriptorRendererOptionsImpl : DescriptorRendererOptions {
|
||||
override var classifierNamePolicy: ClassifierNamePolicy by property(ClassifierNamePolicy.SOURCE_CODE_QUALIFIED)
|
||||
override var withDefinedIn by property(true)
|
||||
override var withSourceFileForTopLevel by property(true)
|
||||
override var modifiers: Set<DescriptorRendererModifier> by property(DescriptorRendererModifier.DEFAULTS)
|
||||
override var modifiers: Set<DescriptorRendererModifier> by property(DescriptorRendererModifier.ALL_EXCEPT_ANNOTATIONS)
|
||||
override var startFromName by property(false)
|
||||
override var startFromDeclarationKeyword by property(false)
|
||||
override var debugMode by property(false)
|
||||
|
||||
@@ -116,7 +116,7 @@ public class IdeErrorMessages {
|
||||
"<tr><td>Parameter:</td><td>{1}</td></tr></table></html>", HTML_RENDER_TYPE, HTML_RENDER_TYPE);
|
||||
|
||||
MAP.put(RETURN_TYPE_MISMATCH_ON_OVERRIDE, "<html>Return type is ''{0}'', which is not a subtype of overridden<br/>" +
|
||||
"{1}</html>", HTML_RENDER_RETURN_TYPE, HTML);
|
||||
"{1}</html>", HTML_RENDER_RETURN_TYPE, HTML_WITH_ANNOTATIONS_WHITELIST);
|
||||
MAP.put(RETURN_TYPE_MISMATCH_ON_INHERITANCE, "<html>Return types of inherited members are incompatible:<br/>{0},<br/>{1}</html>",
|
||||
HTML, HTML);
|
||||
|
||||
|
||||
@@ -36,6 +36,6 @@ object IdeMultiplatformDiagnosticRenderingMode : MultiplatformDiagnosticRenderin
|
||||
}
|
||||
|
||||
override fun renderDescriptor(sb: StringBuilder, descriptor: DeclarationDescriptor, context: RenderingContext, indent: String) {
|
||||
sb.append(IdeRenderers.HTML.render(descriptor, context))
|
||||
sb.append(IdeRenderers.HTML_WITH_ANNOTATIONS.render(descriptor, context))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.*
|
||||
import org.jetbrains.kotlin.idea.highlighter.renderersUtil.renderResolvedCall
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRendererModifier
|
||||
import org.jetbrains.kotlin.resolve.MemberComparator
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.InferenceErrorData
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||
@@ -37,7 +38,10 @@ object IdeRenderers {
|
||||
}
|
||||
|
||||
@JvmField
|
||||
val HTML_RENDER_TYPE = SmartTypeRenderer(DescriptorRenderer.HTML.withOptions { parameterNamesInFunctionalTypes = false })
|
||||
val HTML_RENDER_TYPE = SmartTypeRenderer(DescriptorRenderer.HTML.withOptions {
|
||||
parameterNamesInFunctionalTypes = false
|
||||
modifiers = DescriptorRendererModifier.ALL_EXCEPT_ANNOTATIONS
|
||||
})
|
||||
|
||||
@JvmField
|
||||
val HTML_NONE_APPLICABLE_CALLS = Renderer { calls: Collection<ResolvedCall<*>> ->
|
||||
@@ -91,5 +95,11 @@ object IdeRenderers {
|
||||
}
|
||||
|
||||
@JvmField
|
||||
val HTML = DescriptorRenderer.HTML.asRenderer()
|
||||
val HTML = DescriptorRenderer.HTML.withOptions {
|
||||
modifiers = DescriptorRendererModifier.ALL_EXCEPT_ANNOTATIONS
|
||||
}.asRenderer()
|
||||
@JvmField val HTML_WITH_ANNOTATIONS = DescriptorRenderer.HTML.withOptions {
|
||||
modifiers = DescriptorRendererModifier.ALL
|
||||
}.asRenderer()
|
||||
@JvmField val HTML_WITH_ANNOTATIONS_WHITELIST = DescriptorRenderer.HTML.withAnnotationsWhitelist()
|
||||
}
|
||||
|
||||
@@ -55,16 +55,21 @@ class ChangeSuperTypeListEntryTypeArgumentFix(
|
||||
|
||||
companion object : KotlinSingleIntentionActionFactory() {
|
||||
override fun createAction(diagnostic: Diagnostic): IntentionAction? {
|
||||
val casted = when (diagnostic.factory) {
|
||||
Errors.RETURN_TYPE_MISMATCH_ON_OVERRIDE -> Errors.RETURN_TYPE_MISMATCH_ON_OVERRIDE.cast(diagnostic)
|
||||
Errors.PROPERTY_TYPE_MISMATCH_ON_OVERRIDE -> Errors.PROPERTY_TYPE_MISMATCH_ON_OVERRIDE.cast(diagnostic)
|
||||
val (casted, declaration) = when (diagnostic.factory) {
|
||||
Errors.RETURN_TYPE_MISMATCH_ON_OVERRIDE -> {
|
||||
val casted = Errors.RETURN_TYPE_MISMATCH_ON_OVERRIDE.cast(diagnostic)
|
||||
casted to casted.b.declaration
|
||||
}
|
||||
Errors.PROPERTY_TYPE_MISMATCH_ON_OVERRIDE -> {
|
||||
val casted = Errors.PROPERTY_TYPE_MISMATCH_ON_OVERRIDE.cast(diagnostic)
|
||||
casted to casted.b
|
||||
}
|
||||
else -> null
|
||||
} ?: return null
|
||||
|
||||
val type = casted.a.returnType?.toString() ?: return null
|
||||
|
||||
val superClassDescriptor = casted.b.containingDeclaration as? ClassDescriptor ?: return null
|
||||
val superDeclaration = DescriptorToSourceUtils.descriptorToDeclaration(casted.b) as? KtNamedDeclaration ?: return null
|
||||
val superClassDescriptor = declaration.containingDeclaration as? ClassDescriptor ?: return null
|
||||
val superDeclaration = DescriptorToSourceUtils.descriptorToDeclaration(declaration) as? KtNamedDeclaration ?: return null
|
||||
val superTypeReference = superDeclaration.getReturnTypeReference()?.text ?: return null
|
||||
val typeParameterIndex = superClassDescriptor.declaredTypeParameters.map { it.name.asString() }.indexOf(superTypeReference)
|
||||
if (typeParameterIndex < 0) return null
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// PROBLEM: none
|
||||
// ERROR: Assignment operators ambiguity: <br>public operator fun <T> Collection<Int>.plus(element: Int): List<Int> defined in kotlin.collections<br>@InlineOnly public inline operator fun <T> MutableCollection<in Int>.plusAssign(element: Int): Unit defined in kotlin.collections
|
||||
// ERROR: Assignment operators ambiguity: <br>public operator fun <T> Collection<Int>.plus(element: Int): List<Int> defined in kotlin.collections<br>public inline operator fun <T> MutableCollection<in Int>.plusAssign(element: Int): Unit defined in kotlin.collections
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
var list = mutableListOf(1)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// PROBLEM: none
|
||||
// ERROR: Assignment operators ambiguity: <br>public operator fun <K, V> Map<out Int, Int>.plus(pair: Pair<Int, Int>): Map<Int, Int> defined in kotlin.collections<br>@InlineOnly public inline operator fun <K, V> MutableMap<in Int, in Int>.plusAssign(pair: Pair<Int, Int>): Unit defined in kotlin.collections
|
||||
// ERROR: Assignment operators ambiguity: <br>public operator fun <K, V> Map<out Int, Int>.plus(pair: Pair<Int, Int>): Map<Int, Int> defined in kotlin.collections<br>public inline operator fun <K, V> MutableMap<in Int, in Int>.plusAssign(pair: Pair<Int, Int>): Unit defined in kotlin.collections
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
var map = mutableMapOf(1 to 2)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// PROBLEM: none
|
||||
// ERROR: Assignment operators ambiguity: <br>public operator fun <T> Set<Int>.plus(element: Int): Set<Int> defined in kotlin.collections<br>@InlineOnly public inline operator fun <T> MutableCollection<in Int>.plusAssign(element: Int): Unit defined in kotlin.collections
|
||||
// ERROR: Assignment operators ambiguity: <br>public operator fun <T> Set<Int>.plus(element: Int): Set<Int> defined in kotlin.collections<br>public inline operator fun <T> MutableCollection<in Int>.plusAssign(element: Int): Unit defined in kotlin.collections
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
var set = mutableSetOf(1)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ACTION: Replace with 'plusAssign()' call
|
||||
// ACTION: Replace with ordinary assignment
|
||||
// ERROR: Assignment operators ambiguity: <br>public operator fun <T> Collection<Int>.plus(element: Int): List<Int> defined in kotlin.collections<br>@InlineOnly public inline operator fun <T> MutableCollection<in Int>.plusAssign(element: Int): Unit defined in kotlin.collections
|
||||
// ERROR: Assignment operators ambiguity: <br>public operator fun <T> Collection<Int>.plus(element: Int): List<Int> defined in kotlin.collections<br>public inline operator fun <T> MutableCollection<in Int>.plusAssign(element: Int): Unit defined in kotlin.collections
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Test {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ACTION: Create extension function 'A.minus'
|
||||
// ACTION: Create member function 'A.minus'
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ERROR: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: <br>@InlineOnly public inline operator fun BigDecimal.minus(other: BigDecimal): BigDecimal defined in kotlin<br>@InlineOnly public inline operator fun BigInteger.minus(other: BigInteger): BigInteger defined in kotlin<br>public operator fun <T> Iterable<???>.minus(elements: Array<out ???>): List<???> defined in kotlin.collections<br>public operator fun <T> Iterable<???>.minus(elements: Iterable<???>): List<???> defined in kotlin.collections<br>public operator fun <T> Iterable<???>.minus(elements: Sequence<???>): List<???> defined in kotlin.collections<br>public operator fun <T> Iterable<A>.minus(element: A): List<A> defined in kotlin.collections<br>@SinceKotlin public operator fun <K, V> Map<out ???, ???>.minus(keys: Array<out ???>): Map<???, ???> defined in kotlin.collections<br>@SinceKotlin public operator fun <K, V> Map<out ???, ???>.minus(keys: Iterable<???>): Map<???, ???> defined in kotlin.collections<br>@SinceKotlin public operator fun <K, V> Map<out ???, ???>.minus(keys: Sequence<???>): Map<???, ???> defined in kotlin.collections<br>@SinceKotlin public operator fun <K, V> Map<out A, ???>.minus(key: A): Map<A, ???> defined in kotlin.collections<br>public operator fun <T> Set<???>.minus(elements: Array<out ???>): Set<???> defined in kotlin.collections<br>public operator fun <T> Set<???>.minus(elements: Iterable<???>): Set<???> defined in kotlin.collections<br>public operator fun <T> Set<???>.minus(elements: Sequence<???>): Set<???> defined in kotlin.collections<br>public operator fun <T> Set<A>.minus(element: A): Set<A> defined in kotlin.collections<br>public operator fun <T> Sequence<???>.minus(elements: Array<out ???>): Sequence<???> defined in kotlin.sequences<br>public operator fun <T> Sequence<???>.minus(elements: Iterable<???>): Sequence<???> defined in kotlin.sequences<br>public operator fun <T> Sequence<???>.minus(elements: Sequence<???>): Sequence<???> defined in kotlin.sequences<br>public operator fun <T> Sequence<A>.minus(element: A): Sequence<A> defined in kotlin.sequences
|
||||
// ERROR: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: <br>public inline operator fun BigDecimal.minus(other: BigDecimal): BigDecimal defined in kotlin<br>public inline operator fun BigInteger.minus(other: BigInteger): BigInteger defined in kotlin<br>public operator fun <T> Iterable<???>.minus(elements: Array<out ???>): List<???> defined in kotlin.collections<br>public operator fun <T> Iterable<???>.minus(elements: Iterable<???>): List<???> defined in kotlin.collections<br>public operator fun <T> Iterable<???>.minus(elements: Sequence<???>): List<???> defined in kotlin.collections<br>public operator fun <T> Iterable<A>.minus(element: A): List<A> defined in kotlin.collections<br>public operator fun <K, V> Map<out ???, ???>.minus(keys: Array<out ???>): Map<???, ???> defined in kotlin.collections<br>public operator fun <K, V> Map<out ???, ???>.minus(keys: Iterable<???>): Map<???, ???> defined in kotlin.collections<br>public operator fun <K, V> Map<out ???, ???>.minus(keys: Sequence<???>): Map<???, ???> defined in kotlin.collections<br>public operator fun <K, V> Map<out A, ???>.minus(key: A): Map<A, ???> defined in kotlin.collections<br>public operator fun <T> Set<???>.minus(elements: Array<out ???>): Set<???> defined in kotlin.collections<br>public operator fun <T> Set<???>.minus(elements: Iterable<???>): Set<???> defined in kotlin.collections<br>public operator fun <T> Set<???>.minus(elements: Sequence<???>): Set<???> defined in kotlin.collections<br>public operator fun <T> Set<A>.minus(element: A): Set<A> defined in kotlin.collections<br>public operator fun <T> Sequence<???>.minus(elements: Array<out ???>): Sequence<???> defined in kotlin.sequences<br>public operator fun <T> Sequence<???>.minus(elements: Iterable<???>): Sequence<???> defined in kotlin.sequences<br>public operator fun <T> Sequence<???>.minus(elements: Sequence<???>): Sequence<???> defined in kotlin.sequences<br>public operator fun <T> Sequence<A>.minus(element: A): Sequence<A> defined in kotlin.sequences
|
||||
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||
class A
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// ACTION: Create extension function 'A.minus'
|
||||
// ACTION: Create member function 'A.minus'
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ERROR: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: <br>@InlineOnly public inline operator fun BigDecimal.minus(other: BigDecimal): BigDecimal defined in kotlin<br>@InlineOnly public inline operator fun BigInteger.minus(other: BigInteger): BigInteger defined in kotlin<br>public operator fun <T> Iterable<???>.minus(elements: Array<out ???>): List<???> defined in kotlin.collections<br>public operator fun <T> Iterable<???>.minus(elements: Iterable<???>): List<???> defined in kotlin.collections<br>public operator fun <T> Iterable<???>.minus(elements: Sequence<???>): List<???> defined in kotlin.collections<br>public operator fun <T> Iterable<A>.minus(element: A): List<A> defined in kotlin.collections<br>@SinceKotlin public operator fun <K, V> Map<out ???, ???>.minus(keys: Array<out ???>): Map<???, ???> defined in kotlin.collections<br>@SinceKotlin public operator fun <K, V> Map<out ???, ???>.minus(keys: Iterable<???>): Map<???, ???> defined in kotlin.collections<br>@SinceKotlin public operator fun <K, V> Map<out ???, ???>.minus(keys: Sequence<???>): Map<???, ???> defined in kotlin.collections<br>@SinceKotlin public operator fun <K, V> Map<out A, ???>.minus(key: A): Map<A, ???> defined in kotlin.collections<br>public operator fun <T> Set<???>.minus(elements: Array<out ???>): Set<???> defined in kotlin.collections<br>public operator fun <T> Set<???>.minus(elements: Iterable<???>): Set<???> defined in kotlin.collections<br>public operator fun <T> Set<???>.minus(elements: Sequence<???>): Set<???> defined in kotlin.collections<br>public operator fun <T> Set<A>.minus(element: A): Set<A> defined in kotlin.collections<br>public operator fun <T> Sequence<???>.minus(elements: Array<out ???>): Sequence<???> defined in kotlin.sequences<br>public operator fun <T> Sequence<???>.minus(elements: Iterable<???>): Sequence<???> defined in kotlin.sequences<br>public operator fun <T> Sequence<???>.minus(elements: Sequence<???>): Sequence<???> defined in kotlin.sequences<br>public operator fun <T> Sequence<A>.minus(element: A): Sequence<A> defined in kotlin.sequences
|
||||
// ERROR: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: <br>public inline operator fun BigDecimal.minus(other: BigDecimal): BigDecimal defined in kotlin<br>public inline operator fun BigInteger.minus(other: BigInteger): BigInteger defined in kotlin<br>public operator fun <T> Iterable<???>.minus(elements: Array<out ???>): List<???> defined in kotlin.collections<br>public operator fun <T> Iterable<???>.minus(elements: Iterable<???>): List<???> defined in kotlin.collections<br>public operator fun <T> Iterable<???>.minus(elements: Sequence<???>): List<???> defined in kotlin.collections<br>public operator fun <T> Iterable<A>.minus(element: A): List<A> defined in kotlin.collections<br>public operator fun <K, V> Map<out ???, ???>.minus(keys: Array<out ???>): Map<???, ???> defined in kotlin.collections<br>public operator fun <K, V> Map<out ???, ???>.minus(keys: Iterable<???>): Map<???, ???> defined in kotlin.collections<br>public operator fun <K, V> Map<out ???, ???>.minus(keys: Sequence<???>): Map<???, ???> defined in kotlin.collections<br>public operator fun <K, V> Map<out A, ???>.minus(key: A): Map<A, ???> defined in kotlin.collections<br>public operator fun <T> Set<???>.minus(elements: Array<out ???>): Set<???> defined in kotlin.collections<br>public operator fun <T> Set<???>.minus(elements: Iterable<???>): Set<???> defined in kotlin.collections<br>public operator fun <T> Set<???>.minus(elements: Sequence<???>): Set<???> defined in kotlin.collections<br>public operator fun <T> Set<A>.minus(element: A): Set<A> defined in kotlin.collections<br>public operator fun <T> Sequence<???>.minus(elements: Array<out ???>): Sequence<???> defined in kotlin.sequences<br>public operator fun <T> Sequence<???>.minus(elements: Iterable<???>): Sequence<???> defined in kotlin.sequences<br>public operator fun <T> Sequence<???>.minus(elements: Sequence<???>): Sequence<???> defined in kotlin.sequences<br>public operator fun <T> Sequence<A>.minus(element: A): Sequence<A> defined in kotlin.sequences
|
||||
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
|
||||
class A
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.replaceWith.DeprecatedSymbolUsageFix" "false"
|
||||
// ERROR: Too many arguments for @Deprecated public fun oldFun(): Unit defined in root package in file callWithError.kt
|
||||
// ERROR: Too many arguments for public fun oldFun(): Unit defined in root package in file callWithError.kt
|
||||
|
||||
@Deprecated("", ReplaceWith("newFun()"))
|
||||
fun oldFun() {
|
||||
|
||||
@@ -9,6 +9,6 @@ fun goo(a: String) { // ERROR: Unresolved reference: goo
|
||||
}
|
||||
/** unresolvedMultiline.kts:3 Unresolved reference: foo */
|
||||
/** unresolvedMultiline.kts:3 Overload resolution ambiguity:
|
||||
@HidesMembers public inline fun <T> Iterable<TypeVariable(T)>.forEach(action: (TypeVariable(T)) -> Unit): Unit defined in kotlin.collections
|
||||
@HidesMembers public inline fun <K, V> Map<out TypeVariable(K), TypeVariable(V)>.forEach(action: (Map.Entry<TypeVariable(K), TypeVariable(V)>) -> Unit): Unit defined in kotlin.collections */
|
||||
public inline fun <T> Iterable<TypeVariable(T)>.forEach(action: (TypeVariable(T)) -> Unit): Unit defined in kotlin.collections
|
||||
public inline fun <K, V> Map<out TypeVariable(K), TypeVariable(V)>.forEach(action: (Map.Entry<TypeVariable(K), TypeVariable(V)>) -> Unit): Unit defined in kotlin.collections */
|
||||
/** unresolvedMultiline.kts:7 Unresolved reference: goo */
|
||||
@@ -11,8 +11,8 @@ fun goo(a: String) { // ERROR: error: unresolved reference: goo...
|
||||
foo.forEach {
|
||||
^
|
||||
error: cannot choose among the following candidates without completing type inference:
|
||||
@HidesMembers public inline fun <T> Iterable<???>.forEach(action: (???) -> Unit): Unit defined in kotlin.collections
|
||||
@HidesMembers public inline fun <K, V> Map<out ???, ???>.forEach(action: (Map.Entry<???, ???>) -> Unit): Unit defined in kotlin.collections
|
||||
public inline fun <T> Iterable<???>.forEach(action: (???) -> Unit): Unit defined in kotlin.collections
|
||||
public inline fun <K, V> Map<out ???, ???>.forEach(action: (Map.Entry<???, ???>) -> Unit): Unit defined in kotlin.collections
|
||||
foo.forEach {
|
||||
^ */
|
||||
/** unresolvedMultiline.kts:7 error: unresolved reference: goo
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticFactoryToRendererMap
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.Renderers
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.Renderers.RENDER_CLASS_OR_OBJECT
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.Renderers.RENDER_TYPE
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.Renderers.RENDER_TYPE_WITH_ANNOTATIONS
|
||||
|
||||
object DefaultErrorMessagesAndroid : DefaultErrorMessages.Extension {
|
||||
private val MAP = DiagnosticFactoryToRendererMap("Android")
|
||||
@@ -89,7 +90,7 @@ object DefaultErrorMessagesAndroid : DefaultErrorMessages.Extension {
|
||||
|
||||
MAP.put(ErrorsAndroid.PARCELER_TYPE_INCOMPATIBLE,
|
||||
"Parceler type {0} is incompatible with {1}",
|
||||
RENDER_TYPE, RENDER_TYPE)
|
||||
RENDER_TYPE_WITH_ANNOTATIONS, RENDER_TYPE_WITH_ANNOTATIONS)
|
||||
|
||||
MAP.put(ErrorsAndroid.DUPLICATING_TYPE_PARCELERS,
|
||||
"Duplicating ''TypeParceler'' annotations")
|
||||
|
||||
@@ -45,13 +45,13 @@ object SerializationPluginErrorsRendering : DefaultErrorMessages.Extension {
|
||||
SerializationErrors.SERIALIZER_NOT_FOUND,
|
||||
"Serializer has not been found for type ''{0}''. " +
|
||||
"To use context serializer as fallback, explicitly annotate type or property with @ContextualSerialization",
|
||||
Renderers.RENDER_TYPE
|
||||
Renderers.RENDER_TYPE_WITH_ANNOTATIONS
|
||||
)
|
||||
MAP.put(
|
||||
SerializationErrors.SERIALIZER_NULLABILITY_INCOMPATIBLE,
|
||||
"Type ''{1}'' is non-nullable and therefore can not be serialized with serializer for nullable type ''{0}''",
|
||||
Renderers.RENDER_TYPE,
|
||||
Renderers.RENDER_TYPE
|
||||
Renderers.RENDER_TYPE_WITH_ANNOTATIONS,
|
||||
Renderers.RENDER_TYPE_WITH_ANNOTATIONS
|
||||
)
|
||||
MAP.put(
|
||||
SerializationErrors.TRANSIENT_MISSING_INITIALIZER,
|
||||
|
||||
Reference in New Issue
Block a user