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 035cf35c2d4..df5f2fde0d8 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 @@ -10052,70 +10052,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti } } - @Nested - @TestMetadata("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull") - @TestDataPath("$PROJECT_ROOT") - public class ExplicitDefinitelyNotNull { - @Test - public void testAllFilesPresentInExplicitDefinitelyNotNull() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); - } - - @Test - @TestMetadata("approximation.kt") - public void testApproximation() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/approximation.kt"); - } - - @Test - @TestMetadata("disabledFeature.kt") - public void testDisabledFeature() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/disabledFeature.kt"); - } - - @Test - @TestMetadata("inference.kt") - public void testInference() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/inference.kt"); - } - - @Test - @TestMetadata("isAsOperators.kt") - public void testIsAsOperators() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/isAsOperators.kt"); - } - - @Test - @TestMetadata("isAsOperatorsEnabled.kt") - public void testIsAsOperatorsEnabled() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/isAsOperatorsEnabled.kt"); - } - - @Test - @TestMetadata("notApplicable.kt") - public void testNotApplicable() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/notApplicable.kt"); - } - - @Test - @TestMetadata("overrides.kt") - public void testOverrides() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overrides.kt"); - } - - @Test - @TestMetadata("overridesJavaAnnotated.kt") - public void testOverridesJavaAnnotated() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overridesJavaAnnotated.kt"); - } - - @Test - @TestMetadata("simple.kt") - public void testSimple() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/simple.kt"); - } - } - @Nested @TestMetadata("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection") @TestDataPath("$PROJECT_ROOT") 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 c3399b7a37d..2eb682203bf 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 @@ -10052,70 +10052,6 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac } } - @Nested - @TestMetadata("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull") - @TestDataPath("$PROJECT_ROOT") - public class ExplicitDefinitelyNotNull { - @Test - public void testAllFilesPresentInExplicitDefinitelyNotNull() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); - } - - @Test - @TestMetadata("approximation.kt") - public void testApproximation() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/approximation.kt"); - } - - @Test - @TestMetadata("disabledFeature.kt") - public void testDisabledFeature() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/disabledFeature.kt"); - } - - @Test - @TestMetadata("inference.kt") - public void testInference() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/inference.kt"); - } - - @Test - @TestMetadata("isAsOperators.kt") - public void testIsAsOperators() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/isAsOperators.kt"); - } - - @Test - @TestMetadata("isAsOperatorsEnabled.kt") - public void testIsAsOperatorsEnabled() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/isAsOperatorsEnabled.kt"); - } - - @Test - @TestMetadata("notApplicable.kt") - public void testNotApplicable() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/notApplicable.kt"); - } - - @Test - @TestMetadata("overrides.kt") - public void testOverrides() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overrides.kt"); - } - - @Test - @TestMetadata("overridesJavaAnnotated.kt") - public void testOverridesJavaAnnotated() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overridesJavaAnnotated.kt"); - } - - @Test - @TestMetadata("simple.kt") - public void testSimple() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/simple.kt"); - } - } - @Nested @TestMetadata("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt index 83e896a0fb2..0daf45db934 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt @@ -519,7 +519,7 @@ object LightTreePositioningStrategies { return when (node.tokenType) { KtNodeTypes.USER_TYPE -> findChildByType(node, KtNodeTypes.REFERENCE_EXPRESSION) ?: findChildByType(node, KtNodeTypes.ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION) - KtNodeTypes.NULLABLE_TYPE, KtNodeTypes.DEFINITELY_NOT_NULL_TYPE -> findChildByType(node, KtStubElementTypes.TYPE_ELEMENT_TYPES) + KtNodeTypes.NULLABLE_TYPE -> findChildByType(node, KtStubElementTypes.TYPE_ELEMENT_TYPES) ?.let { referencedTypeExpression(it) } else -> null } diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt index 34e02b2cc82..29aac91d6ae 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt @@ -1803,7 +1803,6 @@ class DeclarationsConverter( TYPE_REFERENCE -> firType = convertType(it) MODIFIER_LIST -> allTypeModifiers += convertTypeModifierList(it) USER_TYPE -> firType = convertUserType(typeRefSource, it) - DEFINITELY_NOT_NULL_TYPE -> firType = unwrapDefinitelyNotNullableType(typeRefSource, it, allTypeModifiers) NULLABLE_TYPE -> firType = convertNullableType(typeRefSource, it, allTypeModifiers) FUNCTION_TYPE -> firType = convertFunctionType(typeRefSource, it, isSuspend = allTypeModifiers.hasSuspend()) DYNAMIC_TYPE -> firType = buildDynamicTypeRef { @@ -1881,31 +1880,6 @@ class DeclarationsConverter( return firType } - private fun unwrapDefinitelyNotNullableType( - typeRefSource: FirSourceElement, - definitelyNotNullType: LighterASTNode, - allTypeModifiers: MutableList, - isNullable: Boolean = false - ): FirTypeRef { - lateinit var firType: FirTypeRef - // TODO: Support proper DefinitelyNotNullableType - definitelyNotNullType.forEachChildren { - when (it.tokenType) { - MODIFIER_LIST -> allTypeModifiers += convertTypeModifierList(it) - USER_TYPE -> firType = convertUserType(typeRefSource, it, isNullable) - FUNCTION_TYPE -> firType = convertFunctionType(typeRefSource, it, isNullable, isSuspend = allTypeModifiers.hasSuspend()) - NULLABLE_TYPE -> firType = convertNullableType(typeRefSource, it, allTypeModifiers, isNullable = false) - DEFINITELY_NOT_NULL_TYPE -> firType = unwrapDefinitelyNotNullableType(typeRefSource, it, allTypeModifiers, isNullable) - DYNAMIC_TYPE -> firType = buildDynamicTypeRef { - source = typeRefSource - isMarkedNullable = false - } - } - } - - return firType - } - /** * @see org.jetbrains.kotlin.parsing.KotlinParsing.parseUserType */ diff --git a/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt b/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt index ec9a0c186f3..a9a1b0dc86f 100644 --- a/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt +++ b/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt @@ -1543,11 +1543,6 @@ open class RawFirBuilder( allModifierLists += getAllModifierLists() this.innerType.unwrapNullable() } - // TODO: Support explicit definitely not null type - is KtDefinitelyNotNullType -> { - allModifierLists += getAllModifierLists() - this.innerType.unwrapNullable() - } else -> this } diff --git a/compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/RawFirBuilderTotalKotlinTestCase.kt b/compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/RawFirBuilderTotalKotlinTestCase.kt index c329611d5d5..4708822946b 100644 --- a/compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/RawFirBuilderTotalKotlinTestCase.kt +++ b/compiler/fir/raw-fir/psi2fir/tests/org/jetbrains/kotlin/fir/builder/RawFirBuilderTotalKotlinTestCase.kt @@ -277,7 +277,7 @@ class RawFirBuilderTotalKotlinTestCase : AbstractRawFirBuilderTestCase() { it is KtWhenConditionWithExpression || it is KtFinallySection || it is KtObjectLiteralExpression ||// TODO: KT-24089 (support of dynamic) - it is KtDynamicType || it is KtDefinitelyNotNullType || + it is KtDynamicType || // NB: KtAnnotation is processed via its KtAnnotationEntries it is KtFileAnnotationList || it is KtAnnotationUseSiteTarget || it is KtAnnotation || it is KtInitializerList || it is KtEnumEntrySuperclassReferenceExpression || diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index d533a949ade..73f602c990d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -159,7 +159,6 @@ public interface Errors { DiagnosticFactory2 UPPER_BOUND_VIOLATED = DiagnosticFactory2.create(ERROR); DiagnosticFactory2 UPPER_BOUND_VIOLATED_WARNING = DiagnosticFactory2.create(WARNING); DiagnosticFactory0 REDUNDANT_NULLABLE = DiagnosticFactory0.create(WARNING, NULLABLE_TYPE); - DiagnosticFactory0 DEFINITELY_NOT_NULLABLE_NOT_APPLICABLE = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 NULLABLE_ON_DEFINITELY_NOT_NULLABLE = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 INCORRECT_LEFT_COMPONENT_OF_INTERSECTION = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 INCORRECT_RIGHT_COMPONENT_OF_INTERSECTION = DiagnosticFactory0.create(ERROR); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt index e932f97ab07..4ae337c9d48 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt @@ -844,7 +844,6 @@ object PositioningStrategies { return when (this) { is KtUserType -> referenceExpression is KtNullableType -> innerType?.getReferencedTypeExpression() - is KtDefinitelyNotNullType -> innerType?.getReferencedTypeExpression() else -> null } } 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 2eefa8f8305..06fd949c290 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -694,7 +694,6 @@ public class DefaultErrorMessages { MAP.put(NULLABLE_SUPERTYPE, "A supertype cannot be nullable"); MAP.put(DYNAMIC_SUPERTYPE, "A supertype cannot be dynamic"); MAP.put(REDUNDANT_NULLABLE, "Redundant '?'"); - MAP.put(DEFINITELY_NOT_NULLABLE_NOT_APPLICABLE, "'!!' is only applicable to type parameters with nullable upper bounds"); MAP.put(NULLABLE_ON_DEFINITELY_NOT_NULLABLE, "'!!' type cannot be marked as nullable"); MAP.put(INCORRECT_LEFT_COMPONENT_OF_INTERSECTION, "Intersection types are only supported for definitely non-nullable types: left part should be a type parameter with nullable bounds"); MAP.put(INCORRECT_RIGHT_COMPONENT_OF_INTERSECTION, "Intersection types are only supported for definitely non-nullable types: right part should be non-nullable Any"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeResolver.kt index dbd4f4a8883..8f6e7fbe075 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeResolver.kt @@ -290,33 +290,6 @@ class TypeResolver( return resolveTypeElement(c, innerAnnotations, outerModifierList ?: innerModifierList, innerType) } - override fun visitDefinitelyNotNullType(definitelyNotNullType: KtDefinitelyNotNullType) { - val baseType = - createTypeFromInner(definitelyNotNullType, definitelyNotNullType.modifierList, definitelyNotNullType.innerType) - - if (!languageVersionSettings.supportsFeature(LanguageFeature.DefinitelyNotNullTypeParameters)) { - result = baseType - c.trace.report( - UNSUPPORTED_FEATURE.on( - definitelyNotNullType, - LanguageFeature.DefinitelyNotNullTypeParameters to languageVersionSettings - ) - ) - return - } - - val definitelyNotNullKotlinType = - if (!baseType.isBare) DefinitelyNotNullType.makeDefinitelyNotNull(baseType.actualType.unwrap()) else null - - if (definitelyNotNullKotlinType == null) { - result = baseType - c.trace.report(DEFINITELY_NOT_NULLABLE_NOT_APPLICABLE.on(definitelyNotNullType)) - return - } - - result = type(definitelyNotNullKotlinType) - } - override fun visitIntersectionType(intersectionType: KtIntersectionType) { val leftType = resolvePossiblyBareType(c, intersectionType.getLeftTypeRef() ?: return).let { when { diff --git a/compiler/psi/src/org/jetbrains/kotlin/KtNodeTypes.java b/compiler/psi/src/org/jetbrains/kotlin/KtNodeTypes.java index 70b6852b9ba..c32c0b8c7ab 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/KtNodeTypes.java +++ b/compiler/psi/src/org/jetbrains/kotlin/KtNodeTypes.java @@ -75,7 +75,6 @@ public interface KtNodeTypes { IElementType FUNCTION_TYPE = KtStubElementTypes.FUNCTION_TYPE; IElementType FUNCTION_TYPE_RECEIVER = KtStubElementTypes.FUNCTION_TYPE_RECEIVER; IElementType NULLABLE_TYPE = KtStubElementTypes.NULLABLE_TYPE; - IElementType DEFINITELY_NOT_NULL_TYPE = KtStubElementTypes.DEFINITELY_NOT_NULL_TYPE; IElementType INTERSECTION_TYPE = KtStubElementTypes.INTERSECTION_TYPE; IElementType TYPE_PROJECTION = KtStubElementTypes.TYPE_PROJECTION; diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtDefinitelyNotNullType.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/KtDefinitelyNotNullType.kt deleted file mode 100644 index 1484e43cad8..00000000000 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtDefinitelyNotNullType.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.psi - -import com.intellij.lang.ASTNode -import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub -import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes - -class KtDefinitelyNotNullType : KtElementImplStub>, KtTypeElement { - constructor(node: ASTNode) : super(node) - constructor(stub: KotlinPlaceHolderStub) : super(stub, KtStubElementTypes.DEFINITELY_NOT_NULL_TYPE) - - override fun getTypeArgumentsAsTypes(): List { - return this.innerType?.typeArgumentsAsTypes ?: emptyList() - } - - override fun accept(visitor: KtVisitor, data: D): R { - return visitor.visitDefinitelyNotNullType(this, data) - } - - @get:IfNotParsed - val innerType: KtTypeElement? - get() = KtStubbedPsiUtil.getStubOrPsiChild(this, KtStubElementTypes.TYPE_ELEMENT_TYPES, KtTypeElement.ARRAY_FACTORY) - - val modifierList: KtModifierList? - get() = getStubOrPsiChild(KtStubElementTypes.MODIFIER_LIST) - - val annotationEntries: List - get() { - return modifierList?.annotationEntries ?: emptyList() - } -} diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtVisitor.java b/compiler/psi/src/org/jetbrains/kotlin/psi/KtVisitor.java index 414c398bd52..d4dc80f7655 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtVisitor.java +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtVisitor.java @@ -402,10 +402,6 @@ public class KtVisitor extends PsiElementVisitor { return visitTypeElement(nullableType, data); } - public R visitDefinitelyNotNullType(@NotNull KtDefinitelyNotNullType definitelyNotNullType, D data) { - return visitTypeElement(definitelyNotNullType, data); - } - public R visitIntersectionType(@NotNull KtIntersectionType definitelyNotNullType, D data) { return visitTypeElement(definitelyNotNullType, data); } diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtVisitorVoid.java b/compiler/psi/src/org/jetbrains/kotlin/psi/KtVisitorVoid.java index 5c055d0a34f..f5a42da6622 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtVisitorVoid.java +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtVisitorVoid.java @@ -385,10 +385,6 @@ public class KtVisitorVoid extends KtVisitor { super.visitNullableType(nullableType, null); } - public void visitDefinitelyNotNullType(@NotNull KtDefinitelyNotNullType definitelyNotNullType) { - super.visitDefinitelyNotNullType(definitelyNotNullType, null); - } - public void visitIntersectionType(@NotNull KtIntersectionType intersectionType) { super.visitIntersectionType(intersectionType, null); } @@ -980,12 +976,6 @@ public class KtVisitorVoid extends KtVisitor { return null; } - @Override - public Void visitDefinitelyNotNullType(@NotNull KtDefinitelyNotNullType definitelyNotNullType, Void data) { - visitDefinitelyNotNullType(definitelyNotNullType); - return null; - } - @Override public Void visitIntersectionType(@NotNull KtIntersectionType intersectionType, Void data) { visitIntersectionType(intersectionType); diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/psiUtil/ktPsiUtil.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/psiUtil/ktPsiUtil.kt index d21f689039b..4e952fc6a75 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/psiUtil/ktPsiUtil.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/psiUtil/ktPsiUtil.kt @@ -708,7 +708,6 @@ val KtNameReferenceExpression.isUnderscoreInBackticks tailrec fun KtTypeElement.unwrapNullability(): KtTypeElement? { return when (this) { is KtNullableType -> this.innerType?.unwrapNullability() - is KtDefinitelyNotNullType -> this.innerType?.unwrapNullability() else -> this } } diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtStubElementTypes.java b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtStubElementTypes.java index 10ad604a307..abc1b65f07e 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtStubElementTypes.java +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/KtStubElementTypes.java @@ -79,9 +79,6 @@ public interface KtStubElementTypes { KtPlaceHolderStubElementType NULLABLE_TYPE = new KtPlaceHolderStubElementType<>("NULLABLE_TYPE", KtNullableType.class); - KtPlaceHolderStubElementType DEFINITELY_NOT_NULL_TYPE = - new KtPlaceHolderStubElementType<>("DEFINITELY_NOT_NULL_TYPE", KtDefinitelyNotNullType.class); - KtPlaceHolderStubElementType INTERSECTION_TYPE = new KtPlaceHolderStubElementType<>("INTERSECTION_TYPE", KtIntersectionType.class); diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/approximation.fir.kt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/approximation.fir.kt deleted file mode 100644 index e4d28e010fe..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/approximation.fir.kt +++ /dev/null @@ -1,14 +0,0 @@ -// !LANGUAGE: +DefinitelyNotNullTypeParameters - -fun foo(x: T, y: T!!) = x!! - -fun main() { - foo("", "").length - foo("", null).length - foo(null, "").length - foo(null, null).length - - foo("", "").length - foo("", null).length - foo(null, "").length -} diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/approximation.kt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/approximation.kt deleted file mode 100644 index 75b56913297..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/approximation.kt +++ /dev/null @@ -1,14 +0,0 @@ -// !LANGUAGE: +DefinitelyNotNullTypeParameters - -fun foo(x: T, y: T!!) = x!! - -fun main() { - foo("", "").length - foo("", null).length - foo(null, "").length - foo(null, null).length - - foo("", "").length - foo("", null).length - foo(null, "").length -} diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/approximation.txt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/approximation.txt deleted file mode 100644 index db1673f7a72..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/approximation.txt +++ /dev/null @@ -1,4 +0,0 @@ -package - -public fun foo(/*0*/ x: T, /*1*/ y: T!!): T!! -public fun main(): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/disabledFeature.fir.kt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/disabledFeature.fir.kt deleted file mode 100644 index 7d1d1a64cc9..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/disabledFeature.fir.kt +++ /dev/null @@ -1,3 +0,0 @@ -// !LANGUAGE: -DefinitelyNotNullTypeParameters - -fun foo(x: T, y: T!!): List? = null diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/disabledFeature.kt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/disabledFeature.kt deleted file mode 100644 index fa25353f94f..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/disabledFeature.kt +++ /dev/null @@ -1,3 +0,0 @@ -// !LANGUAGE: -DefinitelyNotNullTypeParameters - -fun foo(x: T, y: T!!): List<T!!>? = null diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/disabledFeature.txt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/disabledFeature.txt deleted file mode 100644 index 5d5fc25c961..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/disabledFeature.txt +++ /dev/null @@ -1,4 +0,0 @@ -package - -public fun foo(/*0*/ x: T, /*1*/ y: T): kotlin.collections.List? - diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/inference.fir.kt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/inference.fir.kt deleted file mode 100644 index 81330555a2f..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/inference.fir.kt +++ /dev/null @@ -1,33 +0,0 @@ -// !LANGUAGE: +DefinitelyNotNullTypeParameters - -fun toDefNotNull(s: T): T!! = s!! - -fun removeQuestionMark(x: K?): K = x!! - -fun Any.foo() {} - -fun expectNN(e: E!!) {} - -fun main(x: F, y: F, z: F, w: F, m: F) { - val y1 = toDefNotNull(x) // K instead of K!! - val y2: F!! = toDefNotNull(x) // K instead of K!! - val x1 = removeQuestionMark(x) // T or T!! - val x2: F!! = removeQuestionMark(x) // T or T!! - - val z1 = x!! - val z2: F!! = y!! - val w1 = if (z != null) z else return - val w2: F!! = if (w != null) w else return - - y1.foo() - y2.foo() - x1.foo() - x2.foo() - z1.foo() - z2.foo() - w1.foo() - w2.foo() - - expectNN(m) - expectNN(m!!) -} diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/inference.kt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/inference.kt deleted file mode 100644 index 5fa140d37e6..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/inference.kt +++ /dev/null @@ -1,33 +0,0 @@ -// !LANGUAGE: +DefinitelyNotNullTypeParameters - -fun toDefNotNull(s: T): T!! = s!! - -fun removeQuestionMark(x: K?): K = x!! - -fun Any.foo() {} - -fun expectNN(e: E!!) {} - -fun main(x: F, y: F, z: F, w: F, m: F) { - val y1 = toDefNotNull(x) // K instead of K!! - val y2: F!! = toDefNotNull(x) // K instead of K!! - val x1 = removeQuestionMark(x) // T or T!! - val x2: F!! = removeQuestionMark(x) // T or T!! - - val z1 = x!! - val z2: F!! = y!! - val w1 = if (z != null) z else return - val w2: F!! = if (w != null) w else return - - y1.foo() - y2.foo() - x1.foo() - x2.foo() - z1.foo() - z2.foo() - w1.foo() - w2.foo() - - expectNN(m) - expectNN(m!!) -} diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/inference.txt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/inference.txt deleted file mode 100644 index b41a53165e8..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/inference.txt +++ /dev/null @@ -1,7 +0,0 @@ -package - -public fun expectNN(/*0*/ e: E!!): kotlin.Unit -public fun main(/*0*/ x: F, /*1*/ y: F, /*2*/ z: F, /*3*/ w: F, /*4*/ m: F): kotlin.Unit -public fun removeQuestionMark(/*0*/ x: K?): K -public fun toDefNotNull(/*0*/ s: T): T!! -public fun kotlin.Any.foo(): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/isAsOperators.fir.kt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/isAsOperators.fir.kt deleted file mode 100644 index 2f55c6a1114..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/isAsOperators.fir.kt +++ /dev/null @@ -1,16 +0,0 @@ -// SKIP_TXT -// !LANGUAGE: -DefinitelyNotNullTypeParameters - -fun Any.bar() {} -fun Boolean.baz() {} - -var x: Int = 0 - -inline fun foo(v: Any?): T { - if (x > 0) 1 else v as T!! - if (x > 1) 2 else v as? T!! - if (x > 2) 3 else v is T!! - if (x > 3) 4 else v !is T!! - - return v as T!! -} diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/isAsOperators.kt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/isAsOperators.kt deleted file mode 100644 index e6b33f855c3..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/isAsOperators.kt +++ /dev/null @@ -1,16 +0,0 @@ -// SKIP_TXT -// !LANGUAGE: -DefinitelyNotNullTypeParameters - -fun Any.bar() {} -fun Boolean.baz() {} - -var x: Int = 0 - -inline fun foo(v: Any?): T { - if (x > 0) 1 else v as T!! - if (x > 1) 2 else v as? T!! - if (x > 2) 3 else v is T!! - if (x > 3) 4 else v !is T!! - - return v as T!! -} diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/isAsOperatorsEnabled.fir.kt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/isAsOperatorsEnabled.fir.kt deleted file mode 100644 index 0604ae01251..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/isAsOperatorsEnabled.fir.kt +++ /dev/null @@ -1,16 +0,0 @@ -// SKIP_TXT -// !LANGUAGE: +DefinitelyNotNullTypeParameters - -fun Any.bar() {} -fun Boolean.baz() {} - -var x: Int = 0 - -inline fun foo(v: Any?): T { - if (x > 0) 1 else v as T!! - if (x > 1) 2 else v as? T!! - if (x > 2) 3 else v is T!! - if (x > 3) 4 else v !is T!! - - return v as T!! -} diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/isAsOperatorsEnabled.kt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/isAsOperatorsEnabled.kt deleted file mode 100644 index a55482d97ba..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/isAsOperatorsEnabled.kt +++ /dev/null @@ -1,16 +0,0 @@ -// SKIP_TXT -// !LANGUAGE: +DefinitelyNotNullTypeParameters - -fun Any.bar() {} -fun Boolean.baz() {} - -var x: Int = 0 - -inline fun foo(v: Any?): T { - if (x > 0) 1 else v as T!! - if (x > 1) 2 else v as? T!! - if (x > 2) 3 else v is T!! - if (x > 3) 4 else v !is T!! - - return v as T!! -} diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/notApplicable.fir.kt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/notApplicable.fir.kt deleted file mode 100644 index c1859acc729..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/notApplicable.fir.kt +++ /dev/null @@ -1,12 +0,0 @@ -// !LANGUAGE: +DefinitelyNotNullTypeParameters - -fun foo(x: T!!, y: List!!) {} - -fun bar1(x: F?!!) {} -fun bar2(x: F!!?) {} -fun bar3(x: (F?)!!) {} -fun bar4(x: (F!!)?) {} - -fun bar5(x: F!!!) {} -fun bar6(x: F!!!) {} -fun bar7(x: F!!?!!) {} diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/notApplicable.kt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/notApplicable.kt deleted file mode 100644 index fd18b966ec3..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/notApplicable.kt +++ /dev/null @@ -1,12 +0,0 @@ -// !LANGUAGE: +DefinitelyNotNullTypeParameters - -fun foo(x: T!!, y: List<String!!>!!) {} - -fun bar1(x: F?!!) {} -fun bar2(x: F!!?) {} -fun bar3(x: (F?)!!) {} -fun bar4(x: (F!!)?) {} - -fun bar5(x: F!!!) {} -fun bar6(x: F!!!) {} -fun bar7(x: F!!?!!) {} diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/notApplicable.txt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/notApplicable.txt deleted file mode 100644 index 6bcec699eff..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/notApplicable.txt +++ /dev/null @@ -1,16 +0,0 @@ -package - -public fun (): kotlin.Unit -public fun (): kotlin.Unit -public fun (): kotlin.Unit -public fun (): kotlin.Unit -public fun (): kotlin.Unit -public fun bar1(/*0*/ x: F?): kotlin.Unit -public fun bar2(/*0*/ x: F?): kotlin.Unit -public fun bar3(/*0*/ x: F?): kotlin.Unit -public fun bar4(/*0*/ x: F?): kotlin.Unit -public fun bar5(/*0*/ x: F!!): kotlin.Unit -public fun bar6(/*0*/ x: F!!): kotlin.Unit -public fun bar7(/*0*/ x: F?): kotlin.Unit -public fun foo(/*0*/ x: T, /*1*/ y: kotlin.collections.List): kotlin.Unit - diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overrides.fir.kt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overrides.fir.kt deleted file mode 100644 index 0a9518edf2e..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overrides.fir.kt +++ /dev/null @@ -1,36 +0,0 @@ -// !LANGUAGE: +DefinitelyNotNullTypeParameters - -interface A { - fun foo(x: T): T - fun bar(x: T!!): T!! -} - -interface B : A { - override fun foo(x: T1): T1 - override fun bar(x: T1!!): T1!! -} - -interface C : A { - override fun foo(x: T2!!): T2!! - override fun bar(x: T2): T2 -} - -interface D : A { - override fun foo(x: String?): String? - override fun bar(x: String): String -} - -interface E : A { - override fun foo(x: String): String - override fun bar(x: String): String -} - -interface F : A { - override fun foo(x: String): String - override fun bar(x: String?): String? -} - -interface G : A { - override fun foo(x: T3): T3 - override fun bar(x: T3): T3 -} diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overrides.kt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overrides.kt deleted file mode 100644 index 8c61e251032..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overrides.kt +++ /dev/null @@ -1,36 +0,0 @@ -// !LANGUAGE: +DefinitelyNotNullTypeParameters - -interface A { - fun foo(x: T): T - fun bar(x: T!!): T!! -} - -interface B : A { - override fun foo(x: T1): T1 - override fun bar(x: T1!!): T1!! -} - -interface C : A { - override fun foo(x: T2!!): T2!! - override fun bar(x: T2): T2 -} - -interface D : A { - override fun foo(x: String?): String? - override fun bar(x: String): String -} - -interface E : A { - override fun foo(x: String): String - override fun bar(x: String): String -} - -interface F : A { - override fun foo(x: String): String - override fun bar(x: String?): String? -} - -interface G : A { - override fun foo(x: T3): T3 - override fun bar(x: T3): T3 -} diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overrides.txt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overrides.txt deleted file mode 100644 index 50b2bc774ec..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overrides.txt +++ /dev/null @@ -1,61 +0,0 @@ -package - -public interface A { - public abstract fun bar(/*0*/ x: T!!): T!! - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public abstract fun foo(/*0*/ x: T): T - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -public interface B : A { - public abstract override /*1*/ fun bar(/*0*/ x: T1!!): T1!! - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public abstract override /*1*/ fun foo(/*0*/ x: T1): T1 - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -public interface C : A { - public abstract fun bar(/*0*/ x: T2): T2 - public abstract override /*1*/ /*fake_override*/ fun bar(/*0*/ x: T2!!): T2!! - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ x: T2): T2 - public abstract fun foo(/*0*/ x: T2!!): T2!! - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -public interface D : A { - public abstract override /*1*/ fun bar(/*0*/ x: kotlin.String): kotlin.String - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public abstract override /*1*/ fun foo(/*0*/ x: kotlin.String?): kotlin.String? - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -public interface E : A { - public abstract override /*1*/ fun bar(/*0*/ x: kotlin.String): kotlin.String - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public abstract override /*1*/ fun foo(/*0*/ x: kotlin.String): kotlin.String - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -public interface F : A { - public abstract override /*1*/ /*fake_override*/ fun bar(/*0*/ x: kotlin.String): kotlin.String - public abstract fun bar(/*0*/ x: kotlin.String?): kotlin.String? - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public abstract fun foo(/*0*/ x: kotlin.String): kotlin.String - public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ x: kotlin.String?): kotlin.String? - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -public interface G : A { - public abstract override /*1*/ fun bar(/*0*/ x: T3): T3 - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public abstract override /*1*/ fun foo(/*0*/ x: T3): T3 - 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/explicitDefinitelyNotNull/overridesJavaAnnotated.fir.kt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overridesJavaAnnotated.fir.kt deleted file mode 100644 index c0997b309b4..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overridesJavaAnnotated.fir.kt +++ /dev/null @@ -1,42 +0,0 @@ -// !LANGUAGE: +DefinitelyNotNullTypeParameters +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated - -// FILE: A.java -import org.jetbrains.annotations.*; - -public interface A { - public T foo(T x) { return x; } - @NotNull - public T bar(@NotNull T x) {} -} - -// FILE: main.kt - -interface B : A { - override fun foo(x: T1): T1 - override fun bar(x: T1!!): T1!! -} - -interface C : A { - override fun foo(x: T2!!): T2!! - override fun bar(x: T2): T2 -} - -interface D : A { - override fun foo(x: String?): String? - override fun bar(x: String): String -} - -interface E : A { - override fun foo(x: String): String - override fun bar(x: String): String -} - -interface F : A { - override fun foo(x: String): String - override fun bar(x: String?): String? -} - -interface G : A { - override fun foo(x: T3): T3 - override fun bar(x: T3): T3 -} diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overridesJavaAnnotated.kt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overridesJavaAnnotated.kt deleted file mode 100644 index 339dd4c1b51..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overridesJavaAnnotated.kt +++ /dev/null @@ -1,42 +0,0 @@ -// !LANGUAGE: +DefinitelyNotNullTypeParameters +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated - -// FILE: A.java -import org.jetbrains.annotations.*; - -public interface A { - public T foo(T x) { return x; } - @NotNull - public T bar(@NotNull T x) {} -} - -// FILE: main.kt - -interface B : A { - override fun foo(x: T1): T1 - override fun bar(x: T1!!): T1!! -} - -interface C : A { - override fun foo(x: T2!!): T2!! - override fun bar(x: T2): T2 -} - -interface D : A { - override fun foo(x: String?): String? - override fun bar(x: String): String -} - -interface E : A { - override fun foo(x: String): String - override fun bar(x: String): String -} - -interface F : A { - override fun foo(x: String): String - override fun bar(x: String?): String? -} - -interface G : A { - override fun foo(x: T3): T3 - override fun bar(x: T3): T3 -} diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overridesJavaAnnotated.txt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overridesJavaAnnotated.txt deleted file mode 100644 index 6c3f08fa065..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overridesJavaAnnotated.txt +++ /dev/null @@ -1,61 +0,0 @@ -package - -public interface A { - @org.jetbrains.annotations.NotNull public abstract fun bar(/*0*/ @org.jetbrains.annotations.NotNull x: T!!): T!! - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public abstract fun foo(/*0*/ x: T!): T! - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -public interface B : A { - public abstract override /*1*/ fun bar(/*0*/ x: T1!!): T1!! - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public abstract override /*1*/ fun foo(/*0*/ x: T1): T1 - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -public interface C : A { - public abstract fun bar(/*0*/ x: T2): T2 - @org.jetbrains.annotations.NotNull public abstract override /*1*/ /*fake_override*/ fun bar(/*0*/ @org.jetbrains.annotations.NotNull x: T2!!): T2!! - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ x: T2!): T2! - public abstract fun foo(/*0*/ x: T2!!): T2!! - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -public interface D : A { - public abstract override /*1*/ fun bar(/*0*/ x: kotlin.String): kotlin.String - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public abstract override /*1*/ fun foo(/*0*/ x: kotlin.String?): kotlin.String? - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -public interface E : A { - public abstract override /*1*/ fun bar(/*0*/ x: kotlin.String): kotlin.String - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public abstract override /*1*/ fun foo(/*0*/ x: kotlin.String): kotlin.String - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -public interface F : A { - @org.jetbrains.annotations.NotNull public abstract override /*1*/ /*fake_override*/ fun bar(/*0*/ @org.jetbrains.annotations.NotNull x: kotlin.String): kotlin.String - public abstract fun bar(/*0*/ x: kotlin.String?): kotlin.String? - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public abstract fun foo(/*0*/ x: kotlin.String): kotlin.String - public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ x: kotlin.String?): kotlin.String? - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -public interface G : A { - public abstract override /*1*/ fun bar(/*0*/ x: T3): T3 - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public abstract override /*1*/ fun foo(/*0*/ x: T3): T3 - 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/explicitDefinitelyNotNull/simple.fir.kt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/simple.fir.kt deleted file mode 100644 index b5e2360fbfc..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/simple.fir.kt +++ /dev/null @@ -1,14 +0,0 @@ -// !LANGUAGE: +DefinitelyNotNullTypeParameters - -fun foo(x: T, y: T!!): T!! = x ?: y - -fun main() { - foo("", "").length - foo("", null).length - foo(null, "").length - foo(null, null).length - - foo("", "").length - foo("", null).length - foo(null, "").length -} diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/simple.kt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/simple.kt deleted file mode 100644 index c4b65706f99..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/simple.kt +++ /dev/null @@ -1,14 +0,0 @@ -// !LANGUAGE: +DefinitelyNotNullTypeParameters - -fun foo(x: T, y: T!!): T!! = x ?: y - -fun main() { - foo("", "").length - foo("", null).length - foo(null, "").length - foo(null, null).length - - foo("", "").length - foo("", null).length - foo(null, "").length -} diff --git a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/simple.txt b/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/simple.txt deleted file mode 100644 index db1673f7a72..00000000000 --- a/compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/simple.txt +++ /dev/null @@ -1,4 +0,0 @@ -package - -public fun foo(/*0*/ x: T, /*1*/ y: T!!): T!! -public fun main(): kotlin.Unit 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 2e799d2d16e..1f2ed7743d0 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 @@ -10058,70 +10058,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { } } - @Nested - @TestMetadata("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull") - @TestDataPath("$PROJECT_ROOT") - public class ExplicitDefinitelyNotNull { - @Test - public void testAllFilesPresentInExplicitDefinitelyNotNull() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); - } - - @Test - @TestMetadata("approximation.kt") - public void testApproximation() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/approximation.kt"); - } - - @Test - @TestMetadata("disabledFeature.kt") - public void testDisabledFeature() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/disabledFeature.kt"); - } - - @Test - @TestMetadata("inference.kt") - public void testInference() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/inference.kt"); - } - - @Test - @TestMetadata("isAsOperators.kt") - public void testIsAsOperators() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/isAsOperators.kt"); - } - - @Test - @TestMetadata("isAsOperatorsEnabled.kt") - public void testIsAsOperatorsEnabled() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/isAsOperatorsEnabled.kt"); - } - - @Test - @TestMetadata("notApplicable.kt") - public void testNotApplicable() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/notApplicable.kt"); - } - - @Test - @TestMetadata("overrides.kt") - public void testOverrides() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overrides.kt"); - } - - @Test - @TestMetadata("overridesJavaAnnotated.kt") - public void testOverridesJavaAnnotated() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overridesJavaAnnotated.kt"); - } - - @Test - @TestMetadata("simple.kt") - public void testSimple() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/simple.kt"); - } - } - @Nested @TestMetadata("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection") @TestDataPath("$PROJECT_ROOT") diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java index 177f7b38364..954fe86f81a 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java @@ -10052,70 +10052,6 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag } } - @Nested - @TestMetadata("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull") - @TestDataPath("$PROJECT_ROOT") - public class ExplicitDefinitelyNotNull { - @Test - public void testAllFilesPresentInExplicitDefinitelyNotNull() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); - } - - @Test - @TestMetadata("approximation.kt") - public void testApproximation() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/approximation.kt"); - } - - @Test - @TestMetadata("disabledFeature.kt") - public void testDisabledFeature() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/disabledFeature.kt"); - } - - @Test - @TestMetadata("inference.kt") - public void testInference() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/inference.kt"); - } - - @Test - @TestMetadata("isAsOperators.kt") - public void testIsAsOperators() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/isAsOperators.kt"); - } - - @Test - @TestMetadata("isAsOperatorsEnabled.kt") - public void testIsAsOperatorsEnabled() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/isAsOperatorsEnabled.kt"); - } - - @Test - @TestMetadata("notApplicable.kt") - public void testNotApplicable() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/notApplicable.kt"); - } - - @Test - @TestMetadata("overrides.kt") - public void testOverrides() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overrides.kt"); - } - - @Test - @TestMetadata("overridesJavaAnnotated.kt") - public void testOverridesJavaAnnotated() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/overridesJavaAnnotated.kt"); - } - - @Test - @TestMetadata("simple.kt") - public void testSimple() throws Exception { - runTest("compiler/testData/diagnostics/tests/explicitDefinitelyNotNull/simple.kt"); - } - } - @Nested @TestMetadata("compiler/testData/diagnostics/tests/explicitDefinitelyNotNullableViaIntersection") @TestDataPath("$PROJECT_ROOT")