[FE 1.0] Report USELESS_IS_CHECK if is expression is always false
^KT-47684 Fixed
This commit is contained in:
committed by
teamcityserver
parent
785e2f862c
commit
7b5a5f5682
+6
@@ -3609,6 +3609,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/cast/FlexibleTargetType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("isAlwaysFalse.kt")
|
||||
public void testIsAlwaysFalse() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/cast/isAlwaysFalse.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("IsErasedAllowForDerivedWithOneSubstitutedAndOneSameGeneric.kt")
|
||||
public void testIsErasedAllowForDerivedWithOneSubstitutedAndOneSameGeneric() throws Exception {
|
||||
|
||||
+6
@@ -3609,6 +3609,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/cast/FlexibleTargetType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("isAlwaysFalse.kt")
|
||||
public void testIsAlwaysFalse() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/cast/isAlwaysFalse.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("IsErasedAllowForDerivedWithOneSubstitutedAndOneSameGeneric.kt")
|
||||
public void testIsErasedAllowForDerivedWithOneSubstitutedAndOneSameGeneric() throws Exception {
|
||||
|
||||
+19
-5
@@ -43,6 +43,7 @@ import org.jetbrains.kotlin.types.expressions.ControlStructureTypingUtils.*
|
||||
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.createTypeInfo
|
||||
import org.jetbrains.kotlin.types.expressions.typeInfoFactory.noTypeInfo
|
||||
import org.jetbrains.kotlin.types.typeUtil.containsError
|
||||
import org.jetbrains.kotlin.types.typeUtil.isAnyOrNullableAny
|
||||
import java.util.*
|
||||
|
||||
class PatternMatchingTypingVisitor internal constructor(facade: ExpressionTypingInternals) : ExpressionTypingVisitor(facade) {
|
||||
@@ -640,9 +641,9 @@ class PatternMatchingTypingVisitor internal constructor(facade: ExpressionTyping
|
||||
assert(element is KtNullableType) { "element must be instance of " + KtNullableType::class.java.name }
|
||||
context.trace.report(Errors.USELESS_NULLABLE_CHECK.on(element as KtNullableType))
|
||||
}
|
||||
checkTypeCompatibility(context, targetType, subjectType, typeReferenceAfterIs)
|
||||
val typesAreCompatible = checkTypeCompatibility(context, targetType, subjectType, typeReferenceAfterIs)
|
||||
|
||||
detectRedundantIs(context, subjectType, targetType, isCheck, negated, subjectDataFlowValue)
|
||||
detectRedundantIs(context, subjectType, targetType, isCheck, negated, subjectDataFlowValue, typesAreCompatible)
|
||||
|
||||
if (context.languageVersionSettings.supportsFeature(LanguageFeature.ProperCheckAnnotationsTargetInTypeUsePositions)) {
|
||||
components.annotationChecker.check(typeReferenceAfterIs, context.trace)
|
||||
@@ -662,12 +663,24 @@ class PatternMatchingTypingVisitor internal constructor(facade: ExpressionTyping
|
||||
targetType: KotlinType,
|
||||
isCheck: KtElement,
|
||||
negated: Boolean,
|
||||
subjectDataFlowValue: DataFlowValue
|
||||
subjectDataFlowValue: DataFlowValue,
|
||||
typesAreCompatible: Boolean
|
||||
) {
|
||||
if (subjectType.containsError() || targetType.containsError()) return
|
||||
|
||||
val possibleTypes =
|
||||
DataFlowAnalyzer.getAllPossibleTypes(subjectType, context, subjectDataFlowValue, context.languageVersionSettings)
|
||||
|
||||
if (typesAreCompatible && !targetType.isError) {
|
||||
val nonTrivialTypes = possibleTypes.filterNot { it.isAnyOrNullableAny() }
|
||||
.takeIf { it.isNotEmpty() }
|
||||
?: possibleTypes
|
||||
|
||||
if (nonTrivialTypes.none { CastDiagnosticsUtil.isCastPossible(it, targetType, components.platformToKotlinClassMapper) }) {
|
||||
context.trace.report(USELESS_IS_CHECK.on(isCheck, negated))
|
||||
}
|
||||
}
|
||||
|
||||
if (CastDiagnosticsUtil.isRefinementUseless(possibleTypes, targetType, false)) {
|
||||
context.trace.report(Errors.USELESS_IS_CHECK.on(isCheck, !negated))
|
||||
}
|
||||
@@ -683,11 +696,11 @@ class PatternMatchingTypingVisitor internal constructor(facade: ExpressionTyping
|
||||
type: KotlinType,
|
||||
subjectType: KotlinType,
|
||||
reportErrorOn: KtElement
|
||||
) {
|
||||
): Boolean {
|
||||
// TODO : Take smart casts into account?
|
||||
if (TypeIntersector.isIntersectionEmpty(type, subjectType)) {
|
||||
context.trace.report(INCOMPATIBLE_TYPES.on(reportErrorOn, type, subjectType))
|
||||
return
|
||||
return false
|
||||
}
|
||||
|
||||
checkEnumsForCompatibility(context, reportErrorOn, subjectType, type)
|
||||
@@ -696,5 +709,6 @@ class PatternMatchingTypingVisitor internal constructor(facade: ExpressionTyping
|
||||
if (KotlinBuiltIns.isNullableNothing(type) && !TypeUtils.isNullableType(subjectType)) {
|
||||
context.trace.report(SENSELESS_NULL_IN_WHEN.on(reportErrorOn))
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@ open class RecA<T>: <!CYCLIC_INHERITANCE_HIERARCHY!>RecB<T><!>()
|
||||
open class RecB<T>: <!CYCLIC_INHERITANCE_HIERARCHY!>RecA<T><!>()
|
||||
open class SelfR<T>: <!CYCLIC_INHERITANCE_HIERARCHY!>SelfR<T><!>()
|
||||
|
||||
fun test(f: SelfR<String>) = f is <!CANNOT_CHECK_FOR_ERASED!>RecA<String><!>
|
||||
fun test(f: RecB<String>) = f is <!CANNOT_CHECK_FOR_ERASED!>RecA<String><!>
|
||||
fun test(f: SelfR<String>) = <!USELESS_IS_CHECK!>f is <!CANNOT_CHECK_FOR_ERASED!>RecA<String><!><!>
|
||||
fun test(f: RecB<String>) = <!USELESS_IS_CHECK!>f is <!CANNOT_CHECK_FOR_ERASED!>RecA<String><!><!>
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
abstract class A
|
||||
abstract class B : A()
|
||||
|
||||
abstract class AS
|
||||
abstract class BS : AS()
|
||||
|
||||
interface AI
|
||||
interface BI : AI
|
||||
|
||||
fun test_1(a: A) {
|
||||
<!USELESS_IS_CHECK!>a is A<!> // always true
|
||||
a is B
|
||||
|
||||
a is AS // always false
|
||||
a is BS // always false
|
||||
|
||||
a is AI
|
||||
a is BI
|
||||
}
|
||||
|
||||
fun test_2(a: A) {
|
||||
<!USELESS_IS_CHECK!>a !is A<!> // always false
|
||||
a !is B
|
||||
|
||||
a !is AS // always true
|
||||
a !is BS // always true
|
||||
|
||||
a !is AI
|
||||
a !is BI
|
||||
}
|
||||
|
||||
fun test_3(a: Any) {
|
||||
if (a is A) {
|
||||
<!USELESS_IS_CHECK!>a is A<!> // always true
|
||||
a is B
|
||||
|
||||
a is AS // always false
|
||||
a is BS // always false
|
||||
|
||||
a is AI
|
||||
a is BI
|
||||
}
|
||||
}
|
||||
|
||||
fun test_4(a: A) {
|
||||
when (a) {
|
||||
<!USELESS_IS_CHECK!>is A<!> -> {} // always true
|
||||
is B -> {}
|
||||
|
||||
is AS -> {} // always false
|
||||
is BS -> {} // always false
|
||||
|
||||
is AI -> {}
|
||||
is BI -> {}
|
||||
}
|
||||
}
|
||||
|
||||
fun test_5(a: A) {
|
||||
when (a) {
|
||||
<!USELESS_IS_CHECK!>!is A<!> -> {} // always false
|
||||
!is B -> {}
|
||||
|
||||
!is AS -> {} // always true
|
||||
!is BS -> {} // here a may has type AS (by data flow)
|
||||
|
||||
!is AI -> {}
|
||||
!is BI -> {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
abstract class A
|
||||
abstract class B : A()
|
||||
|
||||
abstract class AS
|
||||
abstract class BS : AS()
|
||||
|
||||
interface AI
|
||||
interface BI : AI
|
||||
|
||||
fun test_1(a: A) {
|
||||
<!USELESS_IS_CHECK("true")!>a is A<!> // always true
|
||||
a is B
|
||||
|
||||
<!USELESS_IS_CHECK("false")!>a is AS<!> // always false
|
||||
<!USELESS_IS_CHECK("false")!>a is BS<!> // always false
|
||||
|
||||
a is AI
|
||||
a is BI
|
||||
}
|
||||
|
||||
fun test_2(a: A) {
|
||||
<!USELESS_IS_CHECK("false")!>a !is A<!> // always false
|
||||
a !is B
|
||||
|
||||
<!USELESS_IS_CHECK("true")!>a !is AS<!> // always true
|
||||
<!USELESS_IS_CHECK("true")!>a !is BS<!> // always true
|
||||
|
||||
a !is AI
|
||||
a !is BI
|
||||
}
|
||||
|
||||
fun test_3(a: Any) {
|
||||
if (a is A) {
|
||||
<!USELESS_IS_CHECK("true")!>a is A<!> // always true
|
||||
a is B
|
||||
|
||||
<!USELESS_IS_CHECK("false")!>a is AS<!> // always false
|
||||
<!USELESS_IS_CHECK("false")!>a is BS<!> // always false
|
||||
|
||||
a is AI
|
||||
a is BI
|
||||
}
|
||||
}
|
||||
|
||||
fun test_4(a: A) {
|
||||
when (a) {
|
||||
<!USELESS_IS_CHECK("true")!>is A<!> -> {} // always true
|
||||
is B -> {}
|
||||
|
||||
<!USELESS_IS_CHECK("false")!>is AS<!> -> {} // always false
|
||||
<!USELESS_IS_CHECK("false")!>is BS<!> -> {} // always false
|
||||
|
||||
is AI -> {}
|
||||
is BI -> {}
|
||||
}
|
||||
}
|
||||
|
||||
fun test_5(a: A) {
|
||||
when (a) {
|
||||
<!USELESS_IS_CHECK("false")!>!is A<!> -> {} // always false
|
||||
!is B -> {}
|
||||
|
||||
<!USELESS_IS_CHECK("true")!>!is AS<!> -> {} // always true
|
||||
!is BS -> {} // here a may has type AS (by data flow)
|
||||
|
||||
!is AI -> {}
|
||||
!is BI -> {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package
|
||||
|
||||
public fun test_1(/*0*/ a: A): kotlin.Unit
|
||||
public fun test_2(/*0*/ a: A): kotlin.Unit
|
||||
public fun test_3(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
public fun test_4(/*0*/ a: A): kotlin.Unit
|
||||
public fun test_5(/*0*/ a: A): kotlin.Unit
|
||||
|
||||
public abstract class A {
|
||||
public constructor A()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface AI {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public abstract class AS {
|
||||
public constructor AS()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public abstract class B : A {
|
||||
public constructor B()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface BI : AI {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public abstract class BS : AS {
|
||||
public constructor BS()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -9,7 +9,7 @@ class C() {
|
||||
|
||||
fun test(a : Any?) {
|
||||
if (a is B) {
|
||||
if (a is C) {
|
||||
if (<!USELESS_IS_CHECK!>a is C<!>) {
|
||||
<!DEBUG_INFO_SMARTCAST!>a<!>.bar();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,11 +30,11 @@ fun useEn(x: En) = x
|
||||
fun useEn2(x: En2) = x
|
||||
|
||||
fun bar(x: Any) {
|
||||
if (x is En && x is En2) {
|
||||
if (x is En && <!USELESS_IS_CHECK!>x is En2<!>) {
|
||||
when (<!DEBUG_INFO_SMARTCAST!>x<!>) {
|
||||
En.A -> useEn(<!DEBUG_INFO_SMARTCAST!>x<!>)
|
||||
En2.D -> useEn2(<!DEBUG_INFO_SMARTCAST!>x<!>)
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,4 +22,4 @@ fun String.gah(view:View ?) {
|
||||
if (view is <!UNRESOLVED_REFERENCE!>TextView<!>)
|
||||
view
|
||||
else <!UNRESOLVED_REFERENCE!>TextView<!>() as foo.TextView
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class C() {
|
||||
|
||||
fun test(a : Any?) {
|
||||
if (a is B) {
|
||||
if (a is C) {
|
||||
if (<!USELESS_IS_CHECK!>a is C<!>) {
|
||||
<!DEBUG_INFO_SMARTCAST!>a<!>.bar();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ sealed class B {
|
||||
}
|
||||
|
||||
fun foo(a: A) {
|
||||
if (a !is B) return
|
||||
if (<!USELESS_IS_CHECK!>a !is B<!>) return
|
||||
|
||||
<!NO_ELSE_IN_WHEN!>when<!> (<!DEBUG_INFO_SMARTCAST!>a<!>) {
|
||||
is A.A1 -> ""
|
||||
|
||||
+2
-2
@@ -78,7 +78,7 @@ fun branchedAndNested(x: Any?, y: Any?) {
|
||||
|
||||
|
||||
fun br(y: Any?) {
|
||||
if (myAssert(y is Int) == Unit && myAssert(y is String) == Unit) {
|
||||
if (myAssert(y is Int) == Unit && myAssert(<!USELESS_IS_CHECK!>y is String<!>) == Unit) {
|
||||
<!DEBUG_INFO_SMARTCAST!>y<!>.length
|
||||
<!DEBUG_INFO_SMARTCAST!>y<!>.inc()
|
||||
}
|
||||
@@ -89,7 +89,7 @@ fun branchedAndNestedWithNativeOperators(x: Any?, y: Any?) {
|
||||
equalsTrue(notEqualsNull(nullWhenNotString(x))) // x is String
|
||||
&&
|
||||
(
|
||||
(myAssert(y is Int) == Unit && myAssert(y is String) == Unit) // y is Int, String
|
||||
(myAssert(y is Int) == Unit && myAssert(<!USELESS_IS_CHECK!>y is String<!>) == Unit) // y is Int, String
|
||||
||
|
||||
equalsTrue(isInt(y) && isString(y)) // y is Int, String
|
||||
)
|
||||
|
||||
+2
-2
@@ -45,8 +45,8 @@ fun intersectingInfo2(x: Any?, y: Any?) {
|
||||
// of them is absent in each arg of "||"-operator, so they *shouldn't* lead to smartcast
|
||||
|
||||
if ((isString(x) && !notIsInt(x) && y is String) ||
|
||||
(!notIsString(x) && isString(y) && y is Int) ||
|
||||
(x is String && !notIsInt(y) && x is Int)) {
|
||||
(!notIsString(x) && isString(y) && <!USELESS_IS_CHECK!>y is Int<!>) ||
|
||||
(x is String && !notIsInt(y) && <!USELESS_IS_CHECK!>x is Int<!>)) {
|
||||
<!DEBUG_INFO_SMARTCAST!>x<!>.length
|
||||
x.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>inc<!>()
|
||||
y.<!UNRESOLVED_REFERENCE!>length<!>
|
||||
|
||||
Generated
+6
@@ -3615,6 +3615,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/cast/FlexibleTargetType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("isAlwaysFalse.kt")
|
||||
public void testIsAlwaysFalse() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/cast/isAlwaysFalse.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("IsErasedAllowForDerivedWithOneSubstitutedAndOneSameGeneric.kt")
|
||||
public void testIsErasedAllowForDerivedWithOneSubstitutedAndOneSameGeneric() throws Exception {
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ fun case_5(value_1: Boolean) {
|
||||
// TESTCASE NUMBER: 6
|
||||
fun case_6(value_1: Any) {
|
||||
when {
|
||||
value_1 is Nothing -> {}
|
||||
<!USELESS_IS_CHECK!>value_1 is Nothing<!> -> {}
|
||||
value_1 is Int -> {}
|
||||
value_1 is Boolean -> {}
|
||||
value_1 is String -> {}
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ fun case_8(value_1: Any?) {
|
||||
|
||||
// TESTCASE NUMBER: 9
|
||||
fun case_9(value_1: Any?) {
|
||||
if (funWithReturnsFalse(value_1 is String) || funWithReturnsFalse(value_1 is Int)) {
|
||||
if (funWithReturnsFalse(value_1 is String) || funWithReturnsFalse(<!USELESS_IS_CHECK!>value_1 is Int<!>)) {
|
||||
|
||||
} else {
|
||||
println(<!DEBUG_INFO_SMARTCAST!>value_1<!>.length)
|
||||
|
||||
+2
-2
@@ -18,8 +18,8 @@ fun Boolean?.case_1(): Boolean {
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun <T : <!FINAL_UPPER_BOUND!>Boolean<!>>T?.case_2(): Boolean {
|
||||
<!ERROR_IN_CONTRACT_DESCRIPTION!>contract<!> { returns(true) implies (this@case_2 != null && this@case_2 !is Nothing && <!DEBUG_INFO_SMARTCAST!>this@case_2<!>) }
|
||||
return this != null && this !is Nothing && <!DEBUG_INFO_SMARTCAST!>this<!>
|
||||
<!ERROR_IN_CONTRACT_DESCRIPTION!>contract<!> { returns(true) implies (this@case_2 != null && <!USELESS_IS_CHECK!>this@case_2 !is Nothing<!> && <!DEBUG_INFO_SMARTCAST!>this@case_2<!>) }
|
||||
return this != null && <!USELESS_IS_CHECK!>this !is Nothing<!> && <!DEBUG_INFO_SMARTCAST!>this<!>
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
|
||||
Vendored
+4
-4
@@ -70,13 +70,13 @@ class case_4 : ClassLevel3() {
|
||||
class case_5<T> : ClassLevel5() {
|
||||
inner class case_5_1 {
|
||||
fun <K : Number?>K.case_5_1_1() {
|
||||
contract { returns() implies (<!ERROR_IN_CONTRACT_DESCRIPTION!>this@case_5_1<!> !is ClassLevel1 && <!SENSELESS_COMPARISON!>this@case_5_1 != null<!> || <!USELESS_IS_CHECK!>this@case_5 is ClassLevel1<!> && this@case_5_1_1 is Float) }
|
||||
if (!(this@case_5_1 !is ClassLevel1 && <!SENSELESS_COMPARISON!>this@case_5_1 != null<!> || <!USELESS_IS_CHECK!>this@case_5 is ClassLevel1<!> && this is Float)) throw Exception()
|
||||
contract { returns() implies (<!USELESS_IS_CHECK!><!ERROR_IN_CONTRACT_DESCRIPTION!>this@case_5_1<!> !is ClassLevel1<!> && <!SENSELESS_COMPARISON!>this@case_5_1 != null<!> || <!USELESS_IS_CHECK!>this@case_5 is ClassLevel1<!> && this@case_5_1_1 is Float) }
|
||||
if (!(<!USELESS_IS_CHECK!>this@case_5_1 !is ClassLevel1<!> && <!SENSELESS_COMPARISON!>this@case_5_1 != null<!> || <!USELESS_IS_CHECK!>this@case_5 is ClassLevel1<!> && this is Float)) throw Exception()
|
||||
}
|
||||
|
||||
fun case_5_1_2() {
|
||||
contract { returns() implies (this@case_5_1 !is ClassLevel1 || <!USELESS_IS_CHECK!><!ERROR_IN_CONTRACT_DESCRIPTION!>this@case_5<!> is ClassLevel1<!> || <!SENSELESS_COMPARISON!>this@case_5_1 == null<!>) }
|
||||
if (!(this@case_5_1 !is ClassLevel1 || <!USELESS_IS_CHECK!>this@case_5 is ClassLevel1<!> || <!SENSELESS_COMPARISON!>this@case_5_1 == null<!>)) throw Exception()
|
||||
contract { returns() implies (<!USELESS_IS_CHECK!>this@case_5_1 !is ClassLevel1<!> || <!USELESS_IS_CHECK!><!ERROR_IN_CONTRACT_DESCRIPTION!>this@case_5<!> is ClassLevel1<!> || <!SENSELESS_COMPARISON!>this@case_5_1 == null<!>) }
|
||||
if (!(<!USELESS_IS_CHECK!>this@case_5_1 !is ClassLevel1<!> || <!USELESS_IS_CHECK!>this@case_5 is ClassLevel1<!> || <!SENSELESS_COMPARISON!>this@case_5_1 == null<!>)) throw Exception()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+21
-21
@@ -14,7 +14,7 @@
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(x: Any?) {
|
||||
if (x != null is Boolean) {
|
||||
if (x != <!USELESS_IS_CHECK!>null is Boolean<!>) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!><!UNSAFE_CALL!>.<!>equals(null)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!>.propT
|
||||
@@ -97,7 +97,7 @@ fun case_6(x: EmptyClass?) {
|
||||
|
||||
// TESTCASE NUMBER: 7
|
||||
fun case_7() {
|
||||
if (nullableNumberProperty != null || <!EQUALITY_NOT_APPLICABLE!><!DEBUG_INFO_CONSTANT, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing? & kotlin.Number?")!>nullableNumberProperty<!> != null is Boolean<!>) {
|
||||
if (nullableNumberProperty != null || <!EQUALITY_NOT_APPLICABLE!><!DEBUG_INFO_CONSTANT, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing? & kotlin.Number?")!>nullableNumberProperty<!> != <!USELESS_IS_CHECK!>null is Boolean<!><!>) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number?")!>nullableNumberProperty<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number?")!>nullableNumberProperty<!><!UNSAFE_CALL!>.<!>equals(null)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number?")!>nullableNumberProperty<!>.propT
|
||||
@@ -151,12 +151,12 @@ fun case_10() {
|
||||
fun case_11(x: TypealiasNullableStringIndirect<!REDUNDANT_NULLABLE!>?<!>, y: TypealiasNullableStringIndirect) {
|
||||
val t: TypealiasNullableStringIndirect = null
|
||||
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>x == null is Boolean<!>) {
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>x == <!USELESS_IS_CHECK!>null is Boolean<!><!>) {
|
||||
|
||||
} else {
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>y != null is Boolean<!> == true) {
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>y != <!USELESS_IS_CHECK!>null is Boolean<!><!> == true) {
|
||||
if (<!USELESS_IS_CHECK!>(nullableStringProperty == null) !is Boolean<!>) {
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>t != null is Boolean<!>) {
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>t != <!USELESS_IS_CHECK!>null is Boolean<!><!>) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect? /* = kotlin.String? */")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect? /* = kotlin.String? */")!>x<!>.equals(null)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableStringIndirect? /* = kotlin.String? */")!>x<!>.propT
|
||||
@@ -190,7 +190,7 @@ fun case_12(x: TypealiasNullableStringIndirect, y: TypealiasNullableStringIndire
|
||||
|
||||
// TESTCASE NUMBER: 13
|
||||
fun <!IMPLICIT_NOTHING_RETURN_TYPE!>case_13<!>(x: <!UNRESOLVED_REFERENCE!>otherpackage<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>Case13<!>?) =
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing")!>if (<!DEPRECATED_IDENTITY_EQUALS!>(<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>==<!> null !is Boolean) !== true<!>) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing")!>if (<!DEPRECATED_IDENTITY_EQUALS!>(<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>==<!> <!USELESS_IS_CHECK!>null !is Boolean<!>) !== true<!>) {
|
||||
throw Exception()
|
||||
} else {
|
||||
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE, DEBUG_INFO_EXPRESSION_TYPE("[ERROR : otherpackage.Case13]?")!>x<!>
|
||||
@@ -208,7 +208,7 @@ class Case14 {
|
||||
fun case_14() {
|
||||
val a = Case14()
|
||||
|
||||
if (a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>!=<!> <!USELESS_IS_CHECK!>null !is Boolean !is Boolean<!>) {
|
||||
if (a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>!=<!> <!USELESS_IS_CHECK!><!USELESS_IS_CHECK!>null !is Boolean<!> !is Boolean<!>) {
|
||||
if (a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>!=<!> null == true) {
|
||||
if (a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> !== null == false) {
|
||||
if (<!SENSELESS_COMPARISON!>a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>!=<!> null == null<!>) {
|
||||
@@ -219,11 +219,11 @@ fun case_14() {
|
||||
if (<!DEPRECATED_IDENTITY_EQUALS!>a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>!=<!> null === false<!>) {
|
||||
if (<!DEPRECATED_IDENTITY_EQUALS!>a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> !== null === true<!>) {
|
||||
if (<!USELESS_IS_CHECK!>(a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>!=<!> null != true) !is Boolean<!>) {
|
||||
if (a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>!=<!> null is Boolean) {
|
||||
if (a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>!=<!> <!USELESS_IS_CHECK!>null is Boolean is Boolean<!>) {
|
||||
if (<!IMPLICIT_BOXING_IN_IDENTITY_EQUALS!>a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> !== null is Boolean<!>) {
|
||||
if (a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>!=<!> null is Boolean) {
|
||||
if ((<!IMPLICIT_BOXING_IN_IDENTITY_EQUALS!>a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> !== null !is Boolean<!>) == false) {
|
||||
if (a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>!=<!> <!USELESS_IS_CHECK!>null is Boolean<!>) {
|
||||
if (a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>!=<!> <!USELESS_IS_CHECK!><!USELESS_IS_CHECK!>null is Boolean<!> is Boolean<!>) {
|
||||
if (<!IMPLICIT_BOXING_IN_IDENTITY_EQUALS!>a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> !== <!USELESS_IS_CHECK!>null is Boolean<!><!>) {
|
||||
if (a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>!=<!> <!USELESS_IS_CHECK!>null is Boolean<!>) {
|
||||
if ((<!IMPLICIT_BOXING_IN_IDENTITY_EQUALS!>a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!> !== <!USELESS_IS_CHECK!>null !is Boolean<!><!>) == false) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("[ERROR : otherpackage.Case14]?")!>a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!><!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("[ERROR : otherpackage.Case14]?")!>a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!><!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>equals<!>(a.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>x<!>)
|
||||
}
|
||||
@@ -246,7 +246,7 @@ fun case_14() {
|
||||
|
||||
// TESTCASE NUMBER: 15
|
||||
fun case_15(x: EmptyObject) {
|
||||
val <!UNUSED_VARIABLE!>t<!> = if (<!EQUALITY_NOT_APPLICABLE!>x === <!USELESS_IS_CHECK!><!USELESS_IS_CHECK!>null is Boolean is Boolean<!> is Boolean<!><!>) "" else {
|
||||
val <!UNUSED_VARIABLE!>t<!> = if (<!EQUALITY_NOT_APPLICABLE!>x === <!USELESS_IS_CHECK!><!USELESS_IS_CHECK!><!USELESS_IS_CHECK!>null is Boolean<!> is Boolean<!> is Boolean<!><!>) "" else {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("EmptyObject")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("EmptyObject")!>x<!>.equals(null)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("EmptyObject")!>x<!>.propT
|
||||
@@ -264,7 +264,7 @@ fun case_15(x: EmptyObject) {
|
||||
fun case_16() {
|
||||
val x: TypealiasNullableNothing = null
|
||||
|
||||
if (<!DEBUG_INFO_CONSTANT!>x<!> != <!USELESS_IS_CHECK!><!USELESS_IS_CHECK!><!USELESS_IS_CHECK!><!USELESS_IS_CHECK!>null !is Boolean !is Boolean<!> !is Boolean<!> !is Boolean<!> !is Boolean<!>) {
|
||||
if (<!DEBUG_INFO_CONSTANT!>x<!> != <!USELESS_IS_CHECK!><!USELESS_IS_CHECK!><!USELESS_IS_CHECK!><!USELESS_IS_CHECK!><!USELESS_IS_CHECK!>null !is Boolean<!> !is Boolean<!> !is Boolean<!> !is Boolean<!> !is Boolean<!>) {
|
||||
<!DEBUG_INFO_CONSTANT, DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableNothing /* = kotlin.Nothing? */")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableNothing /* = kotlin.Nothing? */")!>x<!><!UNSAFE_CALL!>.<!><!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>java<!>
|
||||
}
|
||||
@@ -312,7 +312,7 @@ fun case_19(b: Boolean) {
|
||||
}
|
||||
} else null
|
||||
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>a != null !is Boolean<!> && <!EQUALITY_NOT_APPLICABLE!>a<!UNSAFE_CALL!>.<!>B19 != null is Boolean<!> && <!EQUALITY_NOT_APPLICABLE!>a<!UNSAFE_CALL!>.<!>B19<!UNSAFE_CALL!>.<!>C19 != null is Boolean<!> && <!SENSELESS_COMPARISON!>a<!UNSAFE_CALL!>.<!>B19<!UNSAFE_CALL!>.<!>C19<!UNSAFE_CALL!>.<!>D19 != null == null<!> && <!SENSELESS_COMPARISON!>a<!UNSAFE_CALL!>.<!>B19<!UNSAFE_CALL!>.<!>C19<!UNSAFE_CALL!>.<!>D19<!UNSAFE_CALL!>.<!>x != null !== null<!>) {
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>a != <!USELESS_IS_CHECK!>null !is Boolean<!><!> && <!EQUALITY_NOT_APPLICABLE!>a<!UNSAFE_CALL!>.<!>B19 != <!USELESS_IS_CHECK!>null is Boolean<!><!> && <!EQUALITY_NOT_APPLICABLE!>a<!UNSAFE_CALL!>.<!>B19<!UNSAFE_CALL!>.<!>C19 != <!USELESS_IS_CHECK!>null is Boolean<!><!> && <!SENSELESS_COMPARISON!>a<!UNSAFE_CALL!>.<!>B19<!UNSAFE_CALL!>.<!>C19<!UNSAFE_CALL!>.<!>D19 != null == null<!> && <!SENSELESS_COMPARISON!>a<!UNSAFE_CALL!>.<!>B19<!UNSAFE_CALL!>.<!>C19<!UNSAFE_CALL!>.<!>D19<!UNSAFE_CALL!>.<!>x != null !== null<!>) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number?")!>a<!UNSAFE_CALL!>.<!>B19<!UNSAFE_CALL!>.<!>C19<!UNSAFE_CALL!>.<!>D19<!UNSAFE_CALL!>.<!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number?")!>a<!UNSAFE_CALL!>.<!>B19<!UNSAFE_CALL!>.<!>C19<!UNSAFE_CALL!>.<!>D19<!UNSAFE_CALL!>.<!>x<!><!UNSAFE_CALL!>.<!>equals(null)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number?")!>a<!UNSAFE_CALL!>.<!>B19<!UNSAFE_CALL!>.<!>C19<!UNSAFE_CALL!>.<!>D19<!UNSAFE_CALL!>.<!>x<!>.propT
|
||||
@@ -338,7 +338,7 @@ fun case_20(b: Boolean) {
|
||||
}
|
||||
}
|
||||
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>a.B19.C19.D19 !== null !is Boolean<!>) {
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>a.B19.C19.D19 !== <!USELESS_IS_CHECK!>null !is Boolean<!><!>) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("case_20.<no name provided>.B19.<no name provided>.C19.<no name provided>.D19.<no name provided>?")!>a.B19.C19.D19<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("case_20.<no name provided>.B19.<no name provided>.C19.<no name provided>.D19.<no name provided>?")!>a.B19.C19.D19<!><!UNSAFE_CALL!>.<!>equals(null)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("case_20.<no name provided>.B19.<no name provided>.C19.<no name provided>.D19.<no name provided>?")!>a.B19.C19.D19<!>.propT
|
||||
@@ -354,7 +354,7 @@ fun case_20(b: Boolean) {
|
||||
|
||||
// TESTCASE NUMBER: 21
|
||||
fun case_21() {
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>EnumClassWithNullableProperty.B.prop_1 !== null is Boolean<!> == <!USELESS_IS_CHECK!>true !is Boolean<!> != true) {
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>EnumClassWithNullableProperty.B.prop_1 !== <!USELESS_IS_CHECK!>null is Boolean<!><!> == <!USELESS_IS_CHECK!>true !is Boolean<!> != true) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>EnumClassWithNullableProperty.B.prop_1<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>EnumClassWithNullableProperty.B.prop_1<!><!UNSAFE_CALL!>.<!>equals(null)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>EnumClassWithNullableProperty.B.prop_1<!>.propT
|
||||
@@ -370,7 +370,7 @@ fun case_21() {
|
||||
|
||||
// TESTCASE NUMBER: 22
|
||||
fun case_22(a: (() -> Unit)?) {
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>a != null !is Boolean<!>) {
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>a != <!USELESS_IS_CHECK!>null !is Boolean<!><!>) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>()<!>.equals(null)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>()<!>.propT
|
||||
@@ -386,7 +386,7 @@ fun case_22(a: (() -> Unit)?) {
|
||||
|
||||
// TESTCASE NUMBER: 23
|
||||
fun case_23(a: ((Float) -> Int?)?, b: Float?) {
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>a != null !is Boolean<!> && <!EQUALITY_NOT_APPLICABLE!>b !== null is Boolean<!>) {
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>a != <!USELESS_IS_CHECK!>null !is Boolean<!><!> && <!EQUALITY_NOT_APPLICABLE!>b !== <!USELESS_IS_CHECK!>null is Boolean<!><!>) {
|
||||
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float?"), TYPE_MISMATCH!>b<!>)<!>
|
||||
if (x != null) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?")!>x<!>
|
||||
@@ -405,7 +405,7 @@ fun case_23(a: ((Float) -> Int?)?, b: Float?) {
|
||||
|
||||
// TESTCASE NUMBER: 24
|
||||
fun case_24(a: ((() -> Unit) -> Unit)?, b: (() -> Unit)?) =
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>a !== null is Boolean<!> && <!EQUALITY_NOT_APPLICABLE!>b !== null !is Boolean<!>) {
|
||||
if (<!EQUALITY_NOT_APPLICABLE!>a !== <!USELESS_IS_CHECK!>null is Boolean<!><!> && <!EQUALITY_NOT_APPLICABLE!>b !== <!USELESS_IS_CHECK!>null !is Boolean<!><!>) {
|
||||
<!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("(() -> kotlin.Unit)?"), TYPE_MISMATCH!>b<!>)
|
||||
<!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>(<!TYPE_MISMATCH!>b<!>)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("(() -> kotlin.Unit)?")!>b<!><!UNSAFE_CALL!>.<!>equals(null)
|
||||
@@ -481,4 +481,4 @@ fun case_27() {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number?")!>Object.prop_1<!>.funNullableT()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number?")!>Object.prop_1<!>.funNullableAny()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(x: Any?) {
|
||||
if (x is Nothing) {
|
||||
if (<!USELESS_IS_CHECK!>x is Nothing<!>) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any? & kotlin.Nothing")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||
}
|
||||
@@ -20,7 +20,7 @@ fun case_1(x: Any?) {
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(x: Any) {
|
||||
if (x is Nothing) {
|
||||
if (<!USELESS_IS_CHECK!>x is Nothing<!>) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||
}
|
||||
@@ -28,7 +28,7 @@ fun case_2(x: Any) {
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(x: Any?) {
|
||||
if (x !is Nothing) else {
|
||||
if (<!USELESS_IS_CHECK!>x !is Nothing<!>) else {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any? & kotlin.Nothing")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||
}
|
||||
@@ -36,7 +36,7 @@ fun case_3(x: Any?) {
|
||||
|
||||
// TESTCASE NUMBER: 4
|
||||
fun case_4(x: Any) {
|
||||
if (x !is Nothing) else {
|
||||
if (<!USELESS_IS_CHECK!>x !is Nothing<!>) else {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||
}
|
||||
@@ -52,7 +52,7 @@ fun case_5(x: Any?) {
|
||||
|
||||
// TESTCASE NUMBER: 6
|
||||
fun case_6(x: Any?) {
|
||||
if (!(x !is Nothing)) {
|
||||
if (!(<!USELESS_IS_CHECK!>x !is Nothing<!>)) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any? & kotlin.Nothing")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||
}
|
||||
@@ -60,7 +60,7 @@ fun case_6(x: Any?) {
|
||||
|
||||
// TESTCASE NUMBER: 7
|
||||
fun case_7(x: Any) {
|
||||
if (!(x is Nothing)) else {
|
||||
if (!(<!USELESS_IS_CHECK!>x is Nothing<!>)) else {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||
}
|
||||
@@ -84,7 +84,7 @@ fun case_9(x: Any?) {
|
||||
|
||||
// TESTCASE NUMBER: 10
|
||||
fun case_10(x: Any?) {
|
||||
if (!!(x !is Nothing)) else {
|
||||
if (!!(<!USELESS_IS_CHECK!>x !is Nothing<!>)) else {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any? & kotlin.Nothing")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||
}
|
||||
@@ -96,4 +96,4 @@ fun case_11(x: Any?) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>?.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(x: Nothing?) {
|
||||
if (<!DEBUG_INFO_CONSTANT!>x<!> is Int) {
|
||||
if (<!USELESS_IS_CHECK!><!DEBUG_INFO_CONSTANT!>x<!> is Int<!>) {
|
||||
<!DEBUG_INFO_CONSTANT, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?"), SMARTCAST_IMPOSSIBLE!>x<!>.inv()
|
||||
}
|
||||
@@ -29,7 +29,7 @@ fun case_2(x: Nothing) {
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(x: Nothing?) {
|
||||
if (<!DEBUG_INFO_CONSTANT!>x<!> !is Class) else {
|
||||
if (<!USELESS_IS_CHECK!><!DEBUG_INFO_CONSTANT!>x<!> !is Class<!>) else {
|
||||
<!DEBUG_INFO_CONSTANT, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?"), SMARTCAST_IMPOSSIBLE!>x<!>.prop_1
|
||||
}
|
||||
@@ -53,7 +53,7 @@ fun case_5(x: Nothing?) {
|
||||
|
||||
// TESTCASE NUMBER: 6
|
||||
fun case_6(x: Nothing?) {
|
||||
if (!(<!DEBUG_INFO_CONSTANT!>x<!> !is Object)) {
|
||||
if (!(<!USELESS_IS_CHECK!><!DEBUG_INFO_CONSTANT!>x<!> !is Object<!>)) {
|
||||
<!DEBUG_INFO_CONSTANT, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?"), SMARTCAST_IMPOSSIBLE!>x<!>.prop_1
|
||||
}
|
||||
@@ -85,7 +85,7 @@ fun case_9(x: Nothing?) {
|
||||
|
||||
// TESTCASE NUMBER: 10
|
||||
fun case_10(x: Nothing?) {
|
||||
if (!!(<!DEBUG_INFO_CONSTANT!>x<!> !is Interface3)) else {
|
||||
if (!!(<!USELESS_IS_CHECK!><!DEBUG_INFO_CONSTANT!>x<!> !is Interface3<!>)) else {
|
||||
<!DEBUG_INFO_CONSTANT, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?"), SMARTCAST_IMPOSSIBLE!>x<!>.itest()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?"), SMARTCAST_IMPOSSIBLE!>x<!>.itest3()
|
||||
|
||||
@@ -47,7 +47,7 @@ fun case_4(x: Any?) {
|
||||
|
||||
// TESTCASE NUMBER: 5
|
||||
fun case_5(x: Any?) {
|
||||
if (x as Nothing? is Nothing) {
|
||||
if (<!USELESS_IS_CHECK!>x as Nothing? is Nothing<!>) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!><!UNSAFE_CALL!>.<!><!MISSING_DEPENDENCY_CLASS!>inv<!>()
|
||||
}
|
||||
|
||||
+6
@@ -3609,6 +3609,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/cast/FlexibleTargetType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("isAlwaysFalse.kt")
|
||||
public void testIsAlwaysFalse() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/cast/isAlwaysFalse.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("IsErasedAllowForDerivedWithOneSubstitutedAndOneSameGeneric.kt")
|
||||
public void testIsErasedAllowForDerivedWithOneSubstitutedAndOneSameGeneric() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user