Drop traits with required classes
#KT-4771 Rejected
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
+14
-13
@@ -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<PseudoValue>,
|
||||
val expectedTypes: Map<PseudoValue, TypePredicate>,
|
||||
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 <R> accept(visitor: InstructionVisitorWithResult<R>): R = visitor.visitMagic(this)
|
||||
@@ -156,7 +154,10 @@ class MergeInstruction private constructor(
|
||||
element: JetElement,
|
||||
lexicalScope: LexicalScope,
|
||||
inputValues: List<PseudoValue>
|
||||
): 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 <R> accept(visitor: InstructionVisitorWithResult<R>): R = visitor.visitMerge(this)
|
||||
|
||||
@@ -192,10 +192,7 @@ public interface Errors {
|
||||
|
||||
DiagnosticFactory0<JetDelegatorByExpressionSpecifier> DELEGATION_IN_TRAIT = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
DiagnosticFactory0<PsiElement> TRAIT_WITH_SUPERCLASS = DiagnosticFactory0.create(WARNING);
|
||||
|
||||
DiagnosticFactory2<JetNamedDeclaration, ClassDescriptor, ClassDescriptor> UNMET_TRAIT_REQUIREMENT =
|
||||
DiagnosticFactory2.create(ERROR, PositioningStrategies.DECLARATION_NAME);
|
||||
DiagnosticFactory0<PsiElement> TRAIT_WITH_SUPERCLASS = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
// Enum-specific
|
||||
|
||||
|
||||
+1
-2
@@ -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");
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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<JetClassOrObject, ClassDescriptorWithResolutionScopes>, 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<ClassDescriptor> {
|
||||
@suppress("UNCHECKED_CAST")
|
||||
return TypeUtils.getAllSupertypes(descriptor.getDefaultType())
|
||||
.map { supertype -> supertype.getConstructor().getDeclarationDescriptor() }
|
||||
.filter { superClass -> DescriptorUtils.isTrait(superClass) } as List<ClassDescriptor>
|
||||
}
|
||||
|
||||
private fun getSuperClassesReachableByClassInheritance(
|
||||
descriptor: ClassDescriptor,
|
||||
result: MutableSet<ClassDescriptor> = hashSetOf()
|
||||
): Set<ClassDescriptor> {
|
||||
val superClass = descriptor.getSuperClassOrAny()
|
||||
result.add(superClass)
|
||||
if (!KotlinBuiltIns.isAny(superClass)) {
|
||||
getSuperClassesReachableByClassInheritance(superClass, result)
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
-17
@@ -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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
open class A<T> {
|
||||
open fun foo(a: T): Int = 2
|
||||
}
|
||||
|
||||
interface B<T> : A<T> {
|
||||
override fun foo(a: T): Int = 1
|
||||
}
|
||||
|
||||
class D : B<Int>, A<Int>() {
|
||||
fun boo(): Int {
|
||||
return super<B>.foo(1)
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (D().boo() != 1) return "Fail"
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+3
-3
@@ -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<String> {
|
||||
@@ -34,4 +34,4 @@ fun listOf(vararg strings: String): List<String> {
|
||||
list.add(s)
|
||||
}
|
||||
return list
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
-21
@@ -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<Base>.sayHello() + super<Trait>.sayHello()
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Derived().sayHello()
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
open class AL<T> {
|
||||
fun get(index: Int) : T? = null
|
||||
}
|
||||
|
||||
interface ALE<T> : AL<T> {
|
||||
fun getOrValue(index: Int, value : T) : T = get(index) ?: value
|
||||
}
|
||||
|
||||
class SmartArrayList() : ALE<String>, AL<String>() {
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
val c = SmartArrayList()
|
||||
return if("239" == c.getOrValue(0, "239")) "OK" else "fail"
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
abstract class Base<T> {
|
||||
abstract var s: T
|
||||
}
|
||||
|
||||
interface Trait<T> : Base<T> {
|
||||
var value : T
|
||||
get() = s
|
||||
set(value) { s = value }
|
||||
}
|
||||
|
||||
class Derived : Trait<String>, Base<String>() {
|
||||
override var s = "Fail"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val d = Derived()
|
||||
d.value = "OK"
|
||||
return d.value
|
||||
}
|
||||
@@ -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<MyTrait>.foo()
|
||||
}
|
||||
|
||||
fun box()= B("OK").foo()
|
||||
@@ -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()
|
||||
@@ -1,9 +0,0 @@
|
||||
interface Trait<T : Enum<T>> : Enum<T> {
|
||||
val value : String get() = name()
|
||||
}
|
||||
|
||||
enum class E : Trait<E> {
|
||||
OK
|
||||
}
|
||||
|
||||
fun box() = E.OK.value
|
||||
@@ -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()
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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()}"
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
open class Base {
|
||||
open fun foo() { }
|
||||
open fun foo2() { }
|
||||
}
|
||||
|
||||
interface Derived : Base {
|
||||
override fun foo() {
|
||||
object {
|
||||
fun bar() {
|
||||
//super<Base>@Derived.foo2()
|
||||
this@Derived.foo2()
|
||||
}
|
||||
}.bar()
|
||||
}
|
||||
}
|
||||
|
||||
class DerivedImpl : Derived, Base()
|
||||
|
||||
fun box(): String {
|
||||
DerivedImpl().foo()
|
||||
return "OK"
|
||||
}
|
||||
@@ -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()
|
||||
}
|
||||
+1
-1
@@ -5,7 +5,7 @@ interface T3
|
||||
open class OC1: T1
|
||||
open class OC2: OC1(), T2
|
||||
class FC1: OC2(), T3
|
||||
interface T4: OC1
|
||||
interface T4: <!TRAIT_WITH_SUPERCLASS!>OC1<!>
|
||||
interface T5: T2
|
||||
|
||||
fun test<TP1: OC1, TP2: T2, TP3: OC2>(
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
open class Required
|
||||
|
||||
interface Trait : <!TRAIT_WITH_SUPERCLASS!>Required<!>
|
||||
|
||||
abstract <!UNMET_TRAIT_REQUIREMENT!>class Abstract<!> : Trait
|
||||
|
||||
abstract <!UNMET_TRAIT_REQUIREMENT!>class AbstractDerived<!> : Abstract()
|
||||
@@ -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
|
||||
}
|
||||
Vendored
-6
@@ -1,6 +0,0 @@
|
||||
open class Required
|
||||
|
||||
interface A : <!TRAIT_WITH_SUPERCLASS!>Required<!>
|
||||
|
||||
val a = <!UNMET_TRAIT_REQUIREMENT!>object<!> : A {}
|
||||
val b: A = object : A, Required() {}
|
||||
Vendored
-17
@@ -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
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
open class Generic<T>
|
||||
|
||||
interface A : <!TRAIT_WITH_SUPERCLASS!>Generic<Int><!>
|
||||
|
||||
interface B : <!TRAIT_WITH_SUPERCLASS!>Generic<String><!>
|
||||
|
||||
<!UNMET_TRAIT_REQUIREMENT, UNMET_TRAIT_REQUIREMENT!>class Y<!> : <!INCONSISTENT_TYPE_PARAMETER_VALUES!>A, B<!>
|
||||
class Z : <!INCONSISTENT_TYPE_PARAMETER_VALUES!>A, B, Generic<Int>()<!>
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
package
|
||||
|
||||
internal interface A : Generic<kotlin.Int> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
internal interface B : Generic<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 Generic</*0*/ T> {
|
||||
public constructor Generic</*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 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<kotlin.Int> {
|
||||
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
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
open class Base {
|
||||
}
|
||||
|
||||
interface Derived: <!TRAIT_WITH_SUPERCLASS!>Base<!> {
|
||||
fun foo() {
|
||||
f1(this@Derived)
|
||||
}
|
||||
}
|
||||
|
||||
<!UNMET_TRAIT_REQUIREMENT!>class DerivedImpl<!>(): Derived {}
|
||||
<!UNMET_TRAIT_REQUIREMENT!>object ObjectImpl<!>: Derived {}
|
||||
|
||||
fun f1(b: Base) = b
|
||||
@@ -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
|
||||
}
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
open class A
|
||||
open class B
|
||||
|
||||
interface C : <!TRAIT_WITH_SUPERCLASS!>A<!>, <!MANY_CLASSES_IN_SUPERTYPE_LIST!>B<!>
|
||||
-21
@@ -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
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
open class Required
|
||||
|
||||
interface A : <!TRAIT_WITH_SUPERCLASS!>Required<!>
|
||||
|
||||
interface B : A, <!TRAIT_WITH_SUPERCLASS!>Required<!>
|
||||
|
||||
interface C : <!TRAIT_WITH_SUPERCLASS!>Required<!>
|
||||
|
||||
interface D : B, <!TRAIT_WITH_SUPERCLASS!>Required<!>
|
||||
|
||||
<!UNMET_TRAIT_REQUIREMENT, UNMET_TRAIT_REQUIREMENT, UNMET_TRAIT_REQUIREMENT!>class W<!> : D
|
||||
class X : D, Required()
|
||||
<!UNMET_TRAIT_REQUIREMENT, UNMET_TRAIT_REQUIREMENT, UNMET_TRAIT_REQUIREMENT, UNMET_TRAIT_REQUIREMENT!>class Y<!> : C, D
|
||||
class Z : D, C, Required()
|
||||
-60
@@ -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
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
open class RequiredBase
|
||||
|
||||
interface Trait : <!TRAIT_WITH_SUPERCLASS!>RequiredBase<!>
|
||||
|
||||
open class RequiredDerived : RequiredBase()
|
||||
|
||||
<!UNMET_TRAIT_REQUIREMENT!>class A<!> : Trait
|
||||
class B : Trait, RequiredDerived()
|
||||
-35
@@ -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
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
open class Required(val value: String)
|
||||
|
||||
interface First : <!TRAIT_WITH_SUPERCLASS!>Required<!>
|
||||
|
||||
interface Second : First
|
||||
|
||||
<!UNMET_TRAIT_REQUIREMENT!>class Y<!> : Second
|
||||
class Z : Second, Required(":o)")
|
||||
-39
@@ -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
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
open class bar()
|
||||
|
||||
interface Foo<!CONSTRUCTOR_IN_TRAIT!>()<!> : <!TRAIT_WITH_SUPERCLASS!>bar<!><!SUPERTYPE_INITIALIZED_IN_TRAIT!>()<!>, <!MANY_CLASSES_IN_SUPERTYPE_LIST, SUPERTYPE_APPEARS_TWICE!>bar<!>, <!MANY_CLASSES_IN_SUPERTYPE_LIST, SUPERTYPE_APPEARS_TWICE!>bar<!> {
|
||||
interface Foo<!CONSTRUCTOR_IN_TRAIT!>()<!> : <!TRAIT_WITH_SUPERCLASS!>bar<!><!SUPERTYPE_INITIALIZED_IN_TRAIT!>()<!>, <!MANY_CLASSES_IN_SUPERTYPE_LIST!>bar<!>, <!MANY_CLASSES_IN_SUPERTYPE_LIST, SUPERTYPE_APPEARS_TWICE!>bar<!> {
|
||||
}
|
||||
|
||||
interface Foo2 : <!TRAIT_WITH_SUPERCLASS!>bar<!>, Foo {
|
||||
|
||||
compiler/testData/diagnostics/tests/traitWithRequired/uninheritableTraitDifferentGenericArguments.kt
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
open class Generic<T>
|
||||
|
||||
interface A : <!TRAIT_WITH_SUPERCLASS!>Generic<String><!>
|
||||
|
||||
interface B : <!TRAIT_WITH_SUPERCLASS!>Generic<Int><!>
|
||||
|
||||
interface C : <!INCONSISTENT_TYPE_PARAMETER_VALUES!>A, B<!>
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
package
|
||||
|
||||
internal interface A : Generic<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 B : Generic<kotlin.Int> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
internal 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</*0*/ T> {
|
||||
public constructor Generic</*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 override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
compiler/testData/loadJava/compiledKotlin/fun/NoDelegationForFunctionInheritedFromTraitSuperClass.kt
Vendored
-23
@@ -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 {
|
||||
}
|
||||
-30
@@ -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 <get-c>(): 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
|
||||
}
|
||||
@@ -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")
|
||||
|
||||
@@ -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<Fun, Fun>) {
|
||||
for ((from, to) in edges) {
|
||||
|
||||
-111
@@ -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")
|
||||
|
||||
@@ -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");
|
||||
|
||||
-6
@@ -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");
|
||||
|
||||
+3
-3
@@ -24,11 +24,11 @@ interface T2<T> {}
|
||||
interface Test<error>()</error> {
|
||||
}
|
||||
|
||||
interface Test1 : <warning>C2</warning><error>()</error> {}
|
||||
interface Test1 : <error>C2</error><error>()</error> {}
|
||||
|
||||
interface Test2 : <warning>C2</warning> {}
|
||||
interface Test2 : <error>C2</error> {}
|
||||
|
||||
interface Test3 : <warning>C2</warning>, <error>C3</error> {}
|
||||
interface Test3 : <error>C2</error>, <error>C3</error> {}
|
||||
|
||||
interface Test4 : T1 {}
|
||||
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
open class bar()
|
||||
|
||||
interface Foo<error>()</error> : <warning>bar</warning><error>()</error>, <error><error>bar</error></error>, <error><error>bar</error></error> {
|
||||
interface Foo<error>()</error> : <error>bar</error><error>()</error>, <error><error>bar</error></error>, <error><error>bar</error></error> {
|
||||
}
|
||||
|
||||
interface Foo2 : <warning>bar</warning>, Foo {
|
||||
interface Foo2 : <error>bar</error>, Foo {
|
||||
}
|
||||
|
||||
open class Foo1() : bar(), <error>bar</error>, Foo, <error>Foo</error>() {}
|
||||
open class Foo12 : bar(), <error>bar</error> {}
|
||||
open class Foo12 : bar(), <error>bar</error> {}
|
||||
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
open class Base {
|
||||
}
|
||||
|
||||
interface Derived: <warning>Base</warning> {
|
||||
fun foo() {
|
||||
f1(this@Derived)
|
||||
}
|
||||
}
|
||||
|
||||
<error>class DerivedImpl</error>(): Derived {}
|
||||
<error>object ObjectImpl</error>: Derived {}
|
||||
|
||||
fun f1(b: Base) = b
|
||||
|
||||
// KT-3006
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -44,10 +44,6 @@ public final class ClassInheritanceTest extends SingleFileTranslationTest {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testCrazyInheritance() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testValOverride() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user