Report error when delegation method hides superttype override
#KT-12531 Fixed
This commit is contained in:
@@ -234,6 +234,7 @@ public interface Errors {
|
||||
DiagnosticFactory0<KtSuperTypeEntry> SUPERTYPE_NOT_INITIALIZED = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
DiagnosticFactory0<KtTypeReference> DELEGATION_NOT_TO_INTERFACE = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory2<KtDeclaration, CallableMemberDescriptor, List<CallableMemberDescriptor>> DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE = DiagnosticFactory2.create(ERROR);
|
||||
DiagnosticFactory0<KtTypeReference> SUPERTYPE_NOT_A_CLASS_OR_INTERFACE = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<KtTypeReference> SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
|
||||
+1
@@ -368,6 +368,7 @@ public class DefaultErrorMessages {
|
||||
|
||||
MAP.put(DELEGATION_IN_INTERFACE, "Interfaces cannot use delegation");
|
||||
MAP.put(DELEGATION_NOT_TO_INTERFACE, "Only interfaces can be delegated to");
|
||||
MAP.put(DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE, "Delegated member ''{0}'' hides supertype override: {1}. Please specify proper override explicitly", COMPACT, commaSeparated(SHORT_NAMES_IN_TYPES));
|
||||
MAP.put(NO_CONSTRUCTOR, "This class does not have a constructor");
|
||||
MAP.put(RESOLUTION_TO_CLASSIFIER, "{2}", NAME, TO_STRING, STRING);
|
||||
MAP.put(NOT_A_CLASS, "Not a class");
|
||||
|
||||
@@ -73,7 +73,8 @@ private val DEFAULT_DECLARATION_CHECKERS = listOf(
|
||||
InfixModifierChecker(),
|
||||
SinceKotlinAnnotationValueChecker,
|
||||
ReifiedTypeParameterAnnotationChecker(),
|
||||
DynamicReceiverChecker
|
||||
DynamicReceiverChecker,
|
||||
DelegationChecker()
|
||||
)
|
||||
|
||||
private val DEFAULT_CALL_CHECKERS = listOf(
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.checkers
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
|
||||
import org.jetbrains.kotlin.diagnostics.Errors.DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtDelegatedSuperTypeEntry
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.MemberComparator
|
||||
import org.jetbrains.kotlin.resolve.OverridingUtil
|
||||
import org.jetbrains.kotlin.utils.DFS
|
||||
import org.jetbrains.kotlin.utils.keysToMapExceptNulls
|
||||
|
||||
class DelegationChecker : SimpleDeclarationChecker {
|
||||
override fun check(
|
||||
declaration: KtDeclaration,
|
||||
descriptor: DeclarationDescriptor,
|
||||
diagnosticHolder: DiagnosticSink,
|
||||
bindingContext: BindingContext
|
||||
) {
|
||||
if (descriptor !is ClassDescriptor) return
|
||||
if (declaration !is KtClassOrObject) return
|
||||
|
||||
val delegationDescriptors = descriptor.defaultType.memberScope.getContributedDescriptors().
|
||||
filterIsInstance<CallableMemberDescriptor>().filter { it.kind == CallableMemberDescriptor.Kind.DELEGATION }.sortedWith(MemberComparator.INSTANCE)
|
||||
|
||||
for (specifier in declaration.superTypeListEntries) {
|
||||
if (specifier is KtDelegatedSuperTypeEntry) {
|
||||
val superType = specifier.typeReference?.let { bindingContext.get(BindingContext.TYPE, it) } ?: continue
|
||||
val superTypeDescriptor = superType.constructor.declarationDescriptor as? ClassDescriptor ?: continue
|
||||
|
||||
val delegates = getDelegates(delegationDescriptors, superTypeDescriptor)
|
||||
delegates.forEach { (delegated, delegatedTo) ->
|
||||
checkDescriptor(declaration, delegated, delegatedTo, diagnosticHolder)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkDescriptor(
|
||||
classDeclaration: KtDeclaration,
|
||||
delegatedDescriptor: CallableMemberDescriptor,
|
||||
delegatedToDescriptor: CallableMemberDescriptor,
|
||||
diagnosticHolder: DiagnosticSink
|
||||
) {
|
||||
val reachableFromDelegated = findAllReachableDeclarations(delegatedDescriptor)
|
||||
reachableFromDelegated.remove(delegatedDescriptor.original)
|
||||
val toRemove = linkedSetOf<CallableMemberDescriptor>()
|
||||
for (declaration in reachableFromDelegated) {
|
||||
val reachable = findAllReachableDeclarations(declaration.original)
|
||||
reachable.remove(declaration)
|
||||
toRemove.addAll(reachable)
|
||||
}
|
||||
reachableFromDelegated.removeAll(toRemove)
|
||||
reachableFromDelegated.remove(DescriptorUtils.unwrapFakeOverride(delegatedToDescriptor).original)
|
||||
|
||||
val nonAbstractReachable = reachableFromDelegated.filter { it.modality != Modality.ABSTRACT }
|
||||
|
||||
if (nonAbstractReachable.isNotEmpty()) {
|
||||
/*In case of MANY_IMPL_MEMBER_NOT_IMPLEMENTED error there could be several elements otherwise only one*/
|
||||
diagnosticHolder.report(DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE.on(classDeclaration, delegatedDescriptor, nonAbstractReachable.toList()))
|
||||
}
|
||||
}
|
||||
|
||||
fun getDelegates(
|
||||
delegatedMethods: Iterable<CallableMemberDescriptor>,
|
||||
toInterface: ClassDescriptor
|
||||
): Map<CallableMemberDescriptor, CallableMemberDescriptor> {
|
||||
return delegatedMethods
|
||||
.keysToMapExceptNulls { delegatingMember ->
|
||||
val actualDelegates = DescriptorUtils.getAllOverriddenDescriptors(delegatingMember)
|
||||
.filter { it.containingDeclaration == toInterface }
|
||||
.map { overriddenDescriptor ->
|
||||
val scope = toInterface.defaultType.memberScope
|
||||
val name = overriddenDescriptor.name
|
||||
|
||||
// this is the actual member of delegateExpressionType that we are delegating to
|
||||
(scope.getContributedFunctions(name, NoLookupLocation.WHEN_CHECK_OVERRIDES) +
|
||||
scope.getContributedVariables(name, NoLookupLocation.WHEN_CHECK_OVERRIDES))
|
||||
.firstOrNull { it == overriddenDescriptor || OverridingUtil.overrides(it, overriddenDescriptor) }
|
||||
}
|
||||
|
||||
actualDelegates.firstOrNull() as? CallableMemberDescriptor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun findAllReachableDeclarations(memberDescriptor: CallableMemberDescriptor): MutableSet<CallableMemberDescriptor> {
|
||||
val collector = object : DFS.NodeHandlerWithListResult<CallableMemberDescriptor, CallableMemberDescriptor>() {
|
||||
override fun afterChildren(current: CallableMemberDescriptor) {
|
||||
if (current.kind.isReal) {
|
||||
result.add(current.original)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DFS.dfs(listOf(memberDescriptor), { it.overriddenDescriptors }, collector)
|
||||
return java.util.HashSet(collector.result())
|
||||
}
|
||||
+8
-8
@@ -38,18 +38,18 @@ class CBarT<T> : IBarT<T> {
|
||||
override val bar: T get() = null!!
|
||||
}
|
||||
|
||||
<!OVERRIDING_FINAL_MEMBER_BY_DELEGATION!>class Test1<!> : Final(), IFoo by CFoo()
|
||||
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!><!OVERRIDING_FINAL_MEMBER_BY_DELEGATION!>class Test1<!> : Final(), IFoo by CFoo()<!>
|
||||
|
||||
<!OVERRIDING_FINAL_MEMBER_BY_DELEGATION!>class Test2<!> : Final(), IBar by CBar()
|
||||
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!><!OVERRIDING_FINAL_MEMBER_BY_DELEGATION!>class Test2<!> : Final(), IBar by CBar()<!>
|
||||
|
||||
<!OVERRIDING_FINAL_MEMBER_BY_DELEGATION, VAR_OVERRIDDEN_BY_VAL_BY_DELEGATION!>class Test3<!> : Final(), IQux by CQux()
|
||||
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!><!OVERRIDING_FINAL_MEMBER_BY_DELEGATION, VAR_OVERRIDDEN_BY_VAL_BY_DELEGATION!>class Test3<!> : Final(), IQux by CQux()<!>
|
||||
|
||||
<!OVERRIDING_FINAL_MEMBER_BY_DELEGATION!>class Test4<!> : Derived(), IFoo by CFoo()
|
||||
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!><!OVERRIDING_FINAL_MEMBER_BY_DELEGATION!>class Test4<!> : Derived(), IFoo by CFoo()<!>
|
||||
|
||||
<!OVERRIDING_FINAL_MEMBER_BY_DELEGATION!>class Test5<!> : Derived(), IBar by CBar()
|
||||
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!><!OVERRIDING_FINAL_MEMBER_BY_DELEGATION!>class Test5<!> : Derived(), IBar by CBar()<!>
|
||||
|
||||
<!OVERRIDING_FINAL_MEMBER_BY_DELEGATION, VAR_OVERRIDDEN_BY_VAL_BY_DELEGATION!>class Test6<!> : Derived(), IQux by CQux()
|
||||
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!><!OVERRIDING_FINAL_MEMBER_BY_DELEGATION, VAR_OVERRIDDEN_BY_VAL_BY_DELEGATION!>class Test6<!> : Derived(), IQux by CQux()<!>
|
||||
|
||||
<!OVERRIDING_FINAL_MEMBER_BY_DELEGATION!>class Test7<!> : Final(), IBarT<Int> by CBarT<Int>()
|
||||
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!><!OVERRIDING_FINAL_MEMBER_BY_DELEGATION!>class Test7<!> : Final(), IBarT<Int> by CBarT<Int>()<!>
|
||||
|
||||
<!OVERRIDING_FINAL_MEMBER_BY_DELEGATION!>class Test8<!> : Final(), IBarT<Int> by <!TYPE_MISMATCH!>CBar()<!>
|
||||
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!><!OVERRIDING_FINAL_MEMBER_BY_DELEGATION!>class Test8<!> : Final(), IBarT<Int> by <!TYPE_MISMATCH!>CBar()<!><!>
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ open class IDerived1 : IBase1 {
|
||||
override fun foo(): String = "1"
|
||||
}
|
||||
|
||||
<!RETURN_TYPE_MISMATCH_BY_DELEGATION!>class Broken1<!>(val b: IBase1) : IBase1 by b, IDerived1()
|
||||
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!><!RETURN_TYPE_MISMATCH_BY_DELEGATION!>class Broken1<!>(val b: IBase1) : IBase1 by b, IDerived1()<!>
|
||||
|
||||
interface IBase2 {
|
||||
val foo: Any
|
||||
@@ -16,4 +16,4 @@ open class IDerived2 : IBase2 {
|
||||
override val foo: String = "2"
|
||||
}
|
||||
|
||||
<!PROPERTY_TYPE_MISMATCH_BY_DELEGATION!>class Broken2<!>(val b: IBase2) : IBase2 by b, IDerived2()
|
||||
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!><!PROPERTY_TYPE_MISMATCH_BY_DELEGATION!>class Broken2<!>(val b: IBase2) : IBase2 by b, IDerived2()<!>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
public interface Base {
|
||||
fun test() = "OK"
|
||||
}
|
||||
|
||||
|
||||
abstract class Impl : Base {
|
||||
override abstract fun test(): String
|
||||
}
|
||||
|
||||
class Delegate : Base
|
||||
|
||||
|
||||
fun box(): String {
|
||||
object : Impl(), Base by Delegate() {
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package
|
||||
|
||||
public fun box(): kotlin.String
|
||||
|
||||
public interface Base {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Delegate : Base {
|
||||
public constructor Delegate()
|
||||
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 test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public abstract class Impl : Base {
|
||||
public constructor Impl()
|
||||
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(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
public interface Base {
|
||||
fun test() = "OK"
|
||||
}
|
||||
|
||||
public interface Base2 : Base
|
||||
|
||||
class Delegate : Base2
|
||||
|
||||
fun box(): String {
|
||||
object : Base, Base2 by Delegate() {
|
||||
|
||||
}
|
||||
|
||||
object : Base2, Base by Delegate() {
|
||||
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package
|
||||
|
||||
public fun box(): kotlin.String
|
||||
|
||||
public interface Base {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Base2 : Base {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Delegate : Base2 {
|
||||
public constructor Delegate()
|
||||
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 test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
public interface Base {
|
||||
val test: String
|
||||
get() = "OK"
|
||||
}
|
||||
|
||||
public interface Base2 : Base
|
||||
|
||||
class Delegate : Base2
|
||||
|
||||
fun box(): String {
|
||||
object : Base, Base2 by Delegate() {
|
||||
|
||||
}
|
||||
|
||||
object : Base2, Base by Delegate() {
|
||||
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package
|
||||
|
||||
public fun box(): kotlin.String
|
||||
|
||||
public interface Base {
|
||||
public open val test: 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
|
||||
}
|
||||
|
||||
public interface Base2 : Base {
|
||||
public open override /*1*/ /*fake_override*/ val test: 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
|
||||
}
|
||||
|
||||
public final class Delegate : Base2 {
|
||||
public constructor Delegate()
|
||||
public open override /*1*/ /*fake_override*/ val test: 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
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
public interface Base {
|
||||
fun test() = "OK"
|
||||
}
|
||||
|
||||
public interface Base2 : Base {
|
||||
override fun test() = "OK2"
|
||||
}
|
||||
|
||||
class Delegate : Base2
|
||||
|
||||
fun box(): String {
|
||||
object : Base, Base2 by Delegate() {
|
||||
}
|
||||
|
||||
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>object<!> : Base2, Base by Delegate() {
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package
|
||||
|
||||
public fun box(): kotlin.String
|
||||
|
||||
public interface Base {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Base2 : Base {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Delegate : Base2 {
|
||||
public constructor Delegate()
|
||||
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 test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
public interface Base {
|
||||
var test: String
|
||||
get() = "OK"
|
||||
set(s: String) {
|
||||
}
|
||||
}
|
||||
|
||||
public interface Base2 : Base {
|
||||
override var test: String
|
||||
get() = "OK2"
|
||||
set(value) {}
|
||||
}
|
||||
|
||||
class Delegate : Base2 {
|
||||
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
object : Base, Base2 by Delegate() {
|
||||
}
|
||||
|
||||
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>object<!> : Base2, Base by Delegate() {
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
package
|
||||
|
||||
public fun box(): kotlin.String
|
||||
|
||||
public interface Base {
|
||||
public open var test: 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
|
||||
}
|
||||
|
||||
public interface Base2 : Base {
|
||||
public open override /*1*/ var test: 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
|
||||
}
|
||||
|
||||
public final class Delegate : Base2 {
|
||||
public constructor Delegate()
|
||||
public open override /*1*/ /*fake_override*/ var test: 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
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
public interface Base {
|
||||
fun test() = "Base"
|
||||
}
|
||||
|
||||
public interface Base2 : Base {
|
||||
override fun test() = "Base2"
|
||||
}
|
||||
|
||||
public interface Base3 : Base {
|
||||
override fun test() = "Base3"
|
||||
}
|
||||
|
||||
class Impl : Base
|
||||
|
||||
class Impl2 : Base2
|
||||
|
||||
class Impl3 : Base3
|
||||
|
||||
class ImplAll : Base, Base2, Base3 {
|
||||
override fun test(): String {
|
||||
return super<Base2>.test()
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
<!MANY_IMPL_MEMBER_NOT_IMPLEMENTED, DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>object<!> : Base2, Base3, Base by Impl() {
|
||||
|
||||
}
|
||||
|
||||
<!MANY_IMPL_MEMBER_NOT_IMPLEMENTED, DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>object<!> : Base2 by Impl2(), Base3, Base {
|
||||
|
||||
}
|
||||
|
||||
<!MANY_IMPL_MEMBER_NOT_IMPLEMENTED, DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>object<!> : Base2, Base3 by Impl3(), Base {
|
||||
|
||||
}
|
||||
|
||||
<!MANY_IMPL_MEMBER_NOT_IMPLEMENTED, MANY_IMPL_MEMBER_NOT_IMPLEMENTED, MANY_IMPL_MEMBER_NOT_IMPLEMENTED, DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE, DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE, DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>object<!> : Base2 by Impl2(), Base3 by Impl3(), Base by Impl() {
|
||||
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package
|
||||
|
||||
public fun box(): kotlin.String
|
||||
|
||||
public interface Base {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Base2 : Base {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Base3 : Base {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Impl : Base {
|
||||
public constructor Impl()
|
||||
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 test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Impl2 : Base2 {
|
||||
public constructor Impl2()
|
||||
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 test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Impl3 : Base3 {
|
||||
public constructor Impl3()
|
||||
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 test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class ImplAll : Base, Base2, Base3 {
|
||||
public constructor ImplAll()
|
||||
public open override /*3*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*3*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*3*/ fun test(): kotlin.String
|
||||
public open override /*3*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
public interface Base {
|
||||
fun test() = "OK"
|
||||
}
|
||||
|
||||
open class Base2 : Base {
|
||||
override fun test() = "OK2"
|
||||
}
|
||||
|
||||
class Delegate : Base
|
||||
|
||||
fun box(): String {
|
||||
|
||||
object : Base2(), Base by Delegate() {
|
||||
override fun test() = "OK"
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package
|
||||
|
||||
public fun box(): kotlin.String
|
||||
|
||||
public interface Base {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open class Base2 : Base {
|
||||
public constructor Base2()
|
||||
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*/ fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Delegate : Base {
|
||||
public constructor Delegate()
|
||||
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 test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
public interface Base<T> {
|
||||
fun test(p: T) = "Base"
|
||||
}
|
||||
|
||||
public interface Derived<Y> : Base<Y>
|
||||
|
||||
class Delegate<Z> : Derived<Z>
|
||||
|
||||
fun box(): String {
|
||||
object : Derived<String> by Delegate() {
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package
|
||||
|
||||
public fun box(): kotlin.String
|
||||
|
||||
public interface Base</*0*/ T> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun test(/*0*/ p: T): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Delegate</*0*/ Z> : Derived<Z> {
|
||||
public constructor Delegate</*0*/ Z>()
|
||||
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 test(/*0*/ p: Z): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Derived</*0*/ Y> : Base<Y> {
|
||||
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 test(/*0*/ p: Y): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
public interface Base {
|
||||
fun test() = "Base"
|
||||
}
|
||||
|
||||
class Delegate : Base {
|
||||
override fun test() = "Base"
|
||||
}
|
||||
|
||||
public open class MyClass : Base by Delegate()
|
||||
|
||||
fun box(): String {
|
||||
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>object<!> : MyClass(), Base by Delegate() {
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package
|
||||
|
||||
public fun box(): kotlin.String
|
||||
|
||||
public interface Base {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Delegate : Base {
|
||||
public constructor Delegate()
|
||||
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*/ fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open class MyClass : Base {
|
||||
public constructor MyClass()
|
||||
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*/ /*delegation*/ fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
public interface Base {
|
||||
fun test() = "Base"
|
||||
}
|
||||
|
||||
public interface Derived : Base {
|
||||
override fun test() = "Derived"
|
||||
}
|
||||
|
||||
|
||||
class Delegate : Derived {
|
||||
override fun test() = "Delegate"
|
||||
}
|
||||
|
||||
public open class MyClass : Base by Delegate()
|
||||
|
||||
fun box(): String {
|
||||
<!MANY_IMPL_MEMBER_NOT_IMPLEMENTED, DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>object<!> : MyClass(), Derived by Delegate() {
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package
|
||||
|
||||
public fun box(): kotlin.String
|
||||
|
||||
public interface Base {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Delegate : Derived {
|
||||
public constructor Delegate()
|
||||
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*/ fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Derived : Base {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open class MyClass : Base {
|
||||
public constructor MyClass()
|
||||
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*/ /*delegation*/ fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
interface Base1 {
|
||||
fun test() = "OK"
|
||||
}
|
||||
|
||||
interface Base2 {
|
||||
fun test2() = "OK"
|
||||
}
|
||||
|
||||
|
||||
class Delegate1 : Base1
|
||||
|
||||
class Delegate2 : Base2
|
||||
|
||||
|
||||
public abstract class MyClass : Base1, Base2 {
|
||||
override fun test(): String {
|
||||
return "Class"
|
||||
}
|
||||
|
||||
override fun test2(): String {
|
||||
return "Class"
|
||||
}
|
||||
}
|
||||
|
||||
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE, DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!><!MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>class A<!> : MyClass(), Base1 by Delegate1(), <!SUPERTYPE_APPEARS_TWICE!>Base1<!> by <!TYPE_MISMATCH!>Delegate2()<!> {
|
||||
|
||||
}<!>
|
||||
@@ -0,0 +1,49 @@
|
||||
package
|
||||
|
||||
public final class A : MyClass, Base1, Base1 {
|
||||
public constructor A()
|
||||
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*/ /*delegation*/ fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun test2(): kotlin.String
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Base1 {
|
||||
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 test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Base2 {
|
||||
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(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Delegate1 : Base1 {
|
||||
public constructor Delegate1()
|
||||
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 test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Delegate2 : Base2 {
|
||||
public constructor Delegate2()
|
||||
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 test2(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public abstract class MyClass : Base1, Base2 {
|
||||
public constructor MyClass()
|
||||
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 /*1*/ fun test(): kotlin.String
|
||||
public open override /*1*/ fun test2(): kotlin.String
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
public interface Base {
|
||||
fun getValue(): String
|
||||
|
||||
fun test() = getValue()
|
||||
}
|
||||
|
||||
class Delegate : Base {
|
||||
override fun getValue() = "Delegate"
|
||||
}
|
||||
|
||||
public abstract class MyClass : Base {
|
||||
override fun test(): String {
|
||||
return "Class"
|
||||
}
|
||||
}
|
||||
|
||||
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>class A : MyClass(), Base by Delegate() {
|
||||
override fun getValue() = "Delegate"
|
||||
}<!>
|
||||
@@ -0,0 +1,36 @@
|
||||
package
|
||||
|
||||
public final class A : MyClass, Base {
|
||||
public constructor A()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ fun getValue(): kotlin.String
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*delegation*/ fun test(): kotlin.String
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Base {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun getValue(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Delegate : Base {
|
||||
public constructor Delegate()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ fun getValue(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public abstract class MyClass : Base {
|
||||
public constructor MyClass()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract override /*1*/ /*fake_override*/ fun getValue(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
interface Base {
|
||||
fun test() = "OK"
|
||||
}
|
||||
|
||||
open class Base2 : Base
|
||||
|
||||
class Delegate : Base
|
||||
|
||||
fun box(): String {
|
||||
object : Base2(), Base by Delegate() {
|
||||
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package
|
||||
|
||||
public fun box(): kotlin.String
|
||||
|
||||
public interface Base {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open class Base2 : Base {
|
||||
public constructor Base2()
|
||||
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 test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Delegate : Base {
|
||||
public constructor Delegate()
|
||||
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 test(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
public interface Base {
|
||||
val test: String
|
||||
get() = "OK"
|
||||
}
|
||||
|
||||
open class Delegate : Base {
|
||||
override val test: String
|
||||
get() = "OK"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>object<!> : Delegate(), Base by Delegate() {
|
||||
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package
|
||||
|
||||
public fun box(): kotlin.String
|
||||
|
||||
public interface Base {
|
||||
public open val test: 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
|
||||
}
|
||||
|
||||
public open class Delegate : Base {
|
||||
public constructor Delegate()
|
||||
public open override /*1*/ val test: 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
|
||||
}
|
||||
+1
-1
@@ -10,4 +10,4 @@ interface B {
|
||||
|
||||
class <!CONFLICTING_JVM_DECLARATIONS!>C(f: A<String>)<!>: A<String> by f, B
|
||||
|
||||
class D(f: A<Int>): A<Int> by f, B
|
||||
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>class D(f: A<Int>): A<Int> by f, B<!>
|
||||
@@ -10,4 +10,4 @@ object Impl : D, E {
|
||||
override fun foo() {}
|
||||
}
|
||||
|
||||
val obj: D = <!MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>object<!> : D by Impl, E by Impl {}
|
||||
val obj: D = <!MANY_IMPL_MEMBER_NOT_IMPLEMENTED, DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>object<!> : D by Impl, E by Impl {}
|
||||
@@ -6209,6 +6209,99 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/delegationBy")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class DelegationBy extends AbstractDiagnosticsTest {
|
||||
@TestMetadata("abstractOverride.kt")
|
||||
public void testAbstractOverride() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegationBy/abstractOverride.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInDelegationBy() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/delegationBy"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("delegationToSubType.kt")
|
||||
public void testDelegationToSubType() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegationBy/delegationToSubType.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("delegationToSubTypeProperty.kt")
|
||||
public void testDelegationToSubTypeProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegationBy/delegationToSubTypeProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("delegationToSubTypeWithOverride.kt")
|
||||
public void testDelegationToSubTypeWithOverride() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegationBy/delegationToSubTypeWithOverride.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("delegationToSubTypeWithOverrideProperty.kt")
|
||||
public void testDelegationToSubTypeWithOverrideProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegationBy/delegationToSubTypeWithOverrideProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("diamond.kt")
|
||||
public void testDiamond() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegationBy/diamond.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("explicitOverride.kt")
|
||||
public void testExplicitOverride() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegationBy/explicitOverride.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("generic.kt")
|
||||
public void testGeneric() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegationBy/generic.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("sameDelegationInHierarchy.kt")
|
||||
public void testSameDelegationInHierarchy() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegationBy/sameDelegationInHierarchy.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("sameDelegationInHierarchy2.kt")
|
||||
public void testSameDelegationInHierarchy2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegationBy/sameDelegationInHierarchy2.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("severalDelegates.kt")
|
||||
public void testSeveralDelegates() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegationBy/severalDelegates.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegationBy/simple.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleNoOverride.kt")
|
||||
public void testSimpleNoOverride() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegationBy/simpleNoOverride.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleProp.kt")
|
||||
public void testSimpleProp() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/delegationBy/simpleProp.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/deparenthesize")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
// "Make 'A' abstract" "false"
|
||||
// ERROR: Class 'X' must override public open fun foo(): Unit defined in X because it inherits many implementations of it
|
||||
// ERROR: Delegated member 'fun foo(): Unit' hides supertype override: public open fun foo(): Unit defined in E. Please specify proper override explicitly
|
||||
// ACTION: Create test
|
||||
// ACTION: Make internal
|
||||
// ACTION: Make private
|
||||
|
||||
Reference in New Issue
Block a user