diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java index 8e525da0a78..9b3c73ea6a8 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java @@ -437,10 +437,15 @@ public abstract class StackValue { return new CoercionValue(value, castType); } - public static StackValue thisOrOuter(@NotNull ExpressionCodegen codegen, @NotNull ClassDescriptor descriptor, boolean isSuper, boolean isExplicit) { - // Coerce this/super for traits to support traits with required classes. + @NotNull + public static StackValue thisOrOuter( + @NotNull ExpressionCodegen codegen, + @NotNull ClassDescriptor descriptor, + boolean isSuper, + boolean isExplicit + ) { // Coerce explicit 'this' for the case when it is smart cast. - // Do not coerce for other classes due to the 'protected' access issues (JVMS 7, 4.9.2 Structural Constraints). + // Do not coerce for other cases due to the 'protected' access issues (JVMS 7, 4.9.2 Structural Constraints). boolean coerceType = descriptor.getKind() == ClassKind.INTERFACE || (isExplicit && !isSuper); return new ThisOuter(codegen, descriptor, isSuper, coerceType); } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/cfg/pseudocode/instructions/eval/operationInstructions.kt b/compiler/frontend/src/org/jetbrains/kotlin/cfg/pseudocode/instructions/eval/operationInstructions.kt index 79e834e0443..672f8172017 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/cfg/pseudocode/instructions/eval/operationInstructions.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/cfg/pseudocode/instructions/eval/operationInstructions.kt @@ -16,17 +16,17 @@ package org.jetbrains.kotlin.cfg.pseudocode.instructions.eval -import org.jetbrains.kotlin.psi.JetElement -import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall import org.jetbrains.kotlin.cfg.pseudocode.PseudoValue import org.jetbrains.kotlin.cfg.pseudocode.PseudoValueFactory -import org.jetbrains.kotlin.cfg.pseudocode.instructions.LexicalScope -import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionWithNext +import org.jetbrains.kotlin.cfg.pseudocode.TypePredicate import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionVisitor import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionVisitorWithResult -import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue +import org.jetbrains.kotlin.cfg.pseudocode.instructions.InstructionWithNext +import org.jetbrains.kotlin.cfg.pseudocode.instructions.LexicalScope import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor -import org.jetbrains.kotlin.cfg.pseudocode.TypePredicate +import org.jetbrains.kotlin.psi.JetElement +import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall +import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue public abstract class OperationInstruction protected constructor( element: JetElement, @@ -53,11 +53,6 @@ public abstract class OperationInstruction protected constructor( } } -trait StrictlyValuedOperationInstruction: OperationInstruction { - override val outputValue: PseudoValue - get() = resultValue!! -} - public class CallInstruction private constructor( element: JetElement, lexicalScope: LexicalScope, @@ -103,9 +98,12 @@ public class MagicInstruction( inputValues: List, val expectedTypes: Map, val kind: MagicKind -) : OperationInstruction(element, lexicalScope, inputValues), StrictlyValuedOperationInstruction { +) : OperationInstruction(element, lexicalScope, inputValues) { public val synthetic: Boolean get() = outputValue.element == null + override val outputValue: PseudoValue + get() = resultValue!! + override fun accept(visitor: InstructionVisitor) = visitor.visitMagic(this) override fun accept(visitor: InstructionVisitorWithResult): R = visitor.visitMagic(this) @@ -156,7 +154,10 @@ class MergeInstruction private constructor( element: JetElement, lexicalScope: LexicalScope, inputValues: List -): OperationInstruction(element, lexicalScope, inputValues), StrictlyValuedOperationInstruction { +): OperationInstruction(element, lexicalScope, inputValues) { + override val outputValue: PseudoValue + get() = resultValue!! + override fun accept(visitor: InstructionVisitor) = visitor.visitMerge(this) override fun accept(visitor: InstructionVisitorWithResult): R = visitor.visitMerge(this) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 2b2031076d8..0cd7e590779 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -192,10 +192,7 @@ public interface Errors { DiagnosticFactory0 DELEGATION_IN_TRAIT = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 TRAIT_WITH_SUPERCLASS = DiagnosticFactory0.create(WARNING); - - DiagnosticFactory2 UNMET_TRAIT_REQUIREMENT = - DiagnosticFactory2.create(ERROR, PositioningStrategies.DECLARATION_NAME); + DiagnosticFactory0 TRAIT_WITH_SUPERCLASS = DiagnosticFactory0.create(ERROR); // Enum-specific diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index f81f712aee8..060bd066846 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -296,7 +296,6 @@ public class DefaultErrorMessages { MAP.put(DELEGATION_IN_TRAIT, "Interfaces cannot use delegation"); MAP.put(DELEGATION_NOT_TO_TRAIT, "Only interfaces can be delegated to"); MAP.put(DEPRECATED_TRAIT_KEYWORD, "'trait' keyword is deprecated, use 'interface' instead"); - MAP.put(UNMET_TRAIT_REQUIREMENT, "Super interface ''{0}'' requires subclasses to extend ''{1}''", NAME, NAME); MAP.put(NO_CONSTRUCTOR, "This class does not have a constructor"); MAP.put(NOT_A_CLASS, "Not a class"); MAP.put(ILLEGAL_ESCAPE_SEQUENCE, "Illegal escape sequence"); @@ -428,7 +427,7 @@ public class DefaultErrorMessages { MAP.put(SUPERTYPE_INITIALIZED_IN_TRAIT, "Interfaces cannot initialize supertypes"); MAP.put(CLASS_IN_SUPERTYPE_FOR_ENUM, "Enum class cannot inherit from classes"); MAP.put(CONSTRUCTOR_IN_TRAIT, "An interface may not have a constructor"); - MAP.put(TRAIT_WITH_SUPERCLASS, "Specifying a required base class for interface implementations is deprecated"); + MAP.put(TRAIT_WITH_SUPERCLASS, "An interface cannot inherit from a class"); MAP.put(SUPERTYPE_APPEARS_TWICE, "A supertype appears twice"); MAP.put(FINAL_SUPERTYPE, "This type is final, so it cannot be inherited from"); MAP.put(SINGLETON_IN_SUPERTYPE, "Cannot inherit from a singleton"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java index 9b7736ceb38..09526f89e17 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java @@ -426,6 +426,8 @@ public class BodyResolver { JetTypeReference typeReference = entry.getKey(); JetType supertype = entry.getValue(); + boolean addSupertype = true; + ClassDescriptor classDescriptor = TypeUtils.getClassDescriptor(supertype); if (classDescriptor != null) { if (ErrorUtils.isError(classDescriptor)) continue; @@ -433,11 +435,14 @@ public class BodyResolver { if (classDescriptor.getKind() != ClassKind.INTERFACE) { if (supertypeOwner.getKind() == ClassKind.ENUM_CLASS) { trace.report(CLASS_IN_SUPERTYPE_FOR_ENUM.on(typeReference)); + addSupertype = false; } else if (supertypeOwner.getKind() == ClassKind.INTERFACE && !classAppeared && !TypesPackage.isDynamic(supertype) /* avoid duplicate diagnostics */) { trace.report(TRAIT_WITH_SUPERCLASS.on(typeReference)); + addSupertype = false; } + if (classAppeared) { trace.report(MANY_CLASSES_IN_SUPERTYPE_LIST.on(typeReference)); } @@ -451,7 +456,7 @@ public class BodyResolver { } TypeConstructor constructor = supertype.getConstructor(); - if (!typeConstructors.add(constructor)) { + if (addSupertype && !typeConstructors.add(constructor)) { trace.report(SUPERTYPE_APPEARS_TWICE.on(typeReference)); } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzer.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzer.kt index dc408c3c709..31ddc27f0a6 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzer.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzer.kt @@ -21,16 +21,15 @@ import com.google.common.collect.Multimap import com.intellij.psi.PsiElement import com.intellij.psi.util.PsiTreeUtil import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.diagnostics.Errors.CONSTRUCTOR_IN_OBJECT import org.jetbrains.kotlin.diagnostics.Errors.CONSTRUCTOR_IN_TRAIT import org.jetbrains.kotlin.diagnostics.Errors.MANY_COMPANION_OBJECTS -import org.jetbrains.kotlin.diagnostics.Errors.CONSTRUCTOR_IN_OBJECT import org.jetbrains.kotlin.diagnostics.Errors.UNSUPPORTED import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo import org.jetbrains.kotlin.resolve.lazy.* import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor -import org.jetbrains.kotlin.resolve.resolveUtil.checkTraitRequirements import org.jetbrains.kotlin.resolve.varianceChecker.VarianceChecker import java.util.ArrayList import javax.inject.Inject @@ -244,8 +243,6 @@ public class LazyTopDownAnalyzer { declarationResolver!!.checkRedeclarationsInPackages(topLevelDescriptorProvider!!, topLevelFqNames) declarationResolver!!.checkRedeclarations(c) - checkTraitRequirements(c.getDeclaredClasses(), trace!!) - overrideResolver!!.check(c) varianceChecker!!.check(c) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkTraitRequirements.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkTraitRequirements.kt deleted file mode 100644 index ac6851e1a54..00000000000 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkTraitRequirements.kt +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.resolve.resolveUtil - -import org.jetbrains.kotlin.descriptors.ClassDescriptor -import org.jetbrains.kotlin.resolve.DescriptorUtils -import org.jetbrains.kotlin.types.TypeUtils -import org.jetbrains.kotlin.builtins.KotlinBuiltIns -import org.jetbrains.kotlin.diagnostics.Errors -import org.jetbrains.kotlin.psi.JetClassOrObject -import org.jetbrains.kotlin.descriptors.ClassDescriptorWithResolutionScopes -import org.jetbrains.kotlin.resolve.BindingTrace -import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperClassOrAny - -fun checkTraitRequirements(c: Map, trace: BindingTrace) { - for ((classOrObject, descriptor) in c.entrySet()) { - if (DescriptorUtils.isTrait(descriptor)) continue - - val satisfiedRequirements = getSuperClassesReachableByClassInheritance(descriptor) - for (superTrait in getAllSuperTraits(descriptor)) { - for (traitSupertype in superTrait.getDefaultType().getConstructor().getSupertypes()) { - val traitSuperClass = traitSupertype.getConstructor().getDeclarationDescriptor() - if (DescriptorUtils.isClass(traitSuperClass) && traitSuperClass !in satisfiedRequirements) { - trace.report(Errors.UNMET_TRAIT_REQUIREMENT.on(classOrObject, superTrait, traitSuperClass as ClassDescriptor)) - } - } - } - } -} - -private fun getAllSuperTraits(descriptor: ClassDescriptor): List { - @suppress("UNCHECKED_CAST") - return TypeUtils.getAllSupertypes(descriptor.getDefaultType()) - .map { supertype -> supertype.getConstructor().getDeclarationDescriptor() } - .filter { superClass -> DescriptorUtils.isTrait(superClass) } as List -} - -private fun getSuperClassesReachableByClassInheritance( - descriptor: ClassDescriptor, - result: MutableSet = hashSetOf() -): Set { - val superClass = descriptor.getSuperClassOrAny() - result.add(superClass) - if (!KotlinBuiltIns.isAny(superClass)) { - getSuperClassesReachableByClassInheritance(superClass, result) - } - return result -} diff --git a/compiler/testData/codegen/box/bridges/complexMultiInheritance.kt b/compiler/testData/codegen/box/bridges/complexMultiInheritance.kt index 2128aa8fab4..6d03b1f1f6e 100644 --- a/compiler/testData/codegen/box/bridges/complexMultiInheritance.kt +++ b/compiler/testData/codegen/box/bridges/complexMultiInheritance.kt @@ -2,8 +2,6 @@ open class A { open fun foo(): Any = "A" } -interface B : A - open class C : A() { override fun foo(): Int = 222 } @@ -12,14 +10,13 @@ interface D { fun foo(): Number } -class E : B, C(), D +class E : C(), D fun box(): String { val e = E() if (e.foo() != 222) return "Fail 1" if ((e : D).foo() != 222) return "Fail 2" if ((e : C).foo() != 222) return "Fail 3" - if ((e : B).foo() != 222) return "Fail 4" - if ((e : A).foo() != 222) return "Fail 5" + if ((e : A).foo() != 222) return "Fail 4" return "OK" } diff --git a/compiler/testData/codegen/box/bridges/fakeOverrideInTraitWithRequiredFromTraitImpl.kt b/compiler/testData/codegen/box/bridges/fakeOverrideInTraitWithRequiredFromTraitImpl.kt deleted file mode 100644 index fee76a53e9c..00000000000 --- a/compiler/testData/codegen/box/bridges/fakeOverrideInTraitWithRequiredFromTraitImpl.kt +++ /dev/null @@ -1,17 +0,0 @@ -abstract class A { - abstract fun foo(): Any -} - -interface B { - fun foo(): String = "B" -} - -interface C : A, B - -class D : A(), C - -fun box(): String { - val d = D() - val r = d.foo() + (d : C).foo() + (d : B).foo() + (d : A).foo() - return if (r == "BBBB") "OK" else "Fail: $r" -} diff --git a/compiler/testData/codegen/box/bridges/traitWithRequiredCovariantOverride.kt b/compiler/testData/codegen/box/bridges/traitWithRequiredCovariantOverride.kt deleted file mode 100644 index 997a5c33760..00000000000 --- a/compiler/testData/codegen/box/bridges/traitWithRequiredCovariantOverride.kt +++ /dev/null @@ -1,15 +0,0 @@ -open class A { - open fun foo(): Any = "A" -} - -interface B : A { - override fun foo(): String = "B" -} - -class C : A(), B - -fun box(): String { - val c = C() - val r = c.foo() + (c : B).foo() + (c : A).foo() - return if (r == "BBB") "OK" else "Fail: $r" -} diff --git a/compiler/testData/codegen/box/classes/kt3862.kt b/compiler/testData/codegen/box/classes/kt3862.kt deleted file mode 100644 index 6f020ac8ab0..00000000000 --- a/compiler/testData/codegen/box/classes/kt3862.kt +++ /dev/null @@ -1,18 +0,0 @@ -open class A { - open fun foo(a: T): Int = 2 -} - -interface B : A { - override fun foo(a: T): Int = 1 -} - -class D : B, A() { - fun boo(): Int { - return super.foo(1) - } -} - -fun box(): String { - if (D().boo() != 1) return "Fail" - return "OK" -} diff --git a/compiler/testData/codegen/box/closures/closureInsideClosure/propertyAndFunctionNameClash.kt b/compiler/testData/codegen/box/closures/closureInsideClosure/propertyAndFunctionNameClash.kt index b19e4b61b0d..ce7572bcabb 100644 --- a/compiler/testData/codegen/box/closures/closureInsideClosure/propertyAndFunctionNameClash.kt +++ b/compiler/testData/codegen/box/closures/closureInsideClosure/propertyAndFunctionNameClash.kt @@ -24,8 +24,8 @@ class LI : ListTag() {} public fun ListTag.item(body: LI.() -> Unit): Unit {} fun HtmlTag.a(contents: A.() -> Unit) {} -interface A : HtmlTag { - public var text: String +abstract class A : HtmlTag() { + public abstract var text: String } fun listOf(vararg strings: String): List { @@ -34,4 +34,4 @@ fun listOf(vararg strings: String): List { list.add(s) } return list -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/properties/traitExtendsClass.kt b/compiler/testData/codegen/box/properties/traitExtendsClass.kt deleted file mode 100644 index d1aa10bec1a..00000000000 --- a/compiler/testData/codegen/box/properties/traitExtendsClass.kt +++ /dev/null @@ -1,17 +0,0 @@ -open class Base { - val pr : String = "OK" -} - -interface Trait : Base { - fun f() : String { - return this.pr - } -} - -class A : Trait, Base() { - -} - -fun box() : String { - return if (A().f() == A().pr) "OK" else "fail" -} \ No newline at end of file diff --git a/compiler/testData/codegen/box/super/kt3538.kt b/compiler/testData/codegen/box/super/kt3538.kt deleted file mode 100644 index 7186da045ec..00000000000 --- a/compiler/testData/codegen/box/super/kt3538.kt +++ /dev/null @@ -1,21 +0,0 @@ -open class Base { - open fun sayHello(): String { - return "O" - } -} - -interface Trait: Base { - override fun sayHello(): String { - return "K" - } -} - -class Derived(): Base(), Trait { - override fun sayHello(): String { - return super.sayHello() + super.sayHello() - } -} - -fun box(): String { - return Derived().sayHello() -} \ No newline at end of file diff --git a/compiler/testData/codegen/box/traits/withRequired/generic.kt b/compiler/testData/codegen/box/traits/withRequired/generic.kt deleted file mode 100644 index 75d26e62299..00000000000 --- a/compiler/testData/codegen/box/traits/withRequired/generic.kt +++ /dev/null @@ -1,15 +0,0 @@ -open class AL { - fun get(index: Int) : T? = null -} - -interface ALE : AL { - fun getOrValue(index: Int, value : T) : T = get(index) ?: value -} - -class SmartArrayList() : ALE, AL() { -} - -fun box() : String { - val c = SmartArrayList() - return if("239" == c.getOrValue(0, "239")) "OK" else "fail" -} diff --git a/compiler/testData/codegen/box/traits/withRequired/genericProperty.kt b/compiler/testData/codegen/box/traits/withRequired/genericProperty.kt deleted file mode 100644 index 2579ef900b5..00000000000 --- a/compiler/testData/codegen/box/traits/withRequired/genericProperty.kt +++ /dev/null @@ -1,19 +0,0 @@ -abstract class Base { - abstract var s: T -} - -interface Trait : Base { - var value : T - get() = s - set(value) { s = value } -} - -class Derived : Trait, Base() { - override var s = "Fail" -} - -fun box(): String { - val d = Derived() - d.value = "OK" - return d.value -} diff --git a/compiler/testData/codegen/box/traits/withRequired/kt1936_2.kt b/compiler/testData/codegen/box/traits/withRequired/kt1936_2.kt deleted file mode 100644 index 8c17c464421..00000000000 --- a/compiler/testData/codegen/box/traits/withRequired/kt1936_2.kt +++ /dev/null @@ -1,15 +0,0 @@ -open class MyClass(param : String) { - var propterty = param -} - -interface MyTrait : MyClass -{ - fun foo() = propterty -} - -open class B(param : String) : MyTrait, MyClass(param) -{ - override fun foo() = super.foo() -} - -fun box()= B("OK").foo() diff --git a/compiler/testData/codegen/box/traits/withRequired/kt2963.kt b/compiler/testData/codegen/box/traits/withRequired/kt2963.kt deleted file mode 100644 index 2d463906975..00000000000 --- a/compiler/testData/codegen/box/traits/withRequired/kt2963.kt +++ /dev/null @@ -1,15 +0,0 @@ -open class Base - -interface Derived : Base { - fun foo(): String { - return object { - fun bar() = baz(this@Derived) - }.bar() - } -} - -class DerivedImpl : Derived, Base() - -fun baz(b: Base) = "OK" - -fun box() = DerivedImpl().foo() diff --git a/compiler/testData/codegen/box/traits/withRequired/kt3413.kt b/compiler/testData/codegen/box/traits/withRequired/kt3413.kt deleted file mode 100644 index a27f370230f..00000000000 --- a/compiler/testData/codegen/box/traits/withRequired/kt3413.kt +++ /dev/null @@ -1,9 +0,0 @@ -interface Trait> : Enum { - val value : String get() = name() -} - -enum class E : Trait { - OK -} - -fun box() = E.OK.value diff --git a/compiler/testData/codegen/box/traits/withRequired/kt3429.kt b/compiler/testData/codegen/box/traits/withRequired/kt3429.kt deleted file mode 100644 index 18a55c90083..00000000000 --- a/compiler/testData/codegen/box/traits/withRequired/kt3429.kt +++ /dev/null @@ -1,17 +0,0 @@ -open class Base { - open fun sayHello(): String{ - return "fail" - } -} - -interface Trait: Base { - override fun sayHello(): String { - return "OK" - } -} - -class Derived(): Base(), Trait - -fun box() : String { - return Derived().sayHello() -} \ No newline at end of file diff --git a/compiler/testData/codegen/box/traits/withRequired/property.kt b/compiler/testData/codegen/box/traits/withRequired/property.kt deleted file mode 100644 index f6945f36518..00000000000 --- a/compiler/testData/codegen/box/traits/withRequired/property.kt +++ /dev/null @@ -1,17 +0,0 @@ -open class Base { - var s = "Fail" -} - -interface Trait : Base { - var value : String - get() = s - set(value) { s = value } -} - -class Derived : Trait, Base() - -fun box(): String { - val d = Derived() - d.value = "OK" - return d.value -} diff --git a/compiler/testData/codegen/box/traits/withRequired/propertyViaBridge.kt b/compiler/testData/codegen/box/traits/withRequired/propertyViaBridge.kt deleted file mode 100644 index 96ed04b4aa6..00000000000 --- a/compiler/testData/codegen/box/traits/withRequired/propertyViaBridge.kt +++ /dev/null @@ -1,14 +0,0 @@ -open class Base - -interface Trait : Base { - private val value : String - get() = "OK" - - override fun toString() = object { - fun foo() = value - }.foo() -} - -class Derived : Trait, Base() - -fun box() = "${Derived()}" diff --git a/compiler/testData/codegen/box/traits/withRequired/simple.kt b/compiler/testData/codegen/box/traits/withRequired/simple.kt deleted file mode 100644 index 2a4b89e189d..00000000000 --- a/compiler/testData/codegen/box/traits/withRequired/simple.kt +++ /dev/null @@ -1,11 +0,0 @@ -interface Trait : java.lang.Object { - fun foo(): String = "239 " + toString() -} - -class Impl : Trait, java.lang.Object() { - override fun toString() = "Impl" -} - -fun box(): String { - return if ("239 Impl" == Impl().foo()) "OK" else "Fail" -} diff --git a/compiler/testData/codegen/box/traits/withRequired/super.kt b/compiler/testData/codegen/box/traits/withRequired/super.kt deleted file mode 100644 index 064084c26ba..00000000000 --- a/compiler/testData/codegen/box/traits/withRequired/super.kt +++ /dev/null @@ -1,18 +0,0 @@ -open class Base { - open fun foo() : String { - return "fail" - } -} - -interface Derived : Base { - override fun foo() : String { - //super.foo() - return "OK" - } -} - -class DerivedImpl : Derived, Base() - -fun box(): String { - return DerivedImpl().foo() -} diff --git a/compiler/testData/codegen/box/traits/withRequired/superViaBridge.kt b/compiler/testData/codegen/box/traits/withRequired/superViaBridge.kt deleted file mode 100644 index 7bd8a552608..00000000000 --- a/compiler/testData/codegen/box/traits/withRequired/superViaBridge.kt +++ /dev/null @@ -1,22 +0,0 @@ -open class Base { - open fun foo() { } - open fun foo2() { } -} - -interface Derived : Base { - override fun foo() { - object { - fun bar() { - //super@Derived.foo2() - this@Derived.foo2() - } - }.bar() - } -} - -class DerivedImpl : Derived, Base() - -fun box(): String { - DerivedImpl().foo() - return "OK" -} diff --git a/compiler/testData/codegen/box/traits/withRequired/traitFuncCall.kt b/compiler/testData/codegen/box/traits/withRequired/traitFuncCall.kt deleted file mode 100644 index b704ceb9e2d..00000000000 --- a/compiler/testData/codegen/box/traits/withRequired/traitFuncCall.kt +++ /dev/null @@ -1,17 +0,0 @@ -open class Foo() { - public fun k(): String = "K" -} - - -interface T: Foo { - public fun xyzzy(): String = o() + k() - public fun o(): String -} - -class TImpl(): Foo(), T { - public override fun o(): String = "O" -} - -fun box(): String { - return TImpl().xyzzy() -} diff --git a/compiler/testData/diagnostics/tests/cast/neverSucceeds/NoGenericsRelated.kt b/compiler/testData/diagnostics/tests/cast/neverSucceeds/NoGenericsRelated.kt index 83a09248321..da97c3cee27 100644 --- a/compiler/testData/diagnostics/tests/cast/neverSucceeds/NoGenericsRelated.kt +++ b/compiler/testData/diagnostics/tests/cast/neverSucceeds/NoGenericsRelated.kt @@ -5,7 +5,7 @@ interface T3 open class OC1: T1 open class OC2: OC1(), T2 class FC1: OC2(), T3 -interface T4: OC1 +interface T4: OC1 interface T5: T2 fun test( diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/abstractClass.kt b/compiler/testData/diagnostics/tests/traitWithRequired/abstractClass.kt deleted file mode 100644 index 1b1c68bf368..00000000000 --- a/compiler/testData/diagnostics/tests/traitWithRequired/abstractClass.kt +++ /dev/null @@ -1,7 +0,0 @@ -open class Required - -interface Trait : Required - -abstract class Abstract : Trait - -abstract class AbstractDerived : Abstract() \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/abstractClass.txt b/compiler/testData/diagnostics/tests/traitWithRequired/abstractClass.txt deleted file mode 100644 index 95d5f579e9c..00000000000 --- a/compiler/testData/diagnostics/tests/traitWithRequired/abstractClass.txt +++ /dev/null @@ -1,28 +0,0 @@ -package - -internal abstract class Abstract : Trait { - public constructor Abstract() - 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 abstract class AbstractDerived : Abstract { - public constructor AbstractDerived() - 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 open class Required { - public constructor Required() - 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 interface Trait : Required { - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/anonymousObjectExtendsTraitWithRequired.kt b/compiler/testData/diagnostics/tests/traitWithRequired/anonymousObjectExtendsTraitWithRequired.kt deleted file mode 100644 index 2be1de89415..00000000000 --- a/compiler/testData/diagnostics/tests/traitWithRequired/anonymousObjectExtendsTraitWithRequired.kt +++ /dev/null @@ -1,6 +0,0 @@ -open class Required - -interface A : Required - -val a = object : A {} -val b: A = object : A, Required() {} diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/anonymousObjectExtendsTraitWithRequired.txt b/compiler/testData/diagnostics/tests/traitWithRequired/anonymousObjectExtendsTraitWithRequired.txt deleted file mode 100644 index be0e2485e80..00000000000 --- a/compiler/testData/diagnostics/tests/traitWithRequired/anonymousObjectExtendsTraitWithRequired.txt +++ /dev/null @@ -1,17 +0,0 @@ -package - -internal val a: A -internal val b: A - -internal interface A : Required { - 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 open class Required { - public constructor Required() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/differentGenericArguments.kt b/compiler/testData/diagnostics/tests/traitWithRequired/differentGenericArguments.kt deleted file mode 100644 index ab90db2cd01..00000000000 --- a/compiler/testData/diagnostics/tests/traitWithRequired/differentGenericArguments.kt +++ /dev/null @@ -1,8 +0,0 @@ -open class Generic - -interface A : Generic - -interface B : Generic - -class Y : A, B -class Z : A, B, Generic() diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/differentGenericArguments.txt b/compiler/testData/diagnostics/tests/traitWithRequired/differentGenericArguments.txt deleted file mode 100644 index 02273eb1cff..00000000000 --- a/compiler/testData/diagnostics/tests/traitWithRequired/differentGenericArguments.txt +++ /dev/null @@ -1,34 +0,0 @@ -package - -internal interface A : Generic { - 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 interface B : Generic { - 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 open class Generic { - public constructor Generic() - 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 Y : A, B { - public constructor Y() - public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String -} - -internal final class Z : A, B, Generic { - public constructor Z() - 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*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/kt3006.kt b/compiler/testData/diagnostics/tests/traitWithRequired/kt3006.kt deleted file mode 100644 index 426c86fda20..00000000000 --- a/compiler/testData/diagnostics/tests/traitWithRequired/kt3006.kt +++ /dev/null @@ -1,13 +0,0 @@ -open class Base { -} - -interface Derived: Base { - fun foo() { - f1(this@Derived) - } -} - -class DerivedImpl(): Derived {} -object ObjectImpl: Derived {} - -fun f1(b: Base) = b diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/kt3006.txt b/compiler/testData/diagnostics/tests/traitWithRequired/kt3006.txt deleted file mode 100644 index c1b7ea9b199..00000000000 --- a/compiler/testData/diagnostics/tests/traitWithRequired/kt3006.txt +++ /dev/null @@ -1,33 +0,0 @@ -package - -internal fun f1(/*0*/ b: Base): Base - -internal open class Base { - public constructor Base() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -internal interface Derived : Base { - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - internal open fun foo(): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -internal final class DerivedImpl : Derived { - public constructor DerivedImpl() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - internal open override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -internal object ObjectImpl : Derived { - private constructor ObjectImpl() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - internal open override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/manyRequirementsDisallowed.kt b/compiler/testData/diagnostics/tests/traitWithRequired/manyRequirementsDisallowed.kt deleted file mode 100644 index 7c8060832e7..00000000000 --- a/compiler/testData/diagnostics/tests/traitWithRequired/manyRequirementsDisallowed.kt +++ /dev/null @@ -1,4 +0,0 @@ -open class A -open class B - -interface C : A, B \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/manyRequirementsDisallowed.txt b/compiler/testData/diagnostics/tests/traitWithRequired/manyRequirementsDisallowed.txt deleted file mode 100644 index 7f2d5e3eedd..00000000000 --- a/compiler/testData/diagnostics/tests/traitWithRequired/manyRequirementsDisallowed.txt +++ /dev/null @@ -1,21 +0,0 @@ -package - -internal open class A { - public constructor A() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -internal open class B { - public constructor B() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -internal interface C : A, B { - public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/manyTraitsRequireSameClass.kt b/compiler/testData/diagnostics/tests/traitWithRequired/manyTraitsRequireSameClass.kt deleted file mode 100644 index 693178cab97..00000000000 --- a/compiler/testData/diagnostics/tests/traitWithRequired/manyTraitsRequireSameClass.kt +++ /dev/null @@ -1,14 +0,0 @@ -open class Required - -interface A : Required - -interface B : A, Required - -interface C : Required - -interface D : B, Required - -class W : D -class X : D, Required() -class Y : C, D -class Z : D, C, Required() diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/manyTraitsRequireSameClass.txt b/compiler/testData/diagnostics/tests/traitWithRequired/manyTraitsRequireSameClass.txt deleted file mode 100644 index 350b5b50b2f..00000000000 --- a/compiler/testData/diagnostics/tests/traitWithRequired/manyTraitsRequireSameClass.txt +++ /dev/null @@ -1,60 +0,0 @@ -package - -internal interface A : Required { - 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 interface B : A, Required { - public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String -} - -internal interface C : Required { - 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 interface D : B, Required { - public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String -} - -internal open class Required { - public constructor Required() - 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 W : D { - public constructor W() - 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 X : D, Required { - public constructor X() - public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String -} - -internal final class Y : C, D { - public constructor Y() - public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String -} - -internal final class Z : D, C, Required { - public constructor Z() - 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*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/requirementFulfilledBySubclass.kt b/compiler/testData/diagnostics/tests/traitWithRequired/requirementFulfilledBySubclass.kt deleted file mode 100644 index 99cea06bcfc..00000000000 --- a/compiler/testData/diagnostics/tests/traitWithRequired/requirementFulfilledBySubclass.kt +++ /dev/null @@ -1,8 +0,0 @@ -open class RequiredBase - -interface Trait : RequiredBase - -open class RequiredDerived : RequiredBase() - -class A : Trait -class B : Trait, RequiredDerived() diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/requirementFulfilledBySubclass.txt b/compiler/testData/diagnostics/tests/traitWithRequired/requirementFulfilledBySubclass.txt deleted file mode 100644 index 384a8cdec9f..00000000000 --- a/compiler/testData/diagnostics/tests/traitWithRequired/requirementFulfilledBySubclass.txt +++ /dev/null @@ -1,35 +0,0 @@ -package - -internal final class A : Trait { - public constructor A() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -internal final class B : Trait, RequiredDerived { - public constructor B() - public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String -} - -internal open class RequiredBase { - public constructor RequiredBase() - 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 open class RequiredDerived : RequiredBase { - public constructor RequiredDerived() - 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 interface Trait : RequiredBase { - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/traitExtendsTraitWithRequired.kt b/compiler/testData/diagnostics/tests/traitWithRequired/traitExtendsTraitWithRequired.kt deleted file mode 100644 index b771f2d842b..00000000000 --- a/compiler/testData/diagnostics/tests/traitWithRequired/traitExtendsTraitWithRequired.kt +++ /dev/null @@ -1,8 +0,0 @@ -open class Required(val value: String) - -interface First : Required - -interface Second : First - -class Y : Second -class Z : Second, Required(":o)") diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/traitExtendsTraitWithRequired.txt b/compiler/testData/diagnostics/tests/traitWithRequired/traitExtendsTraitWithRequired.txt deleted file mode 100644 index 9be8c52256c..00000000000 --- a/compiler/testData/diagnostics/tests/traitWithRequired/traitExtendsTraitWithRequired.txt +++ /dev/null @@ -1,39 +0,0 @@ -package - -internal interface First : Required { - internal final override /*1*/ /*fake_override*/ val value: 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 -} - -internal open class Required { - public constructor Required(/*0*/ value: kotlin.String) - internal final val value: 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 -} - -internal interface Second : First { - internal final override /*1*/ /*fake_override*/ val value: 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 -} - -internal final class Y : Second { - public constructor Y() - internal final override /*1*/ /*fake_override*/ val value: 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 -} - -internal final class Z : Second, Required { - public constructor Z() - internal final override /*2*/ /*fake_override*/ val value: kotlin.String - public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/traitSupertypeList.kt b/compiler/testData/diagnostics/tests/traitWithRequired/traitSupertypeList.kt index af9ead46dec..71873609eb9 100644 --- a/compiler/testData/diagnostics/tests/traitWithRequired/traitSupertypeList.kt +++ b/compiler/testData/diagnostics/tests/traitWithRequired/traitSupertypeList.kt @@ -1,6 +1,6 @@ open class bar() -interface Foo() : bar(), bar, bar { +interface Foo() : bar(), bar, bar { } interface Foo2 : bar, Foo { diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/uninheritableTraitDifferentGenericArguments.kt b/compiler/testData/diagnostics/tests/traitWithRequired/uninheritableTraitDifferentGenericArguments.kt deleted file mode 100644 index d9788d49103..00000000000 --- a/compiler/testData/diagnostics/tests/traitWithRequired/uninheritableTraitDifferentGenericArguments.kt +++ /dev/null @@ -1,7 +0,0 @@ -open class Generic - -interface A : Generic - -interface B : Generic - -interface C : A, B diff --git a/compiler/testData/diagnostics/tests/traitWithRequired/uninheritableTraitDifferentGenericArguments.txt b/compiler/testData/diagnostics/tests/traitWithRequired/uninheritableTraitDifferentGenericArguments.txt deleted file mode 100644 index 0ecd458ba78..00000000000 --- a/compiler/testData/diagnostics/tests/traitWithRequired/uninheritableTraitDifferentGenericArguments.txt +++ /dev/null @@ -1,26 +0,0 @@ -package - -internal interface A : Generic { - 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 interface B : Generic { - 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 interface C : A, B { - public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String -} - -internal open class Generic { - public constructor Generic() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} diff --git a/compiler/testData/loadJava/compiledKotlin/fun/NoDelegationForFunctionInheritedFromTraitSuperClass.kt b/compiler/testData/loadJava/compiledKotlin/fun/NoDelegationForFunctionInheritedFromTraitSuperClass.kt deleted file mode 100644 index 0814ecc70ac..00000000000 --- a/compiler/testData/loadJava/compiledKotlin/fun/NoDelegationForFunctionInheritedFromTraitSuperClass.kt +++ /dev/null @@ -1,23 +0,0 @@ -package test - -abstract class A { - abstract fun foo() -} - -interface X : A { - fun bar() { - } -} - -open class B() : A() { - override fun foo() { - } -} - -class C() : A(), X { - override fun foo() { - } -} - -class D(val c: C) : B(), X by c { -} \ No newline at end of file diff --git a/compiler/testData/loadJava/compiledKotlin/fun/NoDelegationForFunctionInheritedFromTraitSuperClass.txt b/compiler/testData/loadJava/compiledKotlin/fun/NoDelegationForFunctionInheritedFromTraitSuperClass.txt deleted file mode 100644 index 22c894c0e85..00000000000 --- a/compiler/testData/loadJava/compiledKotlin/fun/NoDelegationForFunctionInheritedFromTraitSuperClass.txt +++ /dev/null @@ -1,30 +0,0 @@ -package test - -internal abstract class A { - /*primary*/ public constructor A() - internal abstract fun foo(): kotlin.Unit -} - -internal open class B : test.A { - /*primary*/ public constructor B() - internal open override /*1*/ fun foo(): kotlin.Unit -} - -internal final class C : test.A, test.X { - /*primary*/ public constructor C() - internal open override /*1*/ /*fake_override*/ fun bar(): kotlin.Unit - internal open override /*2*/ fun foo(): kotlin.Unit -} - -internal final class D : test.B, test.X { - /*primary*/ public constructor D(/*0*/ c: test.C) - internal final val c: test.C - internal final fun (): test.C - internal open override /*1*/ /*delegation*/ fun bar(): kotlin.Unit - internal open override /*2*/ /*fake_override*/ fun foo(): kotlin.Unit -} - -internal interface X : test.A { - internal open fun bar(): kotlin.Unit - internal abstract override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit -} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java index 84293d09ec6..f88255e2293 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java @@ -13412,58 +13412,10 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class TraitWithRequired extends AbstractJetDiagnosticsTest { - @TestMetadata("abstractClass.kt") - public void testAbstractClass() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/traitWithRequired/abstractClass.kt"); - doTest(fileName); - } - public void testAllFilesPresentInTraitWithRequired() throws Exception { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/traitWithRequired"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("anonymousObjectExtendsTraitWithRequired.kt") - public void testAnonymousObjectExtendsTraitWithRequired() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/traitWithRequired/anonymousObjectExtendsTraitWithRequired.kt"); - doTest(fileName); - } - - @TestMetadata("differentGenericArguments.kt") - public void testDifferentGenericArguments() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/traitWithRequired/differentGenericArguments.kt"); - doTest(fileName); - } - - @TestMetadata("kt3006.kt") - public void testKt3006() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/traitWithRequired/kt3006.kt"); - doTest(fileName); - } - - @TestMetadata("manyRequirementsDisallowed.kt") - public void testManyRequirementsDisallowed() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/traitWithRequired/manyRequirementsDisallowed.kt"); - doTest(fileName); - } - - @TestMetadata("manyTraitsRequireSameClass.kt") - public void testManyTraitsRequireSameClass() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/traitWithRequired/manyTraitsRequireSameClass.kt"); - doTest(fileName); - } - - @TestMetadata("requirementFulfilledBySubclass.kt") - public void testRequirementFulfilledBySubclass() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/traitWithRequired/requirementFulfilledBySubclass.kt"); - doTest(fileName); - } - - @TestMetadata("traitExtendsTraitWithRequired.kt") - public void testTraitExtendsTraitWithRequired() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/traitWithRequired/traitExtendsTraitWithRequired.kt"); - doTest(fileName); - } - @TestMetadata("traitRequiresAny.kt") public void testTraitRequiresAny() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/traitWithRequired/traitRequiresAny.kt"); @@ -13475,12 +13427,6 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/traitWithRequired/traitSupertypeList.kt"); doTest(fileName); } - - @TestMetadata("uninheritableTraitDifferentGenericArguments.kt") - public void testUninheritableTraitDifferentGenericArguments() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/traitWithRequired/uninheritableTraitDifferentGenericArguments.kt"); - doTest(fileName); - } } @TestMetadata("compiler/testData/diagnostics/tests/typedefs") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BridgeTest.kt b/compiler/tests/org/jetbrains/kotlin/codegen/BridgeTest.kt index 3f77925905a..59b2f870b99 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BridgeTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BridgeTest.kt @@ -66,10 +66,11 @@ class BridgeTest : TestCase() { * is either reachable from D or is reachable from any abstract super-declaration of F (or both). This condition is effectively * equivalent to the compiler guarantee that each class inherits not more than one implementation of each function. * - * NOTE: abstract fake overrides CAN have concrete super-declarations! (traits with required classes) - * - * NOTE 2: the graph validation procedure probably doesn't cover all the possible cases compared to the analogous code in the compiler. + * NOTE: the graph validation procedure probably doesn't cover all the possible cases compared to the analogous code in the compiler. * There may be bugs here and they should be fixed accordingly. + * + * TODO: also verify that no abstract fake override has a concrete super-declaration. + * This was previously possible via traits with required classes. */ private fun graph(vararg edges: Pair) { for ((from, to) in edges) { diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxCodegenTestGenerated.java index 9e20827179e..2563cbf4ed9 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxCodegenTestGenerated.java @@ -379,12 +379,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } - @TestMetadata("fakeOverrideInTraitWithRequiredFromTraitImpl.kt") - public void testFakeOverrideInTraitWithRequiredFromTraitImpl() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeOverrideInTraitWithRequiredFromTraitImpl.kt"); - doTest(fileName); - } - @TestMetadata("fakeOverrideOfPropertySetterInTraitImpl.kt") public void testFakeOverrideOfPropertySetterInTraitImpl() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeOverrideOfPropertySetterInTraitImpl.kt"); @@ -571,12 +565,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } - @TestMetadata("traitWithRequiredCovariantOverride.kt") - public void testTraitWithRequiredCovariantOverride() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/traitWithRequiredCovariantOverride.kt"); - doTest(fileName); - } - @TestMetadata("twoParentsWithDifferentMethodsTwoBridges.kt") public void testTwoParentsWithDifferentMethodsTwoBridges() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/twoParentsWithDifferentMethodsTwoBridges.kt"); @@ -1348,12 +1336,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } - @TestMetadata("kt3862.kt") - public void testKt3862() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/kt3862.kt"); - doTest(fileName); - } - @TestMetadata("kt454.kt") public void testKt454() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/classes/kt454.kt"); @@ -6196,12 +6178,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } - @TestMetadata("traitExtendsClass.kt") - public void testTraitExtendsClass() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/properties/traitExtendsClass.kt"); - doTest(fileName); - } - @TestMetadata("twoAnnotatedExtensionPropertiesWithoutBackingFields.kt") public void testTwoAnnotatedExtensionPropertiesWithoutBackingFields() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/properties/twoAnnotatedExtensionPropertiesWithoutBackingFields.kt"); @@ -6796,12 +6772,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } - @TestMetadata("kt3538.kt") - public void testKt3538() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/super/kt3538.kt"); - doTest(fileName); - } - @TestMetadata("kt4173.kt") public void testKt4173() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/super/kt4173.kt"); @@ -7110,87 +7080,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/traits/traitWithPrivateExtension.kt"); doTest(fileName); } - - @TestMetadata("compiler/testData/codegen/box/traits/withRequired") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class WithRequired extends AbstractBlackBoxCodegenTest { - public void testAllFilesPresentInWithRequired() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/traits/withRequired"), Pattern.compile("^(.+)\\.kt$"), true); - } - - @TestMetadata("generic.kt") - public void testGeneric() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/traits/withRequired/generic.kt"); - doTest(fileName); - } - - @TestMetadata("genericProperty.kt") - public void testGenericProperty() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/traits/withRequired/genericProperty.kt"); - doTest(fileName); - } - - @TestMetadata("kt1936_2.kt") - public void testKt1936_2() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/traits/withRequired/kt1936_2.kt"); - doTest(fileName); - } - - @TestMetadata("kt2963.kt") - public void testKt2963() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/traits/withRequired/kt2963.kt"); - doTest(fileName); - } - - @TestMetadata("kt3413.kt") - public void testKt3413() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/traits/withRequired/kt3413.kt"); - doTest(fileName); - } - - @TestMetadata("kt3429.kt") - public void testKt3429() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/traits/withRequired/kt3429.kt"); - doTest(fileName); - } - - @TestMetadata("property.kt") - public void testProperty() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/traits/withRequired/property.kt"); - doTest(fileName); - } - - @TestMetadata("propertyViaBridge.kt") - public void testPropertyViaBridge() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/traits/withRequired/propertyViaBridge.kt"); - doTest(fileName); - } - - @TestMetadata("simple.kt") - public void testSimple() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/traits/withRequired/simple.kt"); - doTest(fileName); - } - - @TestMetadata("super.kt") - public void testSuper() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/traits/withRequired/super.kt"); - doTest(fileName); - } - - @TestMetadata("superViaBridge.kt") - public void testSuperViaBridge() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/traits/withRequired/superViaBridge.kt"); - doTest(fileName); - } - - @TestMetadata("traitFuncCall.kt") - public void testTraitFuncCall() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/traits/withRequired/traitFuncCall.kt"); - doTest(fileName); - } - } } @TestMetadata("compiler/testData/codegen/box/typeInfo") diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java index 33bfdde1adb..89d0b94765f 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/LoadJavaTestGenerated.java @@ -3985,12 +3985,6 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest { doTestCompiledKotlin(fileName); } - @TestMetadata("NoDelegationForFunctionInheritedFromTraitSuperClass.kt") - public void testNoDelegationForFunctionInheritedFromTraitSuperClass() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/fun/NoDelegationForFunctionInheritedFromTraitSuperClass.kt"); - doTestCompiledKotlin(fileName); - } - @TestMetadata("NoSamAdapter.kt") public void testNoSamAdapter() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/fun/NoSamAdapter.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/runtime/JvmRuntimeDescriptorLoaderTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/jvm/runtime/JvmRuntimeDescriptorLoaderTestGenerated.java index 14267cfa3c1..9e1c62d4995 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/runtime/JvmRuntimeDescriptorLoaderTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/jvm/runtime/JvmRuntimeDescriptorLoaderTestGenerated.java @@ -2142,12 +2142,6 @@ public class JvmRuntimeDescriptorLoaderTestGenerated extends AbstractJvmRuntimeD doTest(fileName); } - @TestMetadata("NoDelegationForFunctionInheritedFromTraitSuperClass.kt") - public void testNoDelegationForFunctionInheritedFromTraitSuperClass() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/fun/NoDelegationForFunctionInheritedFromTraitSuperClass.kt"); - doTest(fileName); - } - @TestMetadata("NoSamAdapter.kt") public void testNoSamAdapter() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/fun/NoSamAdapter.kt"); diff --git a/idea/testData/checker/SupertypeListChecks.kt b/idea/testData/checker/SupertypeListChecks.kt index 9755d5016f9..0eb8dd60c24 100644 --- a/idea/testData/checker/SupertypeListChecks.kt +++ b/idea/testData/checker/SupertypeListChecks.kt @@ -24,11 +24,11 @@ interface T2 {} interface Test() { } -interface Test1 : C2() {} +interface Test1 : C2() {} -interface Test2 : C2 {} +interface Test2 : C2 {} -interface Test3 : C2, C3 {} +interface Test3 : C2, C3 {} interface Test4 : T1 {} diff --git a/idea/testData/checker/TraitSupertypeList.kt b/idea/testData/checker/TraitSupertypeList.kt index 4d0411e6305..505131f1cf9 100644 --- a/idea/testData/checker/TraitSupertypeList.kt +++ b/idea/testData/checker/TraitSupertypeList.kt @@ -1,10 +1,10 @@ open class bar() -interface Foo() : bar(), bar, bar { +interface Foo() : bar(), bar, bar { } -interface Foo2 : bar, Foo { +interface Foo2 : bar, Foo { } open class Foo1() : bar(), bar, Foo, Foo() {} -open class Foo12 : bar(), bar {} \ No newline at end of file +open class Foo12 : bar(), bar {} diff --git a/idea/testData/checker/unmetTraitRequirements.kt b/idea/testData/checker/unmetTraitRequirements.kt deleted file mode 100644 index 9973da8408c..00000000000 --- a/idea/testData/checker/unmetTraitRequirements.kt +++ /dev/null @@ -1,15 +0,0 @@ -open class Base { -} - -interface Derived: Base { - fun foo() { - f1(this@Derived) - } -} - -class DerivedImpl(): Derived {} -object ObjectImpl: Derived {} - -fun f1(b: Base) = b - -// KT-3006 \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/checkers/JetPsiCheckerTestGenerated.java b/idea/tests/org/jetbrains/kotlin/checkers/JetPsiCheckerTestGenerated.java index 58c8a0ae17b..46057ccce06 100644 --- a/idea/tests/org/jetbrains/kotlin/checkers/JetPsiCheckerTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/checkers/JetPsiCheckerTestGenerated.java @@ -325,12 +325,6 @@ public class JetPsiCheckerTestGenerated extends AbstractJetPsiCheckerTest { doTest(fileName); } - @TestMetadata("unmetTraitRequirements.kt") - public void testUnmetTraitRequirements() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/checker/unmetTraitRequirements.kt"); - doTest(fileName); - } - @TestMetadata("UnreachableCode.kt") public void testUnreachableCode() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/testData/checker/UnreachableCode.kt"); diff --git a/idea/tests/org/jetbrains/kotlin/idea/stubs/ResolveByStubTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/stubs/ResolveByStubTestGenerated.java index cceda1b65f6..6d52f481654 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/stubs/ResolveByStubTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/stubs/ResolveByStubTestGenerated.java @@ -2140,12 +2140,6 @@ public class ResolveByStubTestGenerated extends AbstractResolveByStubTest { doTest(fileName); } - @TestMetadata("NoDelegationForFunctionInheritedFromTraitSuperClass.kt") - public void testNoDelegationForFunctionInheritedFromTraitSuperClass() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/fun/NoDelegationForFunctionInheritedFromTraitSuperClass.kt"); - doTest(fileName); - } - @TestMetadata("NoSamAdapter.kt") public void testNoSamAdapter() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/fun/NoSamAdapter.kt"); diff --git a/js/js.libraries/src/core/htmlDom.kt b/js/js.libraries/src/core/htmlDom.kt index 8a91ec63e4a..67235f6d904 100644 --- a/js/js.libraries/src/core/htmlDom.kt +++ b/js/js.libraries/src/core/htmlDom.kt @@ -187,7 +187,7 @@ public native trait HTMLOptionsCollection { } deprecated("Use declarations from org.w3c.dom instead") -public native trait HTMLDocument : Document { +public native class HTMLDocument : Document() { public native fun open(): Unit public native fun write(text: String): Unit public native fun writeln(text: String): Unit diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BridgeTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BridgeTestGenerated.java index 7e64395faa7..9a917d98902 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BridgeTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/BridgeTestGenerated.java @@ -101,12 +101,6 @@ public class BridgeTestGenerated extends AbstractBridgeTest { doTest(fileName); } - @TestMetadata("fakeOverrideInTraitWithRequiredFromTraitImpl.kt") - public void testFakeOverrideInTraitWithRequiredFromTraitImpl() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeOverrideInTraitWithRequiredFromTraitImpl.kt"); - doTest(fileName); - } - @TestMetadata("fakeOverrideOfPropertySetterInTraitImpl.kt") public void testFakeOverrideOfPropertySetterInTraitImpl() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeOverrideOfPropertySetterInTraitImpl.kt"); @@ -287,12 +281,6 @@ public class BridgeTestGenerated extends AbstractBridgeTest { doTest(fileName); } - @TestMetadata("traitWithRequiredCovariantOverride.kt") - public void testTraitWithRequiredCovariantOverride() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/traitWithRequiredCovariantOverride.kt"); - doTest(fileName); - } - @TestMetadata("twoParentsWithDifferentMethodsTwoBridges.kt") public void testTwoParentsWithDifferentMethodsTwoBridges() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/twoParentsWithDifferentMethodsTwoBridges.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/ClassInheritanceTest.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/ClassInheritanceTest.java index cd829431b1c..9ad8ac0e555 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/ClassInheritanceTest.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/ClassInheritanceTest.java @@ -44,10 +44,6 @@ public final class ClassInheritanceTest extends SingleFileTranslationTest { checkFooBoxIsOk(); } - public void testCrazyInheritance() throws Exception { - checkFooBoxIsOk(); - } - public void testValOverride() throws Exception { fooBoxTest(); } diff --git a/js/js.translator/testData/examples/cases/diamondInheritance.kt b/js/js.translator/testData/examples/cases/diamondInheritance.kt deleted file mode 100644 index b0ce0447a44..00000000000 --- a/js/js.translator/testData/examples/cases/diamondInheritance.kt +++ /dev/null @@ -1,26 +0,0 @@ -// Changed when traits were introduced. May not make sense any more - -open class Base() { - public var v: Int = 0 -} - -open class Left() : Base() { -} -trait Right : Base { -} - -class D() : Left(), Right - -fun vl(l: Left): Int = l.v -fun vr(r: Right): Int = r.v - -fun box(): String { - val d = D() - d.v = 42 - - if (d.v != 42) return "Fail #1" - if (vl(d) != 42) return "Fail #2" - if (vr(d) != 42) return "Fail #3" - - return "OK" -} \ No newline at end of file diff --git a/js/js.translator/testData/inheritance/cases/crazyInheritance.kt b/js/js.translator/testData/inheritance/cases/crazyInheritance.kt deleted file mode 100644 index b80fc0f0302..00000000000 --- a/js/js.translator/testData/inheritance/cases/crazyInheritance.kt +++ /dev/null @@ -1,56 +0,0 @@ -package foo - -open class A { - open fun f1() = "A1" - open fun f2() = "A2" - open fun f3() = "A3" - open fun f4() = "A4" - - fun getSum(): String { - return "${f1()}|${f2()}|${f3()}|${f4()}" - } -} - -trait T : A { - override fun f1() = "T1" - override fun f2() = "T2" -} - -trait B : A { - override fun f1() = "B1" - override fun f3() = "B3" -} - -trait N : B, T { - override fun f1() = "N1" -} - -trait X { - fun f4() = "X4" -} - -class C : A(), N, X { - override fun f4() = "C4" -} - -fun box(): String { - val a = A() - val t = object : T, A() { - } - val b = object : B, A() { - } - val n = object : N, A() { - } - val x = object : X { - } - val c = C() - - if (a.getSum() != "A1|A2|A3|A4") return "Bad a.getSum(), it: ${a.getSum()}" - if (t.getSum() != "T1|T2|A3|A4") return "Bad t.getSum(), it: ${t.getSum()}" - if (b.getSum() != "B1|A2|B3|A4") return "Bad b.getSum(), it: ${b.getSum()}" - if (n.getSum() != "N1|T2|B3|A4") return "Bad n.getSum(), it: ${n.getSum()}" - if (c.getSum() != "N1|T2|B3|C4") return "Bad c.getSum(), it: ${c.getSum()}" - - if (x.f4() != "X4") return "Bad x.f4(), it: ${x.f4()}" - return "OK" -} \ No newline at end of file