From 8e9f1ac31a46e33c9a3777b1a64b773f31c84bf9 Mon Sep 17 00:00:00 2001 From: Michael Nedzelsky Date: Thu, 15 Oct 2015 20:46:15 +0300 Subject: [PATCH] Extension function type is not allowed as supertype --- .../jetbrains/kotlin/diagnostics/Errors.java | 1 + .../rendering/DefaultErrorMessages.java | 1 + .../kotlin/resolve/BodyResolver.java | 5 + .../subtyping/extFunctionTypeAsSuperType.kt | 24 +++ .../subtyping/extFunctionTypeAsSuperType.txt | 101 ++++++++++ .../subtyping/functionTypeAsSuperType.kt | 45 +++++ .../subtyping/functionTypeAsSuperType.txt | 181 ++++++++++++++++++ .../checkers/JetDiagnosticsTestGenerated.java | 12 ++ .../InheritingClasses/InheritingClasses.kt | 1 - .../InheritingClasses/InheritingClasses.txt | 36 ---- 10 files changed, 370 insertions(+), 37 deletions(-) create mode 100644 compiler/testData/diagnostics/tests/subtyping/extFunctionTypeAsSuperType.kt create mode 100644 compiler/testData/diagnostics/tests/subtyping/extFunctionTypeAsSuperType.txt create mode 100644 compiler/testData/diagnostics/tests/subtyping/functionTypeAsSuperType.kt create mode 100644 compiler/testData/diagnostics/tests/subtyping/functionTypeAsSuperType.txt diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index fb4978f0d05..948cf1e7852 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -172,6 +172,7 @@ public interface Errors { DiagnosticFactory0 DELEGATION_NOT_TO_INTERFACE = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 SUPERTYPE_NOT_A_CLASS_OR_INTERFACE = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 NO_GENERICS_IN_SUPERTYPE_SPECIFIER = DiagnosticFactory0.create(ERROR); 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 b6964336556..3c4e8f3606d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -434,6 +434,7 @@ public class DefaultErrorMessages { MAP.put(MANY_CLASSES_IN_SUPERTYPE_LIST, "Only one class may appear in a supertype list"); MAP.put(SUPERTYPE_NOT_A_CLASS_OR_INTERFACE, "Only classes and interfaces may serve as supertypes"); + MAP.put(SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE, "Extension function type is not allowed as supertypes"); MAP.put(SUPERTYPE_INITIALIZED_IN_INTERFACE, "Interfaces cannot initialize supertypes"); MAP.put(CLASS_IN_SUPERTYPE_FOR_ENUM, "Enum class cannot inherit from classes"); MAP.put(CONSTRUCTOR_IN_INTERFACE, "An interface may not have a constructor"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java index 84fbb96c562..f66072c8567 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java @@ -24,6 +24,7 @@ import kotlin.Unit; import kotlin.jvm.functions.Function1; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.kotlin.builtins.KotlinBuiltIns; import org.jetbrains.kotlin.descriptors.*; import org.jetbrains.kotlin.descriptors.impl.SyntheticFieldDescriptor; import org.jetbrains.kotlin.diagnostics.Errors; @@ -444,6 +445,10 @@ public class BodyResolver { if (classDescriptor != null) { if (ErrorUtils.isError(classDescriptor)) continue; + if (KotlinBuiltIns.isExactExtensionFunctionType(supertype)) { + trace.report(SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE.on(typeReference)); + } + if (classDescriptor.getKind() != ClassKind.INTERFACE) { if (supertypeOwner.getKind() == ClassKind.ENUM_CLASS) { trace.report(CLASS_IN_SUPERTYPE_FOR_ENUM.on(typeReference)); diff --git a/compiler/testData/diagnostics/tests/subtyping/extFunctionTypeAsSuperType.kt b/compiler/testData/diagnostics/tests/subtyping/extFunctionTypeAsSuperType.kt new file mode 100644 index 00000000000..c807797923d --- /dev/null +++ b/compiler/testData/diagnostics/tests/subtyping/extFunctionTypeAsSuperType.kt @@ -0,0 +1,24 @@ +class A : Double.() -> Unit { + override fun invoke(p1: Double) {} +} + +class B : Int.(Double) -> Unit { + override fun invoke(p1: Int, p2: Double) {} +} + +open class C {} + +abstract class A0 : C.() -> Int +abstract class A1 : C.(Int) -> Int +abstract class A2 : C.(Int, String) -> Int + +open class D {} + +abstract class B0 : D.() -> Int +abstract class B1 : D.(C) -> Int +abstract class B2 : D.(T, C) -> T + +interface E {} + +abstract class C0: C(), Int.() -> Double +abstract class C1: C(), E, Int.(C) -> Double \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/subtyping/extFunctionTypeAsSuperType.txt b/compiler/testData/diagnostics/tests/subtyping/extFunctionTypeAsSuperType.txt new file mode 100644 index 00000000000..dca34df0fe4 --- /dev/null +++ b/compiler/testData/diagnostics/tests/subtyping/extFunctionTypeAsSuperType.txt @@ -0,0 +1,101 @@ +package + +public final class A : kotlin.Double.() -> kotlin.Unit { + 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*/ fun invoke(/*0*/ p1: kotlin.Double): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class A0 : C.() -> kotlin.Int { + public constructor A0() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: C): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class A1 : C.(kotlin.Int) -> kotlin.Int { + public constructor A1() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: C, /*1*/ p2: kotlin.Int): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class A2 : C.(kotlin.Int, kotlin.String) -> kotlin.Int { + public constructor A2() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: C, /*1*/ p2: kotlin.Int, /*2*/ p3: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class B : kotlin.Int.(kotlin.Double) -> kotlin.Unit { + 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*/ fun invoke(/*0*/ p1: kotlin.Int, /*1*/ p2: kotlin.Double): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class B0 : D.() -> kotlin.Int { + public constructor B0() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: D): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class B1 : D.(C) -> kotlin.Int { + public constructor B1() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: D, /*1*/ p2: C): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class B2 : D.(T, C) -> T { + public constructor B2() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: D, /*1*/ p2: T, /*2*/ p3: C): T + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class C { + public constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class C0 : C, kotlin.Int.() -> kotlin.Double { + public constructor C0() + 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 abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: kotlin.Int): kotlin.Double + public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class C1 : C, E, kotlin.Int.(C) -> kotlin.Double { + public constructor C1() + 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 abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: kotlin.Int, /*1*/ p2: C): kotlin.Double + public open override /*3*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class D { + public constructor D() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface E { + 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/subtyping/functionTypeAsSuperType.kt b/compiler/testData/diagnostics/tests/subtyping/functionTypeAsSuperType.kt new file mode 100644 index 00000000000..c52250c1c84 --- /dev/null +++ b/compiler/testData/diagnostics/tests/subtyping/functionTypeAsSuperType.kt @@ -0,0 +1,45 @@ +class A : () -> Unit { + override fun invoke() {} +} + +class AA : Function0 { + override fun invoke() {} +} + +class B : (Double) -> Unit { + override fun invoke(p1: Double) {} +} + +class BB : Function1 { + override fun invoke(p1: Double) {} +} + +open class C {} + +abstract class A0 : (C) -> Int +abstract class A1 : Function1 + +abstract class A2 : (C, Int) -> Int +abstract class A3 : Function2 + +abstract class A4 : (Int, C, String) -> Int +abstract class A5 : Function3 + +open class D {} + +abstract class B0 : (D) -> Int +abstract class B1 : Function1, Int> + +abstract class B2 : (D, C) -> Int +abstract class B3 : Function2, C, Int> + +abstract class B4 : (D, C) -> T +abstract class B5 : Function2, C, T> + +interface E {} + +abstract class C0: C(), (Int) -> Double +abstract class C1: C(), Function1 + +abstract class C2: C(), E, (Int, C) -> Double +abstract class C3: C(), E, Function2 \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/subtyping/functionTypeAsSuperType.txt b/compiler/testData/diagnostics/tests/subtyping/functionTypeAsSuperType.txt new file mode 100644 index 00000000000..5eb5d1a89d6 --- /dev/null +++ b/compiler/testData/diagnostics/tests/subtyping/functionTypeAsSuperType.txt @@ -0,0 +1,181 @@ +package + +public final class A : () -> kotlin.Unit { + 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*/ fun invoke(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class A0 : (C) -> kotlin.Int { + public constructor A0() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: C): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class A1 : (C) -> kotlin.Int { + public constructor A1() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: C): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class A2 : (C, kotlin.Int) -> kotlin.Int { + public constructor A2() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: C, /*1*/ p2: kotlin.Int): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class A3 : (C, kotlin.Int) -> kotlin.Int { + public constructor A3() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: C, /*1*/ p2: kotlin.Int): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class A4 : (kotlin.Int, C, kotlin.String) -> kotlin.Int { + public constructor A4() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: kotlin.Int, /*1*/ p2: C, /*2*/ p3: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class A5 : (kotlin.Int, C, kotlin.String) -> kotlin.Int { + public constructor A5() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: kotlin.Int, /*1*/ p2: C, /*2*/ p3: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class AA : () -> kotlin.Unit { + public constructor AA() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ fun invoke(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class B : (kotlin.Double) -> kotlin.Unit { + 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*/ fun invoke(/*0*/ p1: kotlin.Double): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class B0 : (D) -> kotlin.Int { + public constructor B0() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: D): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class B1 : (D) -> kotlin.Int { + public constructor B1() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: D): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class B2 : (D, C) -> kotlin.Int { + public constructor B2() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: D, /*1*/ p2: C): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class B3 : (D, C) -> kotlin.Int { + public constructor B3() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: D, /*1*/ p2: C): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class B4 : (D, C) -> T { + public constructor B4() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: D, /*1*/ p2: C): T + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class B5 : (D, C) -> T { + public constructor B5() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: D, /*1*/ p2: C): T + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class BB : (kotlin.Double) -> kotlin.Unit { + public constructor BB() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ fun invoke(/*0*/ p1: kotlin.Double): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class C { + public constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class C0 : C, (kotlin.Int) -> kotlin.Double { + public constructor C0() + 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 abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: kotlin.Int): kotlin.Double + public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class C1 : C, (kotlin.Int) -> kotlin.Double { + public constructor C1() + 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 abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: kotlin.Int): kotlin.Double + public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class C2 : C, E, (kotlin.Int, C) -> kotlin.Double { + public constructor C2() + 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 abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: kotlin.Int, /*1*/ p2: C): kotlin.Double + public open override /*3*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class C3 : C, E, (kotlin.Int, C) -> kotlin.Double { + public constructor C3() + 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 abstract override /*1*/ /*fake_override*/ fun invoke(/*0*/ p1: kotlin.Int, /*1*/ p2: C): kotlin.Double + public open override /*3*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class D { + public constructor D() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface E { + 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/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java index 5ddc064964d..91743239fbb 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java @@ -15144,12 +15144,24 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/subtyping"), Pattern.compile("^(.+)\\.kt$"), true); } + @TestMetadata("extFunctionTypeAsSuperType.kt") + public void testExtFunctionTypeAsSuperType() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/subtyping/extFunctionTypeAsSuperType.kt"); + doTest(fileName); + } + @TestMetadata("findClosestCorrespondingSupertype.kt") public void testFindClosestCorrespondingSupertype() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/subtyping/findClosestCorrespondingSupertype.kt"); doTest(fileName); } + @TestMetadata("functionTypeAsSuperType.kt") + public void testFunctionTypeAsSuperType() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/subtyping/functionTypeAsSuperType.kt"); + doTest(fileName); + } + @TestMetadata("kt2069.kt") public void testKt2069() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/subtyping/kt2069.kt"); diff --git a/idea/testData/decompiler/stubBuilder/InheritingClasses/InheritingClasses.kt b/idea/testData/decompiler/stubBuilder/InheritingClasses/InheritingClasses.kt index ff708140bb3..861b907c8cb 100644 --- a/idea/testData/decompiler/stubBuilder/InheritingClasses/InheritingClasses.kt +++ b/idea/testData/decompiler/stubBuilder/InheritingClasses/InheritingClasses.kt @@ -43,5 +43,4 @@ class InheritingClasses { } abstract class InheritFunctionType : ((Int, String) -> Int) - abstract class InheritExtensionFunctionType : (E.(Int, String) -> Int) } \ No newline at end of file diff --git a/idea/testData/decompiler/stubBuilder/InheritingClasses/InheritingClasses.txt b/idea/testData/decompiler/stubBuilder/InheritingClasses/InheritingClasses.txt index 695a2d5df24..6e3351334bc 100644 --- a/idea/testData/decompiler/stubBuilder/InheritingClasses/InheritingClasses.txt +++ b/idea/testData/decompiler/stubBuilder/InheritingClasses/InheritingClasses.txt @@ -315,42 +315,6 @@ PsiJetFileStubImpl[package=a] REFERENCE_EXPRESSION:[referencedName=InheritAny] REFERENCE_EXPRESSION:[referencedName=SomeTrait] CLASS_BODY: - CLASS:[fqName=a.InheritingClasses.InheritExtensionFunctionType, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=false, name=InheritExtensionFunctionType, superNames=[]] - MODIFIER_LIST:[abstract public] - PRIMARY_CONSTRUCTOR: - MODIFIER_LIST:[public] - VALUE_PARAMETER_LIST: - DELEGATION_SPECIFIER_LIST: - DELEGATOR_SUPER_CLASS: - TYPE_REFERENCE: - FUNCTION_TYPE: - FUNCTION_TYPE_RECEIVER: - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=a] - REFERENCE_EXPRESSION:[referencedName=InheritingClasses] - REFERENCE_EXPRESSION:[referencedName=E] - VALUE_PARAMETER_LIST: - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=null] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=null] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=String] - TYPE_REFERENCE: - USER_TYPE:[isAbsoluteInRootPackage=false] - USER_TYPE:[isAbsoluteInRootPackage=false] - REFERENCE_EXPRESSION:[referencedName=kotlin] - REFERENCE_EXPRESSION:[referencedName=Int] - CLASS_BODY: CLASS:[fqName=a.InheritingClasses.InheritFunctionType, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=false, name=InheritFunctionType, superNames=[]] MODIFIER_LIST:[abstract public] PRIMARY_CONSTRUCTOR: