[FE 1.0] Fix reporting of non exhaustive when statement for whens with subject
^KT-48653 Fixed
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// FIR_IDENTICAL
|
||||
// LANGUAGE: +ProhibitNonExhaustiveWhenOnAlgebraicTypes
|
||||
// ISSUE: KT-48653
|
||||
|
||||
sealed class Sealed {
|
||||
object A : Sealed()
|
||||
object B : Sealed()
|
||||
}
|
||||
fun functionReturningSealed(): Sealed = null!!
|
||||
|
||||
fun test_1() {
|
||||
<!NO_ELSE_IN_WHEN!>when<!> (val result = functionReturningSealed()) {
|
||||
is Sealed.A -> {}
|
||||
}
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
val result2 = functionReturningSealed()
|
||||
<!NO_ELSE_IN_WHEN!>when<!> (result2) {
|
||||
is Sealed.A -> {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package
|
||||
|
||||
public fun functionReturningSealed(): Sealed
|
||||
public fun test_1(): kotlin.Unit
|
||||
public fun test_2(): kotlin.Unit
|
||||
|
||||
public sealed class Sealed {
|
||||
protected constructor Sealed()
|
||||
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 object A : Sealed {
|
||||
private 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 object B : Sealed {
|
||||
private 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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// FIR_IDENTICAL
|
||||
// LANGUAGE: -ProhibitNonExhaustiveWhenOnAlgebraicTypes
|
||||
// ISSUE: KT-48653
|
||||
|
||||
sealed class Sealed {
|
||||
object A : Sealed()
|
||||
object B : Sealed()
|
||||
}
|
||||
fun functionReturningSealed(): Sealed = null!!
|
||||
|
||||
fun test_1() {
|
||||
<!NON_EXHAUSTIVE_WHEN_STATEMENT!>when<!> (val result = functionReturningSealed()) {
|
||||
is Sealed.A -> {}
|
||||
}
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
val result2 = functionReturningSealed()
|
||||
<!NON_EXHAUSTIVE_WHEN_STATEMENT!>when<!> (result2) {
|
||||
is Sealed.A -> {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package
|
||||
|
||||
public fun functionReturningSealed(): Sealed
|
||||
public fun test_1(): kotlin.Unit
|
||||
public fun test_2(): kotlin.Unit
|
||||
|
||||
public sealed class Sealed {
|
||||
protected constructor Sealed()
|
||||
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 object A : Sealed {
|
||||
private 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 object B : Sealed {
|
||||
private 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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user