Drop support for T!! syntactic structure
^KT-26245 In Progress
This commit is contained in:
committed by
teamcityserver
parent
302eacbf59
commit
c1b5d5551f
-64
@@ -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")
|
||||
|
||||
-64
@@ -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")
|
||||
|
||||
+1
-1
@@ -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
|
||||
}
|
||||
|
||||
-26
@@ -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<TypeModifier>,
|
||||
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
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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 ||
|
||||
|
||||
@@ -159,7 +159,6 @@ public interface Errors {
|
||||
DiagnosticFactory2<KtTypeReference, KotlinType, KotlinType> UPPER_BOUND_VIOLATED = DiagnosticFactory2.create(ERROR);
|
||||
DiagnosticFactory2<KtTypeReference, KotlinType, KotlinType> UPPER_BOUND_VIOLATED_WARNING = DiagnosticFactory2.create(WARNING);
|
||||
DiagnosticFactory0<KtNullableType> REDUNDANT_NULLABLE = DiagnosticFactory0.create(WARNING, NULLABLE_TYPE);
|
||||
DiagnosticFactory0<KtDefinitelyNotNullType> DEFINITELY_NOT_NULLABLE_NOT_APPLICABLE = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<KtNullableType> NULLABLE_ON_DEFINITELY_NOT_NULLABLE = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<KtTypeReference> INCORRECT_LEFT_COMPONENT_OF_INTERSECTION = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<KtTypeReference> INCORRECT_RIGHT_COMPONENT_OF_INTERSECTION = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
@@ -844,7 +844,6 @@ object PositioningStrategies {
|
||||
return when (this) {
|
||||
is KtUserType -> referenceExpression
|
||||
is KtNullableType -> innerType?.getReferencedTypeExpression()
|
||||
is KtDefinitelyNotNullType -> innerType?.getReferencedTypeExpression()
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -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");
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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<KotlinPlaceHolderStub<KtDefinitelyNotNullType>>, KtTypeElement {
|
||||
constructor(node: ASTNode) : super(node)
|
||||
constructor(stub: KotlinPlaceHolderStub<KtDefinitelyNotNullType>) : super(stub, KtStubElementTypes.DEFINITELY_NOT_NULL_TYPE)
|
||||
|
||||
override fun getTypeArgumentsAsTypes(): List<KtTypeReference> {
|
||||
return this.innerType?.typeArgumentsAsTypes ?: emptyList()
|
||||
}
|
||||
|
||||
override fun <R, D> accept(visitor: KtVisitor<R, D>, 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<KtAnnotationEntry>
|
||||
get() {
|
||||
return modifierList?.annotationEntries ?: emptyList()
|
||||
}
|
||||
}
|
||||
@@ -402,10 +402,6 @@ public class KtVisitor<R, D> 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);
|
||||
}
|
||||
|
||||
@@ -385,10 +385,6 @@ public class KtVisitorVoid extends KtVisitor<Void, Void> {
|
||||
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<Void, Void> {
|
||||
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);
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,9 +79,6 @@ public interface KtStubElementTypes {
|
||||
KtPlaceHolderStubElementType<KtNullableType> NULLABLE_TYPE =
|
||||
new KtPlaceHolderStubElementType<>("NULLABLE_TYPE", KtNullableType.class);
|
||||
|
||||
KtPlaceHolderStubElementType<KtDefinitelyNotNullType> DEFINITELY_NOT_NULL_TYPE =
|
||||
new KtPlaceHolderStubElementType<>("DEFINITELY_NOT_NULL_TYPE", KtDefinitelyNotNullType.class);
|
||||
|
||||
KtPlaceHolderStubElementType<KtIntersectionType> INTERSECTION_TYPE =
|
||||
new KtPlaceHolderStubElementType<>("INTERSECTION_TYPE", KtIntersectionType.class);
|
||||
|
||||
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||
|
||||
fun <T> foo(x: T, y: T!!) = x!!
|
||||
|
||||
fun main() {
|
||||
foo<String>("", "").length
|
||||
foo<String>("", <!NULL_FOR_NONNULL_TYPE!>null<!>).length
|
||||
foo<String?>(null, "").length
|
||||
foo<String?>(null, null).length
|
||||
|
||||
foo("", "").length
|
||||
foo("", null).length
|
||||
foo(null, "").length
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||
|
||||
fun <T> foo(x: T, y: T!!) = x!!
|
||||
|
||||
fun main() {
|
||||
foo<String>("", "").length
|
||||
foo<String>("", <!NULL_FOR_NONNULL_TYPE!>null<!>).length
|
||||
foo<String?>(null, "").length
|
||||
foo<String?>(null, <!NULL_FOR_NONNULL_TYPE!>null<!>).length
|
||||
|
||||
foo("", "").length
|
||||
foo("", <!NULL_FOR_NONNULL_TYPE!>null<!>).length
|
||||
foo(null, "").length
|
||||
}
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ T> foo(/*0*/ x: T, /*1*/ y: T!!): T!!
|
||||
public fun main(): kotlin.Unit
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
// !LANGUAGE: -DefinitelyNotNullTypeParameters
|
||||
|
||||
fun <T> foo(x: T, y: T!!): List<T!!>? = null
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
// !LANGUAGE: -DefinitelyNotNullTypeParameters
|
||||
|
||||
fun <T> foo(x: T, y: <!UNSUPPORTED_FEATURE!>T!!<!>): List<<!UNSUPPORTED_FEATURE!>T!!<!>>? = null
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ T> foo(/*0*/ x: T, /*1*/ y: T): kotlin.collections.List<T>?
|
||||
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||
|
||||
fun <T> toDefNotNull(s: T): T!! = s!!
|
||||
|
||||
fun <K> removeQuestionMark(x: K?): K = x!!
|
||||
|
||||
fun Any.foo() {}
|
||||
|
||||
fun <E> expectNN(e: E!!) {}
|
||||
|
||||
fun <F> 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<!UNSAFE_CALL!>.<!>foo()
|
||||
y2<!UNSAFE_CALL!>.<!>foo()
|
||||
x1.foo()
|
||||
x2<!UNSAFE_CALL!>.<!>foo()
|
||||
z1.foo()
|
||||
z2<!UNSAFE_CALL!>.<!>foo()
|
||||
w1.foo()
|
||||
w2<!UNSAFE_CALL!>.<!>foo()
|
||||
|
||||
expectNN(m)
|
||||
expectNN(m!!)
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||
|
||||
fun <T> toDefNotNull(s: T): T!! = s!!
|
||||
|
||||
fun <K> removeQuestionMark(x: K?): K = x!!
|
||||
|
||||
fun Any.foo() {}
|
||||
|
||||
fun <E> expectNN(e: E!!) {}
|
||||
|
||||
fun <F> 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) <!DEBUG_INFO_SMARTCAST!>z<!> else return
|
||||
val w2: F!! = if (w != null) <!DEBUG_INFO_SMARTCAST!>w<!> else return
|
||||
|
||||
y1.foo()
|
||||
y2.foo()
|
||||
x1.foo()
|
||||
x2.foo()
|
||||
z1.foo()
|
||||
z2.foo()
|
||||
w1.foo()
|
||||
w2.foo()
|
||||
|
||||
expectNN(<!TYPE_MISMATCH!>m<!>)
|
||||
expectNN(m!!)
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ E> expectNN(/*0*/ e: E!!): kotlin.Unit
|
||||
public fun </*0*/ F> main(/*0*/ x: F, /*1*/ y: F, /*2*/ z: F, /*3*/ w: F, /*4*/ m: F): kotlin.Unit
|
||||
public fun </*0*/ K> removeQuestionMark(/*0*/ x: K?): K
|
||||
public fun </*0*/ T> toDefNotNull(/*0*/ s: T): T!!
|
||||
public fun kotlin.Any.foo(): kotlin.Unit
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
// SKIP_TXT
|
||||
// !LANGUAGE: -DefinitelyNotNullTypeParameters
|
||||
|
||||
fun Any.bar() {}
|
||||
fun Boolean.baz() {}
|
||||
|
||||
var x: Int = 0
|
||||
|
||||
inline fun <reified T> 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<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
|
||||
if (x > 3) 4 else v !is T<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
|
||||
|
||||
return v as T<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
// SKIP_TXT
|
||||
// !LANGUAGE: -DefinitelyNotNullTypeParameters
|
||||
|
||||
fun Any.bar() {}
|
||||
fun Boolean.baz() {}
|
||||
|
||||
var x: Int = 0
|
||||
|
||||
inline fun <reified T> foo(v: Any?): T {
|
||||
<!DEPRECATED_SYNTAX_WITH_DEFINITELY_NOT_NULL!>if (x > 0) 1 else v as T!!<!>
|
||||
<!DEPRECATED_SYNTAX_WITH_DEFINITELY_NOT_NULL!>if (x > 1) 2 else v as? T!!<!>
|
||||
<!DEPRECATED_SYNTAX_WITH_DEFINITELY_NOT_NULL!>if (x > 2) 3 else v is T<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!><!>
|
||||
<!DEPRECATED_SYNTAX_WITH_DEFINITELY_NOT_NULL!>if (x > 3) 4 else v !is T<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!><!>
|
||||
|
||||
<!DEPRECATED_SYNTAX_WITH_DEFINITELY_NOT_NULL!>return v as T<!UNNECESSARY_NOT_NULL_ASSERTION, UNREACHABLE_CODE!>!!<!><!>
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
// SKIP_TXT
|
||||
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||
|
||||
fun Any.bar() {}
|
||||
fun Boolean.baz() {}
|
||||
|
||||
var x: Int = 0
|
||||
|
||||
inline fun <reified T> 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<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
|
||||
if (x > 3) 4 else v !is T<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
|
||||
|
||||
return v as T<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
// SKIP_TXT
|
||||
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||
|
||||
fun Any.bar() {}
|
||||
fun Boolean.baz() {}
|
||||
|
||||
var x: Int = 0
|
||||
|
||||
inline fun <reified T> foo(v: Any?): T {
|
||||
<!DEPRECATED_SYNTAX_WITH_DEFINITELY_NOT_NULL!>if (x > 0) 1 else v as T!!<!>
|
||||
<!DEPRECATED_SYNTAX_WITH_DEFINITELY_NOT_NULL!>if (x > 1) 2 else v as? T!!<!>
|
||||
<!DEPRECATED_SYNTAX_WITH_DEFINITELY_NOT_NULL!>if (x > 2) 3 else v is T<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!><!>
|
||||
<!DEPRECATED_SYNTAX_WITH_DEFINITELY_NOT_NULL!>if (x > 3) 4 else v !is T<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!><!>
|
||||
|
||||
<!DEPRECATED_SYNTAX_WITH_DEFINITELY_NOT_NULL!>return v as T<!UNNECESSARY_NOT_NULL_ASSERTION, UNREACHABLE_CODE!>!!<!><!>
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||
|
||||
fun <T : Any> foo(x: T!!, y: List<String!!>!!) {}
|
||||
|
||||
fun <F> bar1(x: F?<!SYNTAX!><!SYNTAX!><!>!!<!><!SYNTAX!>)<!> <!FUNCTION_DECLARATION_WITH_NO_NAME!><!SYNTAX!><!>{}<!>
|
||||
fun <F> bar2(x: F!!?) {}
|
||||
fun <F> bar3(x: (F?)<!SYNTAX!><!SYNTAX!><!>!!<!><!SYNTAX!>)<!> <!FUNCTION_DECLARATION_WITH_NO_NAME!><!SYNTAX!><!>{}<!>
|
||||
fun <F> bar4(x: (F!!)?) {}
|
||||
|
||||
fun <F> bar5(x: F!!<!SYNTAX!><!SYNTAX!><!>!<!><!SYNTAX!>)<!> <!FUNCTION_DECLARATION_WITH_NO_NAME!><!SYNTAX!><!>{}<!>
|
||||
fun <F> bar6(x: F!!<!SYNTAX!><!SYNTAX!><!>!<!><!SYNTAX!>)<!> <!FUNCTION_DECLARATION_WITH_NO_NAME!><!SYNTAX!><!>{}<!>
|
||||
fun <F> bar7(x: F!!?<!SYNTAX!><!SYNTAX!><!>!!<!><!SYNTAX!>)<!> <!FUNCTION_DECLARATION_WITH_NO_NAME!><!SYNTAX!><!>{}<!>
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||
|
||||
fun <T : Any> foo(x: <!DEFINITELY_NOT_NULLABLE_NOT_APPLICABLE!>T!!<!>, y: <!DEFINITELY_NOT_NULLABLE_NOT_APPLICABLE!>List<<!DEFINITELY_NOT_NULLABLE_NOT_APPLICABLE!>String!!<!>>!!<!>) {}
|
||||
|
||||
fun <F> bar1(x: F?<!SYNTAX!><!SYNTAX!><!>!!<!><!SYNTAX!>)<!> <!CONFLICTING_OVERLOADS, FUNCTION_DECLARATION_WITH_NO_NAME!><!SYNTAX!><!>{}<!>
|
||||
fun <F> bar2(x: <!NULLABLE_ON_DEFINITELY_NOT_NULLABLE!>F!!?<!>) {}
|
||||
fun <F> bar3(x: (F?)<!SYNTAX!><!SYNTAX!><!>!!<!><!SYNTAX!>)<!> <!CONFLICTING_OVERLOADS, FUNCTION_DECLARATION_WITH_NO_NAME!><!SYNTAX!><!>{}<!>
|
||||
fun <F> bar4(x: <!NULLABLE_ON_DEFINITELY_NOT_NULLABLE!>(F!!)?<!>) {}
|
||||
|
||||
fun <F> bar5(x: F!!<!SYNTAX!><!SYNTAX!><!>!<!><!SYNTAX!>)<!> <!CONFLICTING_OVERLOADS, FUNCTION_DECLARATION_WITH_NO_NAME!><!SYNTAX!><!>{}<!>
|
||||
fun <F> bar6(x: F!!<!SYNTAX!><!SYNTAX!><!>!<!><!SYNTAX!>)<!> <!CONFLICTING_OVERLOADS, FUNCTION_DECLARATION_WITH_NO_NAME!><!SYNTAX!><!>{}<!>
|
||||
fun <F> bar7(x: <!NULLABLE_ON_DEFINITELY_NOT_NULLABLE!>F!!?<!><!SYNTAX!><!SYNTAX!><!>!!<!><!SYNTAX!>)<!> <!CONFLICTING_OVERLOADS, FUNCTION_DECLARATION_WITH_NO_NAME!><!SYNTAX!><!>{}<!>
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
package
|
||||
|
||||
public fun <no name provided>(): kotlin.Unit
|
||||
public fun <no name provided>(): kotlin.Unit
|
||||
public fun <no name provided>(): kotlin.Unit
|
||||
public fun <no name provided>(): kotlin.Unit
|
||||
public fun <no name provided>(): kotlin.Unit
|
||||
public fun </*0*/ F> bar1(/*0*/ x: F?): kotlin.Unit
|
||||
public fun </*0*/ F> bar2(/*0*/ x: F?): kotlin.Unit
|
||||
public fun </*0*/ F> bar3(/*0*/ x: F?): kotlin.Unit
|
||||
public fun </*0*/ F> bar4(/*0*/ x: F?): kotlin.Unit
|
||||
public fun </*0*/ F> bar5(/*0*/ x: F!!): kotlin.Unit
|
||||
public fun </*0*/ F> bar6(/*0*/ x: F!!): kotlin.Unit
|
||||
public fun </*0*/ F> bar7(/*0*/ x: F?): kotlin.Unit
|
||||
public fun </*0*/ T : kotlin.Any> foo(/*0*/ x: T, /*1*/ y: kotlin.collections.List<kotlin.String>): kotlin.Unit
|
||||
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||
|
||||
interface A<T> {
|
||||
fun foo(x: T): T
|
||||
fun bar(x: T!!): T!!
|
||||
}
|
||||
|
||||
interface B<T1> : A<T1> {
|
||||
override fun foo(x: T1): T1
|
||||
override fun bar(x: T1!!): T1!!
|
||||
}
|
||||
|
||||
interface C<T2> : A<T2> {
|
||||
override fun foo(x: T2!!): T2!!
|
||||
override fun bar(x: T2): T2
|
||||
}
|
||||
|
||||
interface D : A<String?> {
|
||||
override fun foo(x: String?): String?
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: String): String
|
||||
}
|
||||
|
||||
interface E : A<String> {
|
||||
override fun foo(x: String): String
|
||||
override fun bar(x: String): String
|
||||
}
|
||||
|
||||
interface F : A<String?> {
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> fun foo(x: String): String
|
||||
override fun bar(x: String?): String?
|
||||
}
|
||||
|
||||
interface G<T3 : Any> : A<T3> {
|
||||
override fun foo(x: T3): T3
|
||||
override fun bar(x: T3): T3
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||
|
||||
interface A<T> {
|
||||
fun foo(x: T): T
|
||||
fun bar(x: T!!): T!!
|
||||
}
|
||||
|
||||
interface B<T1> : A<T1> {
|
||||
override fun foo(x: T1): T1
|
||||
override fun bar(x: T1!!): T1!!
|
||||
}
|
||||
|
||||
interface C<T2> : A<T2> {
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> fun foo(x: T2!!): T2!!
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: T2): T2
|
||||
}
|
||||
|
||||
interface D : A<String?> {
|
||||
override fun foo(x: String?): String?
|
||||
override fun bar(x: String): String
|
||||
}
|
||||
|
||||
interface E : A<String> {
|
||||
override fun foo(x: String): String
|
||||
override fun bar(x: String): String
|
||||
}
|
||||
|
||||
interface F : A<String?> {
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> fun foo(x: String): String
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: String?): String?
|
||||
}
|
||||
|
||||
interface G<T3 : Any> : A<T3> {
|
||||
override fun foo(x: T3): T3
|
||||
override fun bar(x: T3): T3
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package
|
||||
|
||||
public interface A</*0*/ T> {
|
||||
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</*0*/ T1> : A<T1> {
|
||||
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</*0*/ T2> : A<T2> {
|
||||
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<kotlin.String?> {
|
||||
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<kotlin.String> {
|
||||
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<kotlin.String?> {
|
||||
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</*0*/ T3 : kotlin.Any> : A<T3> {
|
||||
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
|
||||
}
|
||||
Vendored
-42
@@ -1,42 +0,0 @@
|
||||
// !LANGUAGE: +DefinitelyNotNullTypeParameters +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
|
||||
|
||||
// FILE: A.java
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public interface A<T> {
|
||||
public T foo(T x) { return x; }
|
||||
@NotNull
|
||||
public T bar(@NotNull T x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
interface B<T1> : A<T1> {
|
||||
override fun foo(x: T1): T1
|
||||
override fun bar(x: T1!!): <!RETURN_TYPE_MISMATCH_ON_OVERRIDE!>T1!!<!>
|
||||
}
|
||||
|
||||
interface C<T2> : A<T2> {
|
||||
override fun foo(x: T2!!): T2!!
|
||||
override fun bar(x: T2): <!RETURN_TYPE_MISMATCH_ON_OVERRIDE!>T2<!>
|
||||
}
|
||||
|
||||
interface D : A<String?> {
|
||||
override fun foo(x: String?): String?
|
||||
override fun bar(x: String): String
|
||||
}
|
||||
|
||||
interface E : A<String> {
|
||||
override fun foo(x: String): String
|
||||
override fun bar(x: String): String
|
||||
}
|
||||
|
||||
interface F : A<String?> {
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> fun foo(x: String): String
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: String?): String?
|
||||
}
|
||||
|
||||
interface G<T3 : Any> : A<T3> {
|
||||
override fun foo(x: T3): T3
|
||||
override fun bar(x: T3): T3
|
||||
}
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
// !LANGUAGE: +DefinitelyNotNullTypeParameters +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
|
||||
|
||||
// FILE: A.java
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public interface A<T> {
|
||||
public T foo(T x) { return x; }
|
||||
@NotNull
|
||||
public T bar(@NotNull T x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
interface B<T1> : A<T1> {
|
||||
override fun foo(x: T1): T1
|
||||
override fun bar(x: T1!!): T1!!
|
||||
}
|
||||
|
||||
interface C<T2> : A<T2> {
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> fun foo(x: T2!!): T2!!
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: T2): T2
|
||||
}
|
||||
|
||||
interface D : A<String?> {
|
||||
override fun foo(x: String?): String?
|
||||
override fun bar(x: String): String
|
||||
}
|
||||
|
||||
interface E : A<String> {
|
||||
override fun foo(x: String): String
|
||||
override fun bar(x: String): String
|
||||
}
|
||||
|
||||
interface F : A<String?> {
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> fun foo(x: String): String
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> fun bar(x: String?): String?
|
||||
}
|
||||
|
||||
interface G<T3 : Any> : A<T3> {
|
||||
override fun foo(x: T3): T3
|
||||
override fun bar(x: T3): T3
|
||||
}
|
||||
-61
@@ -1,61 +0,0 @@
|
||||
package
|
||||
|
||||
public interface A</*0*/ T : kotlin.Any!> {
|
||||
@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</*0*/ T1> : A<T1> {
|
||||
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</*0*/ T2> : A<T2> {
|
||||
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<kotlin.String?> {
|
||||
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<kotlin.String> {
|
||||
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<kotlin.String?> {
|
||||
@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</*0*/ T3 : kotlin.Any> : A<T3> {
|
||||
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
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||
|
||||
fun <T> foo(x: T, y: T!!): T!! = x ?: y
|
||||
|
||||
fun main() {
|
||||
foo<String>("", "").length
|
||||
foo<String>("", <!NULL_FOR_NONNULL_TYPE!>null<!>).length
|
||||
foo<String?>(null, "")<!UNSAFE_CALL!>.<!>length
|
||||
foo<String?>(null, null)<!UNSAFE_CALL!>.<!>length
|
||||
|
||||
foo("", "").length
|
||||
foo("", null)<!UNSAFE_CALL!>.<!>length
|
||||
foo(null, "")<!UNSAFE_CALL!>.<!>length
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
// !LANGUAGE: +DefinitelyNotNullTypeParameters
|
||||
|
||||
fun <T> foo(x: T, y: T!!): T!! = x ?: y
|
||||
|
||||
fun main() {
|
||||
foo<String>("", "").length
|
||||
foo<String>("", <!NULL_FOR_NONNULL_TYPE!>null<!>).length
|
||||
foo<String?>(null, "").length
|
||||
foo<String?>(null, <!NULL_FOR_NONNULL_TYPE!>null<!>).length
|
||||
|
||||
foo("", "").length
|
||||
foo("", <!NULL_FOR_NONNULL_TYPE!>null<!>).length
|
||||
foo(null, "").length
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ T> foo(/*0*/ x: T, /*1*/ y: T!!): T!!
|
||||
public fun main(): kotlin.Unit
|
||||
Generated
-64
@@ -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")
|
||||
|
||||
-64
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user