Do not report redundant else for enum / sealed from another module
Related to KT-17497
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
// MODULE: m1
|
||||
// FILE: a.kt
|
||||
|
||||
package test
|
||||
|
||||
enum class E {
|
||||
FIRST
|
||||
}
|
||||
|
||||
sealed class S
|
||||
|
||||
class Derived : S()
|
||||
|
||||
// MODULE: m2(m1)
|
||||
// FILE: b.kt
|
||||
|
||||
package other
|
||||
|
||||
import test.*
|
||||
|
||||
fun foo(e: E) = when (e) {
|
||||
E.FIRST -> 42
|
||||
else -> -42
|
||||
}
|
||||
|
||||
fun bar(s: S?) = when (s) {
|
||||
is Derived -> "Derived"
|
||||
null -> ""
|
||||
else -> TODO("What?!?!")
|
||||
}
|
||||
|
||||
fun baz(b: Boolean?) = when (b) {
|
||||
true -> 1
|
||||
false -> 0
|
||||
null -> -1
|
||||
// Still warning
|
||||
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> TODO()
|
||||
}
|
||||
|
||||
fun baz(b: Boolean) = when (b) {
|
||||
true -> 1
|
||||
false -> 0
|
||||
// Still warning
|
||||
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> TODO()
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// -- Module: <m1> --
|
||||
package
|
||||
|
||||
package test {
|
||||
|
||||
public final class Derived : test.S {
|
||||
public constructor Derived()
|
||||
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 final enum class E : kotlin.Enum<test.E> {
|
||||
enum entry FIRST
|
||||
|
||||
private constructor E()
|
||||
public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: test.E): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<test.E!>!
|
||||
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): test.E
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<test.E>
|
||||
}
|
||||
|
||||
public sealed class S {
|
||||
private constructor S()
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -- Module: <m2> --
|
||||
package
|
||||
|
||||
package other {
|
||||
public fun bar(/*0*/ s: test.S?): kotlin.String
|
||||
public fun baz(/*0*/ b: kotlin.Boolean): kotlin.Int
|
||||
public fun baz(/*0*/ b: kotlin.Boolean?): kotlin.Int
|
||||
public fun foo(/*0*/ e: test.E): kotlin.Int
|
||||
}
|
||||
|
||||
package test {
|
||||
}
|
||||
Reference in New Issue
Block a user