diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java index f98183daa83..79330dc384f 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java @@ -4721,6 +4721,18 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag runTest("compiler/testData/diagnostics/tests/classObjects/ClassObjects.kt"); } + @Test + @TestMetadata("classWithFunctionSupertype_after.kt") + public void testClassWithFunctionSupertype_after() throws Exception { + runTest("compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_after.kt"); + } + + @Test + @TestMetadata("classWithFunctionSupertype_before.kt") + public void testClassWithFunctionSupertype_before() throws Exception { + runTest("compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_before.kt"); + } + @Test @TestMetadata("companionObjectOfPrivateClassVisibility.kt") public void testCompanionObjectOfPrivateClassVisibility() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java index f557b7d3451..e4c99e61e41 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java @@ -4721,6 +4721,18 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/tests/classObjects/ClassObjects.kt"); } + @Test + @TestMetadata("classWithFunctionSupertype_after.kt") + public void testClassWithFunctionSupertype_after() throws Exception { + runTest("compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_after.kt"); + } + + @Test + @TestMetadata("classWithFunctionSupertype_before.kt") + public void testClassWithFunctionSupertype_before() throws Exception { + runTest("compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_before.kt"); + } + @Test @TestMetadata("companionObjectOfPrivateClassVisibility.kt") public void testCompanionObjectOfPrivateClassVisibility() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java index 863becabf43..00c4b6d37e3 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java @@ -4721,6 +4721,18 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac runTest("compiler/testData/diagnostics/tests/classObjects/ClassObjects.kt"); } + @Test + @TestMetadata("classWithFunctionSupertype_after.kt") + public void testClassWithFunctionSupertype_after() throws Exception { + runTest("compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_after.kt"); + } + + @Test + @TestMetadata("classWithFunctionSupertype_before.kt") + public void testClassWithFunctionSupertype_before() throws Exception { + runTest("compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_before.kt"); + } + @Test @TestMetadata("companionObjectOfPrivateClassVisibility.kt") public void testCompanionObjectOfPrivateClassVisibility() throws Exception { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index c6dd27ec7e6..cf516962bff 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -837,6 +837,7 @@ public interface Errors { DiagnosticFactory0 TAIL_RECURSION_IN_TRY_IS_NOT_SUPPORTED = DiagnosticFactory0.create(WARNING, CALL_EXPRESSION); DiagnosticFactory0 NO_CONSTRUCTOR = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 NO_CONSTRUCTOR_WARNING = DiagnosticFactory0.create(WARNING); DiagnosticFactory0 CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 NOT_A_CLASS = 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 f8b999f6327..bd4584187e6 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -440,6 +440,7 @@ public class DefaultErrorMessages { MAP.put(DELEGATION_NOT_TO_INTERFACE, "Only interfaces can be delegated to"); MAP.put(DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE, "Delegated member ''{0}'' hides supertype override: {1}. Please specify proper override explicitly", COMPACT, commaSeparated(SHORT_NAMES_IN_TYPES)); MAP.put(NO_CONSTRUCTOR, "This class does not have a constructor"); + MAP.put(NO_CONSTRUCTOR_WARNING, "This class does not have a constructor. This warning will be an error in future releases"); MAP.put(RESOLUTION_TO_CLASSIFIER, "{2}", NAME, TO_STRING, STRING); MAP.put(NOT_A_CLASS, "Not a class"); MAP.put(ILLEGAL_ESCAPE_SEQUENCE, "Illegal escape sequence"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolver.java index 27ce6211a71..ed8faed18a8 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolver.java @@ -382,6 +382,7 @@ public class CallResolver { KtReferenceExpression functionReference = expression.getConstructorReferenceExpression(); KtTypeReference typeReference = expression.getTypeReference(); if (functionReference == null || typeReference == null) { + CallResolverUtilKt.checkForConstructorCallOnFunctionalType(typeReference, context); return checkArgumentTypesAndFail(context); // No type there } KotlinType constructedType = typeResolver.resolveType(context.scope, typeReference, context.trace, true); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/util/CallResolverUtil.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/util/CallResolverUtil.kt index bb76950107e..a1cf93fd3a5 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/util/CallResolverUtil.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/util/CallResolverUtil.kt @@ -14,6 +14,7 @@ import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.impl.TypeAliasConstructorDescriptor +import org.jetbrains.kotlin.diagnostics.Errors import org.jetbrains.kotlin.lexer.KtToken import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType @@ -376,3 +377,16 @@ internal fun PSIKotlinCall.replaceArguments( callKind, psiCall, tracingStrategy, newReceiverArgument, dispatchReceiverForInvokeExtension, name, typeArguments, newArguments, externalArgument, startingDataFlowInfo, resultDataFlowInfo, dataFlowInfoForArguments, isForImplicitInvoke ) + +fun checkForConstructorCallOnFunctionalType( + typeReference: KtTypeReference?, + context: BasicCallResolutionContext +) { + if (typeReference?.typeElement is KtFunctionType) { + val factory = when (context.languageVersionSettings.supportsFeature(LanguageFeature.ProhibitConstructorCallOnFunctionalSupertype)) { + true -> Errors.NO_CONSTRUCTOR + false -> Errors.NO_CONSTRUCTOR_WARNING + } + context.trace.report(factory.on(context.call.getValueArgumentListOrElement())) + } +} diff --git a/compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_after.fir.kt b/compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_after.fir.kt new file mode 100644 index 00000000000..3f57255dd85 --- /dev/null +++ b/compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_after.fir.kt @@ -0,0 +1,17 @@ +// WITH_STDLIB +// LANGUAGE: +ProhibitConstructorCallOnFunctionalSupertype +// ISSUE: KT-46344 + +abstract class A : () -> Int() +abstract class B : (() -> Int)() +abstract class C : Function0() +abstract class D : suspend () -> Int() +abstract class E : (suspend () -> Int)() +abstract class F : kotlin.coroutines.SuspendFunction0() + +interface IA : () -> Int() +interface IB : (() -> Int)() +interface IC : Function0() +interface ID : suspend () -> Int() +interface IE : (suspend () -> Int)() +interface IF : kotlin.coroutines.SuspendFunction0() diff --git a/compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_after.kt b/compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_after.kt new file mode 100644 index 00000000000..d45e3c1eef7 --- /dev/null +++ b/compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_after.kt @@ -0,0 +1,17 @@ +// WITH_STDLIB +// LANGUAGE: +ProhibitConstructorCallOnFunctionalSupertype +// ISSUE: KT-46344 + +abstract class A : () -> Int() +abstract class B : (() -> Int)() +abstract class C : Function0() +abstract class D : suspend () -> Int() +abstract class E : (suspend () -> Int)() +abstract class F : kotlin.coroutines.SuspendFunction0() + +interface IA : () -> Int() +interface IB : (() -> Int)() +interface IC : Function0() +interface ID : suspend () -> Int() +interface IE : (suspend () -> Int)() +interface IF : kotlin.coroutines.SuspendFunction0() diff --git a/compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_after.txt b/compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_after.txt new file mode 100644 index 00000000000..a044730482b --- /dev/null +++ b/compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_after.txt @@ -0,0 +1,92 @@ +package + +public abstract class A : () -> kotlin.Int { + 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 abstract override /*1*/ /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class B : () -> kotlin.Int { + 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 abstract override /*1*/ /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class C : () -> kotlin.Int { + 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 abstract override /*1*/ /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class D : suspend () -> kotlin.Int { + 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 abstract override /*1*/ suspend /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class E : suspend () -> kotlin.Int { + public constructor 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 abstract override /*1*/ suspend /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class F : suspend () -> kotlin.Int { + public constructor F() + 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*/ suspend /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface IA : () -> 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 abstract override /*1*/ /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface IB : () -> 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 abstract override /*1*/ /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface IC : () -> 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 abstract override /*1*/ /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface ID : suspend () -> 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 abstract override /*1*/ suspend /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface IE : suspend () -> 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 abstract override /*1*/ suspend /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface IF : suspend () -> 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 abstract override /*1*/ suspend /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_before.fir.kt b/compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_before.fir.kt new file mode 100644 index 00000000000..e58c6ee93fd --- /dev/null +++ b/compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_before.fir.kt @@ -0,0 +1,17 @@ +// WITH_STDLIB +// LANGUAGE: -ProhibitConstructorCallOnFunctionalSupertype +// ISSUE: KT-46344 + +abstract class A : () -> Int() +abstract class B : (() -> Int)() +abstract class C : Function0() +abstract class D : suspend () -> Int() +abstract class E : (suspend () -> Int)() +abstract class F : kotlin.coroutines.SuspendFunction0() + +interface IA : () -> Int() +interface IB : (() -> Int)() +interface IC : Function0() +interface ID : suspend () -> Int() +interface IE : (suspend () -> Int)() +interface IF : kotlin.coroutines.SuspendFunction0() diff --git a/compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_before.kt b/compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_before.kt new file mode 100644 index 00000000000..bccd72005cc --- /dev/null +++ b/compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_before.kt @@ -0,0 +1,17 @@ +// WITH_STDLIB +// LANGUAGE: -ProhibitConstructorCallOnFunctionalSupertype +// ISSUE: KT-46344 + +abstract class A : () -> Int() +abstract class B : (() -> Int)() +abstract class C : Function0() +abstract class D : suspend () -> Int() +abstract class E : (suspend () -> Int)() +abstract class F : kotlin.coroutines.SuspendFunction0() + +interface IA : () -> Int() +interface IB : (() -> Int)() +interface IC : Function0() +interface ID : suspend () -> Int() +interface IE : (suspend () -> Int)() +interface IF : kotlin.coroutines.SuspendFunction0() diff --git a/compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_before.txt b/compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_before.txt new file mode 100644 index 00000000000..a044730482b --- /dev/null +++ b/compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_before.txt @@ -0,0 +1,92 @@ +package + +public abstract class A : () -> kotlin.Int { + 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 abstract override /*1*/ /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class B : () -> kotlin.Int { + 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 abstract override /*1*/ /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class C : () -> kotlin.Int { + 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 abstract override /*1*/ /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class D : suspend () -> kotlin.Int { + 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 abstract override /*1*/ suspend /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class E : suspend () -> kotlin.Int { + public constructor 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 abstract override /*1*/ suspend /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public abstract class F : suspend () -> kotlin.Int { + public constructor F() + 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*/ suspend /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface IA : () -> 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 abstract override /*1*/ /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface IB : () -> 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 abstract override /*1*/ /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface IC : () -> 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 abstract override /*1*/ /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface ID : suspend () -> 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 abstract override /*1*/ suspend /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface IE : suspend () -> 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 abstract override /*1*/ suspend /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface IF : suspend () -> 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 abstract override /*1*/ suspend /*fake_override*/ fun invoke(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + diff --git a/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/typeReferenceError.kt b/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/typeReferenceError.kt index 8d6e152a049..94b67d09af7 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/typeReferenceError.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/typeReferenceError.kt @@ -1,3 +1,3 @@ package typeReferenceError -class Pair<:(val c: fun main() +class Pair<:(val c: fun main() diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index d555813a4df..dc80378ab2c 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -4727,6 +4727,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/classObjects/ClassObjects.kt"); } + @Test + @TestMetadata("classWithFunctionSupertype_after.kt") + public void testClassWithFunctionSupertype_after() throws Exception { + runTest("compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_after.kt"); + } + + @Test + @TestMetadata("classWithFunctionSupertype_before.kt") + public void testClassWithFunctionSupertype_before() throws Exception { + runTest("compiler/testData/diagnostics/tests/classObjects/classWithFunctionSupertype_before.kt"); + } + @Test @TestMetadata("companionObjectOfPrivateClassVisibility.kt") public void testCompanionObjectOfPrivateClassVisibility() throws Exception { diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index 41581fa8c1a..cc486958297 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -258,6 +258,7 @@ enum class LanguageFeature( DisableCheckingChangedProgressionsResolve(KOTLIN_1_9), // KT-49276 ProhibitIllegalValueParameterUsageInDefaultArguments(KOTLIN_1_9, kind = BUG_FIX), // KT-25694 + ProhibitConstructorCallOnFunctionalSupertype(KOTLIN_1_9, kind = BUG_FIX), // KT-46344 // Temporarily disabled, see KT-27084/KT-22379 SoundSmartcastFromLoopConditionForLoopAssignedVariables(sinceVersion = null, kind = BUG_FIX),