Support extensions in functional supertypes
Under a flag for now.
This commit is contained in:
committed by
teamcityserver
parent
10101dc2b4
commit
3f8fa3149b
+6
@@ -29277,6 +29277,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/subtyping/extFunctionTypeAsSuperType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("extFunctionTypeAsSuperTypeRestrictionLifted.kt")
|
||||
public void testExtFunctionTypeAsSuperTypeRestrictionLifted() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/subtyping/extFunctionTypeAsSuperTypeRestrictionLifted.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("findClosestCorrespondingSupertype.kt")
|
||||
public void testFindClosestCorrespondingSupertype() throws Exception {
|
||||
|
||||
+6
@@ -29277,6 +29277,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/subtyping/extFunctionTypeAsSuperType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("extFunctionTypeAsSuperTypeRestrictionLifted.kt")
|
||||
public void testExtFunctionTypeAsSuperTypeRestrictionLifted() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/subtyping/extFunctionTypeAsSuperTypeRestrictionLifted.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("findClosestCorrespondingSupertype.kt")
|
||||
public void testFindClosestCorrespondingSupertype() throws Exception {
|
||||
|
||||
+5
-1
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.fir.analysis.checkers.declaration
|
||||
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
@@ -17,6 +18,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.withSuppressedDiagnostics
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.modality
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.visibility
|
||||
import org.jetbrains.kotlin.fir.languageVersionSettings
|
||||
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
|
||||
import org.jetbrains.kotlin.fir.resolve.toSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
||||
@@ -42,7 +44,9 @@ object FirSupertypesChecker : FirClassChecker() {
|
||||
reporter.reportOn(superTypeRef.source, FirErrors.NULLABLE_SUPERTYPE, context)
|
||||
nullableSupertypeReported = true
|
||||
}
|
||||
if (!extensionFunctionSupertypeReported && coneType.isExtensionFunctionType) {
|
||||
if (!extensionFunctionSupertypeReported && coneType.isExtensionFunctionType &&
|
||||
!context.session.languageVersionSettings.supportsFeature(LanguageFeature.FunctionalTypeWithExtensionAsSupertype)
|
||||
) {
|
||||
reporter.reportOn(superTypeRef.source, FirErrors.SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE, context)
|
||||
extensionFunctionSupertypeReported = true
|
||||
}
|
||||
|
||||
+6
@@ -15754,6 +15754,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/extensionFunctions/executionOrder.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("extensionFunctionAsSupertype.kt")
|
||||
public void testExtensionFunctionAsSupertype() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionFunctions/extensionFunctionAsSupertype.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt1061.kt")
|
||||
public void testKt1061() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user