53d6ac24e5
* Change 1.6 to 1.7 constants * Fix SAFE_CALL_WILL_CHANGE_NULLABILITY for testData * Change EXPOSED_PROPERTY_TYPE_IN_CONSTRUCTOR_WARNING to EXPOSED_PROPERTY_TYPE_IN_CONSTRUCTOR_ERROR * Change NON_EXHAUSTIVE_WHEN_STATEMENT to NO_ELSE_IN_WHEN * Fix testData for SafeCallsAreAlwaysNullable * Change T -> T & Any in test dumps * Change INVALID_CHARACTERS_NATIVE_WARNING -> INVALID_CHARACTERS_NATIVE_ERROR * TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_WARNING -> TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR
31 lines
965 B
Kotlin
Vendored
31 lines
965 B
Kotlin
Vendored
// LANGUAGE: +WarnAboutNonExhaustiveWhenOnAlgebraicTypes
|
|
/*
|
|
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
|
*
|
|
* SPEC VERSION: 0.1-152
|
|
* PRIMARY LINKS: expressions, when-expression -> paragraph 5 -> sentence 1
|
|
* expressions, when-expression, exhaustive-when-expressions -> paragraph 1 -> sentence 1
|
|
* expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 6
|
|
* expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 7
|
|
* expressions, when-expression -> paragraph 9 -> sentence 2
|
|
* expressions, when-expression, exhaustive-when-expressions -> paragraph 3 -> sentence 1
|
|
* type-inference, smart-casts, smart-cast-types -> paragraph 9 -> sentence 1
|
|
*/
|
|
|
|
sealed class S
|
|
|
|
object First : S()
|
|
|
|
class Derived(val s: String) : S()
|
|
|
|
object Last : S()
|
|
|
|
fun use(s: String) = s
|
|
|
|
fun foo(s: S) {
|
|
<!NO_ELSE_IN_WHEN!>when<!> (s) {
|
|
First -> {}
|
|
is Derived -> use(<!DEBUG_INFO_SMARTCAST!>s<!>.s)
|
|
}
|
|
}
|