KT-1560
Report warning on extensions shadowed by members.
This commit is contained in:
@@ -80,6 +80,13 @@ public interface Errors {
|
||||
DiagnosticFactory1<PsiElement, String> PACKAGE_OR_CLASSIFIER_REDECLARATION =
|
||||
DiagnosticFactory1.create(ERROR, FOR_REDECLARATION);
|
||||
|
||||
DiagnosticFactory1<KtDeclaration, CallableMemberDescriptor> EXTENSION_SHADOWED_BY_MEMBER =
|
||||
DiagnosticFactory1.create(WARNING, FOR_REDECLARATION);
|
||||
DiagnosticFactory1<KtDeclaration, ConstructorDescriptor> EXTENSION_FUNCTION_SHADOWED_BY_INNER_CLASS_CONSTRUCTOR =
|
||||
DiagnosticFactory1.create(WARNING, FOR_REDECLARATION);
|
||||
DiagnosticFactory2<KtDeclaration, PropertyDescriptor, FunctionDescriptor> EXTENSION_FUNCTION_SHADOWED_BY_MEMBER_PROPERTY_WITH_INVOKE =
|
||||
DiagnosticFactory2.create(WARNING, FOR_REDECLARATION);
|
||||
|
||||
DiagnosticFactory1<KtReferenceExpression, KtReferenceExpression> UNRESOLVED_REFERENCE =
|
||||
DiagnosticFactory1.create(ERROR, FOR_UNRESOLVED_REFERENCE);
|
||||
|
||||
|
||||
+6
@@ -114,6 +114,12 @@ public class DefaultErrorMessages {
|
||||
MAP.put(EXPOSED_SUPER_INTERFACE, "''{0}'' sub-interface exposes its ''{2}'' supertype{1}", TO_STRING, TO_STRING, TO_STRING);
|
||||
MAP.put(EXPOSED_TYPEALIAS_EXPANDED_TYPE, "''{0}'' typealias exposes ''{2}'' in expanded type{1}", TO_STRING, TO_STRING, TO_STRING);
|
||||
|
||||
MAP.put(EXTENSION_SHADOWED_BY_MEMBER, "Extension is shadowed by a member: {0}", COMPACT_WITH_MODIFIERS);
|
||||
MAP.put(EXTENSION_FUNCTION_SHADOWED_BY_INNER_CLASS_CONSTRUCTOR,
|
||||
"Extension function is shadowed by an inner class constructor: {0}", COMPACT_WITH_MODIFIERS);
|
||||
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(REDECLARATION, "Conflicting declarations: {0}", commaSeparated(COMPACT_WITH_MODIFIERS));
|
||||
|
||||
@@ -80,7 +80,7 @@ class DeclarationResolver(
|
||||
|
||||
// TODO: report error on header class and impl val, or vice versa
|
||||
val (header, impl) =
|
||||
getTopLevelDescriptorsByFqName(topLevelDescriptorProvider, fqName, NoLookupLocation.WHEN_CHECK_REDECLARATIONS)
|
||||
getTopLevelDescriptorsByFqName(topLevelDescriptorProvider, fqName, NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS)
|
||||
.partition { it is MemberDescriptor && it.isHeader }
|
||||
|
||||
for (descriptors in listOf(header, impl)) {
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.jetbrains.kotlin.psi.psiUtil.visibilityModifier
|
||||
import org.jetbrains.kotlin.resolve.BindingContext.*
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils.classCanHaveAbstractMembers
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils.classCanHaveOpenMembers
|
||||
import org.jetbrains.kotlin.resolve.calls.results.TypeSpecificityComparator
|
||||
import org.jetbrains.kotlin.resolve.source.KotlinSourceElement
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
|
||||
@@ -45,10 +46,11 @@ internal class DeclarationsCheckerBuilder(
|
||||
private val originalModifiersChecker: ModifiersChecker,
|
||||
private val annotationChecker: AnnotationChecker,
|
||||
private val identifierChecker: IdentifierChecker,
|
||||
private val languageVersionSettings: LanguageVersionSettings
|
||||
private val languageVersionSettings: LanguageVersionSettings,
|
||||
private val typeSpecificityComparator: TypeSpecificityComparator
|
||||
) {
|
||||
fun withTrace(trace: BindingTrace) =
|
||||
DeclarationsChecker(descriptorResolver, originalModifiersChecker, annotationChecker, identifierChecker, trace, languageVersionSettings)
|
||||
DeclarationsChecker(descriptorResolver, originalModifiersChecker, annotationChecker, identifierChecker, trace, languageVersionSettings, typeSpecificityComparator)
|
||||
}
|
||||
|
||||
class DeclarationsChecker(
|
||||
@@ -57,13 +59,16 @@ class DeclarationsChecker(
|
||||
private val annotationChecker: AnnotationChecker,
|
||||
private val identifierChecker: IdentifierChecker,
|
||||
private val trace: BindingTrace,
|
||||
private val languageVersionSettings: LanguageVersionSettings
|
||||
private val languageVersionSettings: LanguageVersionSettings,
|
||||
typeSpecificityComparator: TypeSpecificityComparator
|
||||
) {
|
||||
|
||||
private val modifiersChecker = modifiersChecker.withTrace(trace)
|
||||
|
||||
private val exposedChecker = ExposedVisibilityChecker(trace)
|
||||
|
||||
private val shadowedExtensionChecker = ShadowedExtensionChecker(typeSpecificityComparator, trace)
|
||||
|
||||
fun process(bodiesResolveContext: BodiesResolveContext) {
|
||||
for (file in bodiesResolveContext.files) {
|
||||
checkModifiersAndAnnotationsInPackageDirective(file)
|
||||
@@ -524,6 +529,7 @@ class DeclarationsChecker(
|
||||
checkAccessors(property, propertyDescriptor)
|
||||
checkTypeParameterConstraints(property)
|
||||
exposedChecker.checkProperty(property, propertyDescriptor)
|
||||
shadowedExtensionChecker.checkDeclaration(property, propertyDescriptor)
|
||||
checkPropertyTypeParametersAreUsedInReceiverType(propertyDescriptor)
|
||||
checkImplicitCallableType(property, propertyDescriptor)
|
||||
}
|
||||
@@ -766,6 +772,8 @@ class DeclarationsChecker(
|
||||
if (functionDescriptor.isHeader) {
|
||||
checkHeaderFunction(function)
|
||||
}
|
||||
|
||||
shadowedExtensionChecker.checkDeclaration(function, functionDescriptor)
|
||||
}
|
||||
|
||||
private fun checkHeaderFunction(function: KtNamedFunction) {
|
||||
|
||||
@@ -16,25 +16,22 @@
|
||||
|
||||
package org.jetbrains.kotlin.resolve
|
||||
|
||||
import com.intellij.util.containers.MultiMap
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.name.FqNameUnsafe
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemBuilderImpl
|
||||
import org.jetbrains.kotlin.resolve.calls.results.FlatSignature
|
||||
import org.jetbrains.kotlin.resolve.calls.results.SpecificityComparisonCallbacks
|
||||
import org.jetbrains.kotlin.resolve.calls.results.TypeSpecificityComparator
|
||||
import org.jetbrains.kotlin.resolve.calls.results.isSignatureNotLessSpecific
|
||||
import org.jetbrains.kotlin.resolve.calls.tower.getTypeAliasConstructors
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.hasLowPriorityInOverloadResolution
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.varargParameterPosition
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.isExtensionProperty
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.varargParameterPosition
|
||||
import org.jetbrains.kotlin.types.ErrorUtils
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
||||
import java.util.*
|
||||
|
||||
object OverloadabilitySpecificityCallbacks : SpecificityComparisonCallbacks {
|
||||
override fun isNonSubtypeNotLessSpecific(specific: KotlinType, general: KotlinType): Boolean =
|
||||
false
|
||||
}
|
||||
|
||||
class OverloadChecker(val specificityComparator: TypeSpecificityComparator) {
|
||||
/**
|
||||
@@ -50,11 +47,6 @@ class OverloadChecker(val specificityComparator: TypeSpecificityComparator) {
|
||||
return checkOverloadability(a, b)
|
||||
}
|
||||
|
||||
private object OverloadabilitySpecificityCallbacks : SpecificityComparisonCallbacks {
|
||||
override fun isNonSubtypeNotLessSpecific(specific: KotlinType, general: KotlinType): Boolean =
|
||||
false
|
||||
}
|
||||
|
||||
private fun checkOverloadability(a: CallableDescriptor, b: CallableDescriptor): Boolean {
|
||||
if (a.hasLowPriorityInOverloadResolution() != b.hasLowPriorityInOverloadResolution()) return true
|
||||
|
||||
@@ -69,7 +61,7 @@ class OverloadChecker(val specificityComparator: TypeSpecificityComparator) {
|
||||
val aSignature = FlatSignature.createFromCallableDescriptor(a)
|
||||
val bSignature = FlatSignature.createFromCallableDescriptor(b)
|
||||
|
||||
val aIsNotLessSpecificThanB = ConstraintSystemBuilderImpl.forSpecificity().isSignatureNotLessSpecific (aSignature, bSignature, OverloadabilitySpecificityCallbacks, specificityComparator)
|
||||
val aIsNotLessSpecificThanB = ConstraintSystemBuilderImpl.forSpecificity().isSignatureNotLessSpecific(aSignature, bSignature, OverloadabilitySpecificityCallbacks, specificityComparator)
|
||||
val bIsNotLessSpecificThanA = ConstraintSystemBuilderImpl.forSpecificity().isSignatureNotLessSpecific(bSignature, aSignature, OverloadabilitySpecificityCallbacks, specificityComparator)
|
||||
|
||||
return !(aIsNotLessSpecificThanB && bIsNotLessSpecificThanA)
|
||||
|
||||
@@ -96,8 +96,8 @@ class OverloadResolver(
|
||||
overloadFilter
|
||||
) {
|
||||
scope, name ->
|
||||
val functions = scope.getContributedFunctions(name, NoLookupLocation.WHEN_CHECK_REDECLARATIONS)
|
||||
val classifier = scope.getContributedClassifier(name, NoLookupLocation.WHEN_CHECK_REDECLARATIONS)
|
||||
val functions = scope.getContributedFunctions(name, NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS)
|
||||
val classifier = scope.getContributedClassifier(name, NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS)
|
||||
when (classifier) {
|
||||
is ClassDescriptor ->
|
||||
if (!classifier.kind.isSingleton)
|
||||
@@ -113,8 +113,8 @@ class OverloadResolver(
|
||||
|
||||
collectModulePackageMembersWithSameName(packageMembersByName, c.properties.values, overloadFilter) {
|
||||
scope, name ->
|
||||
val variables = scope.getContributedVariables(name, NoLookupLocation.WHEN_CHECK_REDECLARATIONS)
|
||||
val classifier = scope.getContributedClassifier(name, NoLookupLocation.WHEN_CHECK_REDECLARATIONS)
|
||||
val variables = scope.getContributedVariables(name, NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS)
|
||||
val classifier = scope.getContributedClassifier(name, NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS)
|
||||
variables + classifier.singletonOrEmptyList()
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright 2010-2017 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.resolve
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemBuilderImpl
|
||||
import org.jetbrains.kotlin.resolve.calls.results.FlatSignature
|
||||
import org.jetbrains.kotlin.resolve.calls.results.TypeSpecificityComparator
|
||||
import org.jetbrains.kotlin.resolve.calls.results.isSignatureNotLessSpecific
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.hasHidesMembersAnnotation
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.isExtension
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.varargParameterPosition
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
|
||||
class ShadowedExtensionChecker(val typeSpecificityComparator: TypeSpecificityComparator, val trace: DiagnosticSink) {
|
||||
fun checkDeclaration(declaration: KtDeclaration, descriptor: DeclarationDescriptor) {
|
||||
if (declaration.name == null) return
|
||||
if (descriptor !is CallableMemberDescriptor) return
|
||||
if (descriptor.hasHidesMembersAnnotation()) return
|
||||
val extensionReceiverType = descriptor.extensionReceiverParameter?.type ?: return
|
||||
if (extensionReceiverType.isError) return
|
||||
if (extensionReceiverType.isMarkedNullable) return
|
||||
|
||||
when (descriptor) {
|
||||
is FunctionDescriptor ->
|
||||
checkShadowedExtensionFunction(declaration, descriptor, trace)
|
||||
is PropertyDescriptor ->
|
||||
checkShadowedExtensionProperty(declaration, descriptor, trace)
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkShadowedExtensionFunction(declaration: KtDeclaration, extensionFunction: FunctionDescriptor, trace: DiagnosticSink) {
|
||||
val memberScope = extensionFunction.extensionReceiverParameter?.type?.memberScope ?: return
|
||||
|
||||
for (memberFunction in memberScope.getContributedFunctions(extensionFunction.name, NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS)) {
|
||||
if (memberFunction.isPublic() && isExtensionFunctionShadowedByMemberFunction(extensionFunction, memberFunction)) {
|
||||
trace.report(Errors.EXTENSION_SHADOWED_BY_MEMBER.on(declaration, memberFunction))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
val nestedClass = memberScope.getContributedClassifier(extensionFunction.name, NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS)
|
||||
if (nestedClass is ClassDescriptor && nestedClass.isInner && nestedClass.isPublic()) {
|
||||
for (constructor in nestedClass.constructors) {
|
||||
if (constructor.isPublic() && isExtensionFunctionShadowedByMemberFunction(extensionFunction, constructor)) {
|
||||
trace.report(Errors.EXTENSION_FUNCTION_SHADOWED_BY_INNER_CLASS_CONSTRUCTOR.on(declaration, constructor))
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (memberProperty in memberScope.getContributedVariables(extensionFunction.name, NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS)) {
|
||||
if (!memberProperty.isPublic()) continue
|
||||
|
||||
val invokeOperator = getInvokeOperatorShadowingExtensionFunction(extensionFunction, memberProperty)
|
||||
if (invokeOperator != null) {
|
||||
trace.report(Errors.EXTENSION_FUNCTION_SHADOWED_BY_MEMBER_PROPERTY_WITH_INVOKE.on(declaration, memberProperty, invokeOperator))
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun DeclarationDescriptorWithVisibility.isPublic() =
|
||||
visibility.normalize() == Visibilities.PUBLIC
|
||||
|
||||
private fun isExtensionFunctionShadowedByMemberFunction(extension: FunctionDescriptor, member: FunctionDescriptor): Boolean {
|
||||
// Permissive check:
|
||||
// (1) functions should have same number of arguments;
|
||||
// (2) varargs should be in the same positions;
|
||||
// (3) extension signature should be not less specific than member signature.
|
||||
// (1) & (2) are required so that we can match signatures easily.
|
||||
|
||||
if (extension.valueParameters.size != member.valueParameters.size) return false
|
||||
if (extension.varargParameterPosition() != member.varargParameterPosition()) return false
|
||||
if (extension.isOperator && !member.isOperator) return false
|
||||
|
||||
val extensionSignature = FlatSignature.createForPossiblyShadowedExtension(extension)
|
||||
val memberSignature = FlatSignature.createFromCallableDescriptor(member)
|
||||
return isSignatureNotLessSpecific(extensionSignature, memberSignature)
|
||||
}
|
||||
|
||||
private fun getInvokeOperatorShadowingExtensionFunction(extension: FunctionDescriptor, member: PropertyDescriptor): FunctionDescriptor? =
|
||||
member.type.memberScope.getContributedFunctions(OperatorNameConventions.INVOKE, NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS)
|
||||
.firstOrNull { it.isPublic() && it.isOperator && isExtensionFunctionShadowedByMemberFunction(extension, it) }
|
||||
|
||||
private fun isSignatureNotLessSpecific(extensionSignature: FlatSignature<FunctionDescriptor>, memberSignature: FlatSignature<FunctionDescriptor>): Boolean =
|
||||
ConstraintSystemBuilderImpl.forSpecificity().isSignatureNotLessSpecific(
|
||||
extensionSignature,
|
||||
memberSignature,
|
||||
OverloadabilitySpecificityCallbacks,
|
||||
typeSpecificityComparator
|
||||
)
|
||||
|
||||
private fun checkShadowedExtensionProperty(declaration: KtDeclaration, extensionProperty: PropertyDescriptor, trace: DiagnosticSink) {
|
||||
val memberScope = extensionProperty.extensionReceiverParameter?.type?.memberScope ?: return
|
||||
|
||||
memberScope.getContributedVariables(extensionProperty.name, NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS)
|
||||
.firstOrNull { it.isPublic() && !it.isExtension }
|
||||
?.let { memberProperty ->
|
||||
trace.report(Errors.EXTENSION_SHADOWED_BY_MEMBER.on(declaration, memberProperty))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -32,7 +32,7 @@ import org.jetbrains.kotlin.resolve.OverloadChecker
|
||||
abstract class AbstractLocalRedeclarationChecker(val overloadChecker: OverloadChecker) : LocalRedeclarationChecker {
|
||||
override fun checkBeforeAddingToScope(scope: LexicalScope, newDescriptor: DeclarationDescriptor) {
|
||||
val name = newDescriptor.name
|
||||
val location = NoLookupLocation.WHEN_CHECK_REDECLARATIONS
|
||||
val location = NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS
|
||||
when (newDescriptor) {
|
||||
is ClassifierDescriptor, is VariableDescriptor -> {
|
||||
val otherDescriptor = scope.getContributedClassifier(name, location)
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.descriptors.MemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.synthetic.SyntheticMemberDescriptor
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.hasDefaultValue
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
|
||||
import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
||||
@@ -75,6 +76,17 @@ class FlatSignature<out T> private constructor(
|
||||
): FlatSignature<D> =
|
||||
create(descriptor, descriptor, numDefaults = 0, parameterTypes = descriptor.valueParameters.map { it.argumentValueType })
|
||||
|
||||
fun <D : CallableDescriptor> createForPossiblyShadowedExtension(descriptor: D): FlatSignature<D> =
|
||||
FlatSignature(descriptor,
|
||||
descriptor.typeParameters,
|
||||
valueParameterTypes = descriptor.valueParameters.map { it.argumentValueType },
|
||||
hasExtensionReceiver = false,
|
||||
hasVarargs = descriptor.valueParameters.any { it.varargElementType != null },
|
||||
numDefaults = descriptor.valueParameters.count { it.hasDefaultValue() },
|
||||
isHeader = descriptor is MemberDescriptor && descriptor.isHeader,
|
||||
isSyntheticMember = descriptor is SyntheticMemberDescriptor<*>
|
||||
)
|
||||
|
||||
val ValueParameterDescriptor.argumentValueType get() = varargElementType ?: type
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// !DIAGNOSTICS: -EXTENSION_SHADOWED_BY_MEMBER
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
interface Example {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION, -EXTENSION_SHADOWED_BY_MEMBER
|
||||
|
||||
val topLevelVal = 1
|
||||
fun topLevelFun() = 2
|
||||
|
||||
Vendored
+1
-1
@@ -6,7 +6,7 @@ class A {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
fun A.foo() {}
|
||||
fun A.<!EXTENSION_SHADOWED_BY_MEMBER!>foo<!>() {}
|
||||
|
||||
fun main() {
|
||||
val x = A::foo
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -EXTENSION_SHADOWED_BY_MEMBER
|
||||
|
||||
import kotlin.reflect.*
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
infix fun Int.compareTo(<!UNUSED_PARAMETER!>o<!>: Int) = 0
|
||||
infix fun Int.<!EXTENSION_SHADOWED_BY_MEMBER!>compareTo<!>(<!UNUSED_PARAMETER!>o<!>: Int) = 0
|
||||
|
||||
fun foo(a: Number): Int {
|
||||
val result = (a as Int) compareTo <!DEBUG_INFO_SMARTCAST!>a<!>
|
||||
|
||||
+1
-1
@@ -7,6 +7,6 @@ class T {
|
||||
fun foo() {
|
||||
<!WRONG_MODIFIER_TARGET!>public<!> val <!UNUSED_VARIABLE!>i<!> = 11
|
||||
<!WRONG_MODIFIER_TARGET!>abstract<!> val <!VARIABLE_WITH_NO_TYPE_NO_INITIALIZER, UNUSED_VARIABLE!>j<!>
|
||||
<!WRONG_MODIFIER_TARGET!>override<!> fun T.baz() = 2
|
||||
<!WRONG_MODIFIER_TARGET!>override<!> fun T.<!EXTENSION_SHADOWED_BY_MEMBER!>baz<!>() = 2
|
||||
<!WRONG_MODIFIER_TARGET!>private<!> fun bar() = 2
|
||||
}
|
||||
+1
-1
@@ -7,7 +7,7 @@ class T {
|
||||
<!WRONG_MODIFIER_TARGET!>override<!> fun zzz() {}
|
||||
|
||||
fun foo(t: T) {
|
||||
<!WRONG_MODIFIER_TARGET!>override<!> fun T.baz() = 2
|
||||
<!WRONG_MODIFIER_TARGET!>override<!> fun T.<!EXTENSION_SHADOWED_BY_MEMBER!>baz<!>() = 2
|
||||
|
||||
// was "Visibility is unknown yet exception"
|
||||
t.baz()
|
||||
|
||||
@@ -51,7 +51,7 @@ import outer.*
|
||||
val foo : Int = 0
|
||||
}
|
||||
|
||||
fun Any.equals(<!UNUSED_PARAMETER!>other<!> : Any?) : Boolean = true
|
||||
fun Any.<!EXTENSION_SHADOWED_BY_MEMBER!>equals<!>(<!UNUSED_PARAMETER!>other<!> : Any?) : Boolean = true
|
||||
fun Any?.equals1(<!UNUSED_PARAMETER!>other<!> : Any?) : Boolean = true
|
||||
fun Any.equals2(<!UNUSED_PARAMETER!>other<!> : Any?) : Boolean = true
|
||||
|
||||
|
||||
@@ -6,12 +6,12 @@ interface T {
|
||||
|
||||
fun T.bar() {}
|
||||
|
||||
fun T.buzz() {}
|
||||
fun T.<!EXTENSION_SHADOWED_BY_MEMBER!>buzz<!>() {}
|
||||
fun T.buzz1() {}
|
||||
|
||||
class C : T {
|
||||
fun test() {
|
||||
fun T.buzz() {}
|
||||
fun T.<!EXTENSION_SHADOWED_BY_MEMBER!>buzz<!>() {}
|
||||
fun T.buzz1() {}
|
||||
super.foo() // OK
|
||||
<!SUPER_CANT_BE_EXTENSION_RECEIVER!>super<!>.bar() // Error
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ fun test2(z: Z) {
|
||||
}
|
||||
|
||||
//'equals' operation
|
||||
fun Z.equals(any: Any): Int { use(any); return 1 }
|
||||
fun Z.<!EXTENSION_SHADOWED_BY_MEMBER!>equals<!>(any: Any): Int { use(any); return 1 }
|
||||
|
||||
fun test3(z: Z) {
|
||||
z == <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>newA<!>()
|
||||
|
||||
@@ -42,5 +42,5 @@ fun <T, C: MutableCollection<in T>> Array<T>.toCollection(result: C) : C {
|
||||
return result
|
||||
}
|
||||
|
||||
val Collection<*>.size : Int
|
||||
val Collection<*>.<!EXTENSION_SHADOWED_BY_MEMBER!>size<!> : Int
|
||||
get() = size
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -EXTENSION_SHADOWED_BY_MEMBER
|
||||
|
||||
class Example {
|
||||
operator infix fun plus(other: Example) = 0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -EXTENSION_SHADOWED_BY_MEMBER
|
||||
|
||||
open class Example {
|
||||
fun invoke() = 0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -EXTENSION_SHADOWED_BY_MEMBER
|
||||
|
||||
class ModAndRemAssign {
|
||||
<!DEPRECATED_BINARY_MOD!>operator<!> fun mod(x: Int) = ModAndRemAssign()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: -OperatorRem
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE, -EXTENSION_SHADOWED_BY_MEMBER
|
||||
|
||||
class Foo {
|
||||
<!UNSUPPORTED_FEATURE!>operator<!> fun rem(x: Int): Foo = Foo()
|
||||
|
||||
@@ -12,4 +12,4 @@ fun test() {
|
||||
fooShort(1 % 1)
|
||||
}
|
||||
|
||||
public operator fun Int.rem(other: Int): Int = 0
|
||||
public operator fun Int.<!EXTENSION_SHADOWED_BY_MEMBER!>rem<!>(other: Int): Int = 0
|
||||
@@ -1,4 +1,4 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -EXTENSION_SHADOWED_BY_MEMBER
|
||||
|
||||
class ModAndRemAssign {
|
||||
<!DEPRECATED_BINARY_MOD!>operator<!> fun mod(x: Int) = ModAndRemAssign()
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
class Outer {
|
||||
inner class Test1
|
||||
inner class Test2(val x: Int)
|
||||
inner class Test3(val x: Any)
|
||||
inner class Test4<T>(val x: T)
|
||||
inner class Test5(val x: Int) {
|
||||
constructor() : this(0)
|
||||
private constructor(z: String) : this(z.length)
|
||||
}
|
||||
|
||||
class TestNested
|
||||
|
||||
internal class TestInternal
|
||||
protected class TestProtected
|
||||
private class TestPrivate
|
||||
}
|
||||
|
||||
fun Outer.<!EXTENSION_FUNCTION_SHADOWED_BY_INNER_CLASS_CONSTRUCTOR!>Test1<!>() {}
|
||||
fun Outer.<!EXTENSION_FUNCTION_SHADOWED_BY_INNER_CLASS_CONSTRUCTOR!>Test2<!>(x: Int) {}
|
||||
fun Outer.<!EXTENSION_FUNCTION_SHADOWED_BY_INNER_CLASS_CONSTRUCTOR!>Test3<!>(x: String) {}
|
||||
fun <T> Outer.Test3(x: T) {}
|
||||
fun <T : Number> Outer.<!EXTENSION_FUNCTION_SHADOWED_BY_INNER_CLASS_CONSTRUCTOR!>Test4<!>(x: T) {}
|
||||
fun Outer.<!EXTENSION_FUNCTION_SHADOWED_BY_INNER_CLASS_CONSTRUCTOR!>Test5<!>() {}
|
||||
fun Outer.Test5(z: String) {}
|
||||
|
||||
fun Outer.TestNested() {}
|
||||
fun Outer.TestInternal() {}
|
||||
fun Outer.TestProtected() {}
|
||||
fun Outer.TestPrivate() {}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package
|
||||
|
||||
public fun Outer.Test1(): kotlin.Unit
|
||||
public fun Outer.Test2(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public fun </*0*/ T> Outer.Test3(/*0*/ x: T): kotlin.Unit
|
||||
public fun Outer.Test3(/*0*/ x: kotlin.String): kotlin.Unit
|
||||
public fun </*0*/ T : kotlin.Number> Outer.Test4(/*0*/ x: T): kotlin.Unit
|
||||
public fun Outer.Test5(): kotlin.Unit
|
||||
public fun Outer.Test5(/*0*/ z: kotlin.String): kotlin.Unit
|
||||
public fun Outer.TestInternal(): kotlin.Unit
|
||||
public fun Outer.TestNested(): kotlin.Unit
|
||||
public fun Outer.TestPrivate(): kotlin.Unit
|
||||
public fun Outer.TestProtected(): kotlin.Unit
|
||||
|
||||
public final class Outer {
|
||||
public constructor Outer()
|
||||
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 inner class Test1 {
|
||||
public constructor Test1()
|
||||
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 inner class Test2 {
|
||||
public constructor Test2(/*0*/ x: kotlin.Int)
|
||||
public final val x: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final inner class Test3 {
|
||||
public constructor Test3(/*0*/ x: kotlin.Any)
|
||||
public final val x: kotlin.Any
|
||||
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 inner class Test4</*0*/ T> {
|
||||
public constructor Test4</*0*/ T>(/*0*/ x: T)
|
||||
public final val x: T
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final inner class Test5 {
|
||||
public constructor Test5()
|
||||
public constructor Test5(/*0*/ x: kotlin.Int)
|
||||
private constructor Test5(/*0*/ z: kotlin.String)
|
||||
public final val x: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
internal final class TestInternal {
|
||||
public constructor TestInternal()
|
||||
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 TestNested {
|
||||
public constructor TestNested()
|
||||
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
|
||||
}
|
||||
|
||||
private final class TestPrivate {
|
||||
public constructor TestPrivate()
|
||||
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
|
||||
}
|
||||
|
||||
protected final class TestProtected {
|
||||
public constructor TestProtected()
|
||||
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
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface Test1 {
|
||||
fun test1() {}
|
||||
}
|
||||
fun Test1.<!EXTENSION_SHADOWED_BY_MEMBER!>test1<!>() {}
|
||||
|
||||
interface Test2 {
|
||||
fun test2(x: String) {}
|
||||
}
|
||||
fun Test2.test2(x: Any) {}
|
||||
|
||||
interface Test3 {
|
||||
fun test3(x: Any) {}
|
||||
}
|
||||
fun Test3.<!EXTENSION_SHADOWED_BY_MEMBER!>test3<!>(x: String) {}
|
||||
fun <T : Any?> Test3.test3(x: T) {}
|
||||
|
||||
interface Test4 {
|
||||
fun <T> test4(x: T) {}
|
||||
}
|
||||
fun Test4.<!EXTENSION_SHADOWED_BY_MEMBER!>test4<!>(x: String) {}
|
||||
|
||||
interface Test5 {
|
||||
fun <T> test5(x: T) {}
|
||||
}
|
||||
fun <T : Number> Test5.<!EXTENSION_SHADOWED_BY_MEMBER!>test5<!>(x: T) {}
|
||||
|
||||
interface Test6 {
|
||||
fun <T : List<Any>> test6(x: T) {}
|
||||
}
|
||||
fun <T : Set<Any>> Test6.test6(x: T) {}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package
|
||||
|
||||
public fun Test1.test1(): kotlin.Unit
|
||||
public fun Test2.test2(/*0*/ x: kotlin.Any): kotlin.Unit
|
||||
public fun </*0*/ T> Test3.test3(/*0*/ x: T): kotlin.Unit
|
||||
public fun Test3.test3(/*0*/ x: kotlin.String): kotlin.Unit
|
||||
public fun Test4.test4(/*0*/ x: kotlin.String): kotlin.Unit
|
||||
public fun </*0*/ T : kotlin.Number> Test5.test5(/*0*/ x: T): kotlin.Unit
|
||||
public fun </*0*/ T : kotlin.collections.Set<kotlin.Any>> Test6.test6(/*0*/ x: T): kotlin.Unit
|
||||
|
||||
public interface Test1 {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun test1(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Test2 {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun test2(/*0*/ x: kotlin.String): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Test3 {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun test3(/*0*/ x: kotlin.Any): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Test4 {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun </*0*/ T> test4(/*0*/ x: T): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Test5 {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun </*0*/ T> test5(/*0*/ x: T): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Test6 {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun </*0*/ T : kotlin.collections.List<kotlin.Any>> test6(/*0*/ x: T): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface WithInvoke {
|
||||
operator fun invoke()
|
||||
operator fun invoke(s: String)
|
||||
operator fun <T> invoke(x: T, y: Int)
|
||||
fun invoke(i: Int)
|
||||
}
|
||||
|
||||
interface Test1 {
|
||||
val test1: WithInvoke
|
||||
}
|
||||
|
||||
fun Test1.<!EXTENSION_FUNCTION_SHADOWED_BY_MEMBER_PROPERTY_WITH_INVOKE!>test1<!>() {}
|
||||
fun Test1.<!EXTENSION_FUNCTION_SHADOWED_BY_MEMBER_PROPERTY_WITH_INVOKE!>test1<!>(s: String) {}
|
||||
fun Test1.test1(i: Int) {}
|
||||
fun Test1.<!EXTENSION_FUNCTION_SHADOWED_BY_MEMBER_PROPERTY_WITH_INVOKE!>test1<!>(x: Any, y: Int) {}
|
||||
fun <T : Number> Test1.<!EXTENSION_FUNCTION_SHADOWED_BY_MEMBER_PROPERTY_WITH_INVOKE!>test1<!>(x: T, y: Int) {}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package
|
||||
|
||||
public fun Test1.test1(): kotlin.Unit
|
||||
public fun </*0*/ T : kotlin.Number> Test1.test1(/*0*/ x: T, /*1*/ y: kotlin.Int): kotlin.Unit
|
||||
public fun Test1.test1(/*0*/ x: kotlin.Any, /*1*/ y: kotlin.Int): kotlin.Unit
|
||||
public fun Test1.test1(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||
public fun Test1.test1(/*0*/ s: kotlin.String): kotlin.Unit
|
||||
|
||||
public interface Test1 {
|
||||
public abstract val test1: WithInvoke
|
||||
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 WithInvoke {
|
||||
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 operator fun invoke(): kotlin.Unit
|
||||
public abstract operator fun </*0*/ T> invoke(/*0*/ x: T, /*1*/ y: kotlin.Int): kotlin.Unit
|
||||
public abstract fun invoke(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||
public abstract operator fun invoke(/*0*/ s: kotlin.String): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
data class DataClass(val x: Int)
|
||||
|
||||
fun DataClass.<!EXTENSION_SHADOWED_BY_MEMBER!>component1<!>() = 42
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package
|
||||
|
||||
public fun DataClass.component1(): kotlin.Int
|
||||
|
||||
public final data class DataClass {
|
||||
public constructor DataClass(/*0*/ x: kotlin.Int)
|
||||
public final val x: kotlin.Int
|
||||
public final operator /*synthesized*/ fun component1(): kotlin.Int
|
||||
public final /*synthesized*/ fun copy(/*0*/ x: kotlin.Int = ...): DataClass
|
||||
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
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class C {
|
||||
fun Int.foo() {}
|
||||
}
|
||||
|
||||
fun C.foo() {}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package
|
||||
|
||||
public fun C.foo(): kotlin.Unit
|
||||
|
||||
public final class C {
|
||||
public constructor C()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
public final fun kotlin.Int.foo(): kotlin.Unit
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
interface G<T> {
|
||||
fun foo()
|
||||
val bar: Int
|
||||
}
|
||||
|
||||
fun <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>G<!>.foo() {}
|
||||
val <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>G<!>.bar: Int get() = 42
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
package
|
||||
|
||||
public val [ERROR : G].bar: kotlin.Int
|
||||
public fun [ERROR : G].foo(): kotlin.Unit
|
||||
|
||||
public interface G</*0*/ T> {
|
||||
public abstract val bar: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
interface Test {
|
||||
fun foo()
|
||||
val bar: Int
|
||||
}
|
||||
|
||||
fun Test?.foo() {}
|
||||
val Test?.bar: Int get() = 42
|
||||
compiler/testData/diagnostics/tests/redeclarations/shadowedExtension/extensionOnNullableReceiver.txt
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
package
|
||||
|
||||
public val Test?.bar: kotlin.Int
|
||||
public fun Test?.foo(): kotlin.Unit
|
||||
|
||||
public interface Test {
|
||||
public abstract val bar: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface Test1 {
|
||||
val test1: Int
|
||||
}
|
||||
val Test1.<!EXTENSION_SHADOWED_BY_MEMBER!>test1<!>: Int get() = 42
|
||||
|
||||
interface Test2 {
|
||||
var test2: Int
|
||||
}
|
||||
val Test2.<!EXTENSION_SHADOWED_BY_MEMBER!>test2<!>: Int get() = 42
|
||||
|
||||
interface Test3 {
|
||||
val test3: Int
|
||||
}
|
||||
var Test3.<!EXTENSION_SHADOWED_BY_MEMBER!>test3<!>: Int get() = 42; set(v) {}
|
||||
|
||||
interface Test4 {
|
||||
val test4: Int
|
||||
}
|
||||
var Test4.<!EXTENSION_SHADOWED_BY_MEMBER!>test4<!>: Int get() = 42; set(v) {}
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package
|
||||
|
||||
public val Test1.test1: kotlin.Int
|
||||
public val Test2.test2: kotlin.Int
|
||||
public var Test3.test3: kotlin.Int
|
||||
public var Test4.test4: kotlin.Int
|
||||
|
||||
public interface Test1 {
|
||||
public abstract val test1: 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 interface Test2 {
|
||||
public abstract var test2: 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 interface Test3 {
|
||||
public abstract val test3: 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 interface Test4 {
|
||||
public abstract val test4: 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
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface IBase {
|
||||
fun foo()
|
||||
val bar: Int
|
||||
}
|
||||
|
||||
object Impl : IBase {
|
||||
override fun foo() {}
|
||||
override val bar: Int get() = 42
|
||||
}
|
||||
|
||||
object Test : IBase by Impl
|
||||
|
||||
fun Test.<!EXTENSION_SHADOWED_BY_MEMBER!>foo<!>() {}
|
||||
val Test.<!EXTENSION_SHADOWED_BY_MEMBER!>bar<!>: Int get() = 42
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package
|
||||
|
||||
public val Test.bar: kotlin.Int
|
||||
public fun Test.foo(): kotlin.Unit
|
||||
|
||||
public interface IBase {
|
||||
public abstract val bar: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract 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 object Impl : IBase {
|
||||
private constructor Impl()
|
||||
public open override /*1*/ val bar: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ 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 object Test : IBase {
|
||||
private constructor Test()
|
||||
public open override /*1*/ /*delegation*/ val bar: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*delegation*/ fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Vendored
+47
@@ -0,0 +1,47 @@
|
||||
class WithPublicInvoke {
|
||||
public operator fun invoke() {}
|
||||
}
|
||||
|
||||
class WithInternalInvoke {
|
||||
internal operator fun invoke() {}
|
||||
}
|
||||
|
||||
class WithProtectedInvoke {
|
||||
protected operator fun invoke() {}
|
||||
}
|
||||
|
||||
class WithPrivateInvoke {
|
||||
private operator fun invoke() {}
|
||||
}
|
||||
|
||||
class Test {
|
||||
public fun publicFoo() {}
|
||||
internal fun internalFoo() {}
|
||||
protected fun protectedFoo() {}
|
||||
private fun privateFoo() {}
|
||||
|
||||
public val publicVal = 42
|
||||
internal val internalVal = 42
|
||||
protected val protectedVal = 42
|
||||
private val privateVal = 42
|
||||
|
||||
public val withPublicInvoke = WithPublicInvoke()
|
||||
public val withInternalInvoke = WithInternalInvoke()
|
||||
public val withProtectedInvoke = WithProtectedInvoke()
|
||||
public val withPrivateInvoke = WithPrivateInvoke()
|
||||
}
|
||||
|
||||
private fun Test.<!EXTENSION_SHADOWED_BY_MEMBER!>publicFoo<!>() {}
|
||||
fun Test.internalFoo() {}
|
||||
fun Test.protectedFoo() {}
|
||||
fun Test.privateFoo() {}
|
||||
|
||||
val Test.<!EXTENSION_SHADOWED_BY_MEMBER!>publicVal<!>: Int get() = 42
|
||||
val Test.internalVal: Int get() = 42
|
||||
val Test.protectedVal: Int get() = 42
|
||||
val Test.privateVal: Int get() = 42
|
||||
|
||||
fun Test.<!EXTENSION_FUNCTION_SHADOWED_BY_MEMBER_PROPERTY_WITH_INVOKE!>withPublicInvoke<!>() {}
|
||||
fun Test.wihtInternalInvoke() {}
|
||||
fun Test.withProtectedInvoke() {}
|
||||
fun Test.withPrivateInvoke() {}
|
||||
Vendored
+65
@@ -0,0 +1,65 @@
|
||||
package
|
||||
|
||||
public val Test.internalVal: kotlin.Int
|
||||
public val Test.privateVal: kotlin.Int
|
||||
public val Test.protectedVal: kotlin.Int
|
||||
public val Test.publicVal: kotlin.Int
|
||||
public fun Test.internalFoo(): kotlin.Unit
|
||||
public fun Test.privateFoo(): kotlin.Unit
|
||||
public fun Test.protectedFoo(): kotlin.Unit
|
||||
private fun Test.publicFoo(): kotlin.Unit
|
||||
public fun Test.wihtInternalInvoke(): kotlin.Unit
|
||||
public fun Test.withPrivateInvoke(): kotlin.Unit
|
||||
public fun Test.withProtectedInvoke(): kotlin.Unit
|
||||
public fun Test.withPublicInvoke(): kotlin.Unit
|
||||
|
||||
public final class Test {
|
||||
public constructor Test()
|
||||
internal final val internalVal: kotlin.Int = 42
|
||||
private final val privateVal: kotlin.Int = 42
|
||||
protected final val protectedVal: kotlin.Int = 42
|
||||
public final val publicVal: kotlin.Int = 42
|
||||
public final val withInternalInvoke: WithInternalInvoke
|
||||
public final val withPrivateInvoke: WithPrivateInvoke
|
||||
public final val withProtectedInvoke: WithProtectedInvoke
|
||||
public final val withPublicInvoke: WithPublicInvoke
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
internal final fun internalFoo(): kotlin.Unit
|
||||
private final fun privateFoo(): kotlin.Unit
|
||||
protected final fun protectedFoo(): kotlin.Unit
|
||||
public final fun publicFoo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class WithInternalInvoke {
|
||||
public constructor WithInternalInvoke()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
internal final operator fun invoke(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class WithPrivateInvoke {
|
||||
public constructor WithPrivateInvoke()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
private final operator fun invoke(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class WithProtectedInvoke {
|
||||
public constructor WithProtectedInvoke()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
protected final operator fun invoke(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class WithPublicInvoke {
|
||||
public constructor WithPublicInvoke()
|
||||
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 final operator fun invoke(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
interface IFoo {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
fun outer() {
|
||||
fun IFoo.<!EXTENSION_SHADOWED_BY_MEMBER!>foo<!>() {}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package
|
||||
|
||||
public fun outer(): kotlin.Unit
|
||||
|
||||
public interface IFoo {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
interface IFooBar {
|
||||
fun foo()
|
||||
val bar: Int
|
||||
}
|
||||
|
||||
class Host {
|
||||
fun IFooBar.<!EXTENSION_SHADOWED_BY_MEMBER!>foo<!>() {}
|
||||
val IFooBar.<!EXTENSION_SHADOWED_BY_MEMBER!>bar<!>: Int get() = 42
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package
|
||||
|
||||
public final class Host {
|
||||
public constructor Host()
|
||||
public final val IFooBar.bar: 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 fun IFooBar.foo(): kotlin.Unit
|
||||
}
|
||||
|
||||
public interface IFooBar {
|
||||
public abstract val bar: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
interface Test {
|
||||
fun invoke()
|
||||
}
|
||||
|
||||
operator fun Test.invoke() {}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package
|
||||
|
||||
public operator fun Test.invoke(): kotlin.Unit
|
||||
|
||||
public interface Test {
|
||||
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 fun invoke(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -2,7 +2,7 @@ class Command() {}
|
||||
|
||||
fun parse(<!UNUSED_PARAMETER!>cmd<!>: String): Command? { return null }
|
||||
|
||||
fun Any.equals(other : Any?) : Boolean = this === other
|
||||
fun Any.<!EXTENSION_SHADOWED_BY_MEMBER!>equals<!>(other : Any?) : Boolean = this === other
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val command = parse("")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
fun Any.equals(<!UNUSED_PARAMETER!>other<!> : Any?) : Boolean = true
|
||||
fun Any.<!EXTENSION_SHADOWED_BY_MEMBER!>equals<!>(<!UNUSED_PARAMETER!>other<!> : Any?) : Boolean = true
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ class A {
|
||||
|
||||
|
||||
fun test(a: A) {
|
||||
fun A.foo() = 4
|
||||
fun A.<!EXTENSION_SHADOWED_BY_MEMBER!>foo<!>() = 4
|
||||
|
||||
a.foo() checkType { _<A>() }
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
data class A(val foo: Int)
|
||||
|
||||
operator fun A.component1(): String = ""
|
||||
operator fun A.<!EXTENSION_SHADOWED_BY_MEMBER!>component1<!>(): String = ""
|
||||
|
||||
fun test(a: A) {
|
||||
val (b) = a
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ class A1 : java.util.ArrayList<String>() {
|
||||
|
||||
class B : <!DEPRECATION_ERROR!>Throwable<!>("", null, false, false)
|
||||
|
||||
fun Throwable.fillInStackTrace() = 1
|
||||
fun Throwable.<!EXTENSION_SHADOWED_BY_MEMBER!>fillInStackTrace<!>() = 1
|
||||
|
||||
fun foo(x: List<String>, y: Throwable) {
|
||||
x.<!DEPRECATION_ERROR!>stream<!>()
|
||||
|
||||
@@ -15885,6 +15885,93 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/redeclarations/typeParameterWithTwoBounds.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/redeclarations/shadowedExtension")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ShadowedExtension extends AbstractDiagnosticsTest {
|
||||
public void testAllFilesPresentInShadowedExtension() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/redeclarations/shadowedExtension"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFunShadowedByInnerClassConstructor.kt")
|
||||
public void testExtensionFunShadowedByInnerClassConstructor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/redeclarations/shadowedExtension/extensionFunShadowedByInnerClassConstructor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFunShadowedByMemberFun.kt")
|
||||
public void testExtensionFunShadowedByMemberFun() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/redeclarations/shadowedExtension/extensionFunShadowedByMemberFun.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFunShadowedByMemberPropertyWithInvoke.kt")
|
||||
public void testExtensionFunShadowedByMemberPropertyWithInvoke() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/redeclarations/shadowedExtension/extensionFunShadowedByMemberPropertyWithInvoke.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFunShadowedBySynthesizedMemberFun.kt")
|
||||
public void testExtensionFunShadowedBySynthesizedMemberFun() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/redeclarations/shadowedExtension/extensionFunShadowedBySynthesizedMemberFun.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFunVsMemberExtensionFun.kt")
|
||||
public void testExtensionFunVsMemberExtensionFun() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/redeclarations/shadowedExtension/extensionFunVsMemberExtensionFun.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionOnErrorType.kt")
|
||||
public void testExtensionOnErrorType() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/redeclarations/shadowedExtension/extensionOnErrorType.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionOnNullableReceiver.kt")
|
||||
public void testExtensionOnNullableReceiver() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/redeclarations/shadowedExtension/extensionOnNullableReceiver.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionPropertyShadowedByMemberProperty.kt")
|
||||
public void testExtensionPropertyShadowedByMemberProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/redeclarations/shadowedExtension/extensionPropertyShadowedByMemberProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionShadowedByDelegatedMember.kt")
|
||||
public void testExtensionShadowedByDelegatedMember() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/redeclarations/shadowedExtension/extensionShadowedByDelegatedMember.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionVsNonPublicMember.kt")
|
||||
public void testExtensionVsNonPublicMember() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/redeclarations/shadowedExtension/extensionVsNonPublicMember.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("localExtensionShadowedByMember.kt")
|
||||
public void testLocalExtensionShadowedByMember() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/redeclarations/shadowedExtension/localExtensionShadowedByMember.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("memberExtensionShadowedByMember.kt")
|
||||
public void testMemberExtensionShadowedByMember() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/redeclarations/shadowedExtension/memberExtensionShadowedByMember.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("operatorExtensionVsNonOperatorMember.kt")
|
||||
public void testOperatorExtensionVsNonOperatorMember() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/redeclarations/shadowedExtension/operatorExtensionVsNonOperatorMember.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/reflection")
|
||||
|
||||
@@ -40,7 +40,7 @@ enum class NoLookupLocation : LookupLocation {
|
||||
FROM_BACKEND,
|
||||
FROM_TEST,
|
||||
FROM_BUILTINS,
|
||||
WHEN_CHECK_REDECLARATIONS,
|
||||
WHEN_CHECK_DECLARATION_CONFLICTS,
|
||||
WHEN_CHECK_OVERRIDES,
|
||||
FOR_SCRIPT,
|
||||
FROM_REFLECTION,
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ fun Int.foo() = this
|
||||
val foo : Int = 0
|
||||
}
|
||||
|
||||
<error>operator</error> fun Any.equals(<warning>other</warning> : Any?) : Boolean = true
|
||||
<error>operator</error> fun Any.<warning>equals</warning>(<warning>other</warning> : Any?) : Boolean = true
|
||||
fun Any?.equals1(<warning>other</warning> : Any?) : Boolean = true
|
||||
fun Any.equals2(<warning>other</warning> : Any?) : Boolean = true
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ class Command() {}
|
||||
|
||||
fun parse(<warning>cmd</warning>: String): Command? { return null }
|
||||
|
||||
fun Any.equals(other : Any?) : Boolean = this === other
|
||||
fun Any.<warning>equals</warning>(other : Any?) : Boolean = this === other
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val command = parse("")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
fun Any.equals(<warning>other</warning> : Any?) : Boolean = true
|
||||
fun Any.<warning>equals</warning>(<warning>other</warning> : Any?) : Boolean = true
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user